startup randomize

deb

Distinguished
Jul 22, 2003
98
0
18,630
Archived from groups: rec.games.int-fiction (More info?)

hi,
while i'm trying to use the randomize function, it seems tads 3
doesn't have any commoninit (or std.t for that matter ) where one
could initialise randomize once at start of the game. where are these
things defined in tads 3 and how is it done ?
 
Archived from groups: rec.games.int-fiction (More info?)

"Deb" <green4231@yahoo.se> wrote in message
news:ce3c9b01.0407311606.38e11734@posting.google.com...
> hi,
> while i'm trying to use the randomize function, it seems tads 3
> doesn't have any commoninit (or std.t for that matter ) where one
> could initialise randomize once at start of the game. where are these
> things defined in tads 3 and how is it done ?

Sorry I'm unable to answer your question, Deb, but here are three
humble suggestions:

1. post in rec.arts.int-fiction, since this is an authorship question
2. add [TADS] to your subject line
3. read http://plover.net/~textfire/raiffaq/welcome.html,
where other useful advice can be found

Cheers, Roger
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
You'll find all my IF pages at http://www.firthworks.com/roger
WARNING: aggressive spam deletion -- use a meaningful Subject!
 
Archived from groups: rec.games.int-fiction (More info?)

"Deb" <green4231@yahoo.se> wrote in message
news:ce3c9b01.0407311606.38e11734@posting.google.com...
> hi,
> while i'm trying to use the randomize function, it seems tads 3
> doesn't have any commoninit (or std.t for that matter ) where one
> could initialise randomize once at start of the game. where are
these
> things defined in tads 3 and how is it done ?

In TADS3 these things are done in gameMain.newGame(); this defines
an empty empty method gameMain.showIntro() which it a convenient
place to put your own startup code.

For more details, have a look at the code and comments for
GameMainDef in the library code (misc.t), and/or search for
GameMainDef in the .../lib/adv/changes.htm file that's part of the
documentation that comes with the standard TADS3 distribution.

-- Eric
 
Archived from groups: rec.games.int-fiction (More info?)

thanks for your answer and thanks in general for your very good user
guides to tads 3, which are very important in helping beginners out
with this language.

another thing, when i use inputKey, that always seems to be played
before anything else. for instance, if i do a

if(x==3) {"blablablah"; inputKey; clearScreen;
gActor.moveInto(newroom);}

the keypress is asked for even before the "blahblabhlah" message is
displayed. any way to make it ask for a keypress after the message but
before the transportation into a new room? thanks.







"Eric Eve" <eric.eve@NOSPAMhmc.ox.ac.uk> wrote in message news:<cei60c$pii$1@news.ox.ac.uk>...
> "Deb" <green4231@yahoo.se> wrote in message
> news:ce3c9b01.0407311606.38e11734@posting.google.com...
> > hi,
> > while i'm trying to use the randomize function, it seems tads 3
> > doesn't have any commoninit (or std.t for that matter ) where one
> > could initialise randomize once at start of the game. where are
> these
> > things defined in tads 3 and how is it done ?
>
> In TADS3 these things are done in gameMain.newGame(); this defines
> an empty empty method gameMain.showIntro() which it a convenient
> place to put your own startup code.
>
> For more details, have a look at the code and comments for
> GameMainDef in the library code (misc.t), and/or search for
> GameMainDef in the .../lib/adv/changes.htm file that's part of the
> documentation that comes with the standard TADS3 distribution.
>
> -- Eric
 
Archived from groups: rec.games.int-fiction (More info?)

"Deb" <green4231@yahoo.se> wrote in message
news:ce3c9b01.0408021651.77ee5824@posting.google.com...
> thanks for your answer and thanks in general for your very good
user
> guides to tads 3, which are very important in helping beginners
out
> with this language.

I'm glad you find them useful!

> another thing, when i use inputKey, that always seems to be played
> before anything else. for instance, if i do a
>
> if(x==3) {"blablablah"; inputKey; clearScreen;
> gActor.moveInto(newroom);}
>
> the keypress is asked for even before the "blahblabhlah" message
is
> displayed. any way to make it ask for a keypress after the message
but
> before the transportation into a new room? thanks.

Yes, that's how inputKey behaves. Probably the simplest way around
it is to use the inputManager methods instead (not exactly obvious,
I have to agree), so instead of:

ans = inputKey();

You'd use

ans = inputManager.getKey(nil, nil);

In the particular case you've got above, however, you might want to
use a more prompt. There is a morePrompt function that provides
that, but you'll find the same problem you did with inputKey. So
instead of morePrompt you'd want to use:

inputManager.pauseForMore(true);

The more complicated alternative would be to toggle the transcript
on and off:

if(x==3)
{
gTranscript.deactivate();
"blablablah";
inputKey;
clearScreen;
gActor.moveIntoForTravel(newroom);
gTranscript.activate();
}

Another point: if you want to move actors around, use
moveIntoForTravel, not moveInto, otherwise you might run into all
sorts of problems. See http://www.tads.org/howto/t3npcTravel.htm.

-- Eric
 
Archived from groups: rec.games.int-fiction (More info?)

one problem i have with these commands is that enteringRoom(traveler)
isn't triggered when i use moveIntoForTravel to transfer the player,
or moveInto for that matter - i have to use travelVia. there is
another method to make things happen on being transported to a room?
thanks.


"Eric Eve" <eric.eve@NOSPAMhmc.ox.ac.uk> wrote in message news:<cendsg$f8e$1@news.ox.ac.uk>...
> "Deb" <green4231@yahoo.se> wrote in message
> news:ce3c9b01.0408021651.77ee5824@posting.google.com...
> > thanks for your answer and thanks in general for your very good
> user
> > guides to tads 3, which are very important in helping beginners
> out
> > with this language.
>
> I'm glad you find them useful!
>
> > another thing, when i use inputKey, that always seems to be played
> > before anything else. for instance, if i do a
> >
> > if(x==3) {"blablablah"; inputKey; clearScreen;
> > gActor.moveInto(newroom);}
> >
> > the keypress is asked for even before the "blahblabhlah" message
> is
> > displayed. any way to make it ask for a keypress after the message
> but
> > before the transportation into a new room? thanks.
>
> Yes, that's how inputKey behaves. Probably the simplest way around
> it is to use the inputManager methods instead (not exactly obvious,
> I have to agree), so instead of:
>
> ans = inputKey();
>
> You'd use
>
> ans = inputManager.getKey(nil, nil);
>
> In the particular case you've got above, however, you might want to
> use a more prompt. There is a morePrompt function that provides
> that, but you'll find the same problem you did with inputKey. So
> instead of morePrompt you'd want to use:
>
> inputManager.pauseForMore(true);
>
> The more complicated alternative would be to toggle the transcript
> on and off:
>
> if(x==3)
> {
> gTranscript.deactivate();
> "blablablah";
> inputKey;
> clearScreen;
> gActor.moveIntoForTravel(newroom);
> gTranscript.activate();
> }
>
> Another point: if you want to move actors around, use
> moveIntoForTravel, not moveInto, otherwise you might run into all
> sorts of problems. See http://www.tads.org/howto/t3npcTravel.htm.
>
> -- Eric
 
Archived from groups: rec.games.int-fiction (More info?)

"Deb" <green4231@yahoo.se> wrote in message
news:ce3c9b01.0408031623.2c9e5f70@posting.google.com...
> one problem i have with these commands is that
enteringRoom(traveler)
> isn't triggered when i use moveIntoForTravel to transfer the
player,
> or moveInto for that matter - i have to use travelVia. there is
> another method to make things happen on being transported to a
room?
> thanks.

Well, once again I'd refer you to
http://www.tads.org/howto/t3npcTravel.htm, which explains which
travel methods do or don't trigger notifications.

If nothing there meets your needs, you could set up your own scheme,
e.g.:

modify Thing
moveIntoForTravelNotify(newDest)
{
moveIntoForTravel(newDest);
newDest.enteringRoom(self);
}
;

Then call moveIntoForTravelNotify() on whichever actor you want to
move, and the enteringRoom method will be called on the destination
room.

-- Eric
 
Archived from groups: rec.games.int-fiction (More info?)

thanks. however, you have any idea why (travelvia, destination )
causes the room description to be shown two times when you arrive?
that happens to me at least.


"Eric Eve" <eric.eve@NOSPAMhmc.ox.ac.uk> wrote in message news:<ceq328$c2v$1@news.ox.ac.uk>...
> "Deb" <green4231@yahoo.se> wrote in message
> news:ce3c9b01.0408031623.2c9e5f70@posting.google.com...
> > one problem i have with these commands is that
> enteringRoom(traveler)
> > isn't triggered when i use moveIntoForTravel to transfer the
> player,
> > or moveInto for that matter - i have to use travelVia. there is
> > another method to make things happen on being transported to a
> room?
> > thanks.
>
> Well, once again I'd refer you to
> http://www.tads.org/howto/t3npcTravel.htm, which explains which
> travel methods do or don't trigger notifications.
>
> If nothing there meets your needs, you could set up your own scheme,
> e.g.:
>
> modify Thing
> moveIntoForTravelNotify(newDest)
> {
> moveIntoForTravel(newDest);
> newDest.enteringRoom(self);
> }
> ;
>
> Then call moveIntoForTravelNotify() on whichever actor you want to
> move, and the enteringRoom method will be called on the destination
> room.
>
> -- Eric
 
Archived from groups: rec.games.int-fiction (More info?)

"Deb" <green4231@yahoo.se> wrote in message
news:ce3c9b01.0408131646.4d022553@posting.google.com...
>
> "Eric Eve" <eric.eve@NOSPAMhmc.ox.ac.uk> wrote in message
news:<ceq328$c2v$1@news.ox.ac.uk>...
> > "Deb" <green4231@yahoo.se> wrote in message
> > news:ce3c9b01.0408031623.2c9e5f70@posting.google.com...
> > > one problem i have with these commands is that
> > enteringRoom(traveler)
> > > isn't triggered when i use moveIntoForTravel to transfer the
> > player,
> > > or moveInto for that matter - i have to use travelVia. there
is
> > > another method to make things happen on being transported to a
> > room?
> > > thanks.
> >
> > Well, once again I'd refer you to
> > http://www.tads.org/howto/t3npcTravel.htm, which explains which
> > travel methods do or don't trigger notifications.
> >
> > If nothing there meets your needs, you could set up your own
scheme,
> > e.g.:
> >
> > modify Thing
> > moveIntoForTravelNotify(newDest)
> > {
> > moveIntoForTravel(newDest);
> > newDest.enteringRoom(self);
> > }
> > ;
> >
> > Then call moveIntoForTravelNotify() on whichever actor you want
to
> > move, and the enteringRoom method will be called on the
destination
> > room.

> thanks. however, you have any idea why (travelvia, destination )
> causes the room description to be shown two times when you arrive?
> that happens to me at least.
>

It shouldn't normally. Perhaps you've put code to display the room
description in enteringRoom()? If so then it would be called once
when TravelVia triggers enteringRoom() and a second time when
TravelVia triggers its standard look around. If all you wanted was
to see a room description after moveIntoForTravel, then you need to
call that as a distinct step (e.g. nestedAction(gPlayerChar,
Look); ) rather than from within enteringRoom.

-- Eric