It's been a while since I've done any building and I see that tbaMUD has bumped to a new version since so I don't know if this question is still relevant. Anyhow, I've noticed that in scripts where I try to call on random.n twice with two different values of n both calls are set to the same value. Is this a design flaw of the script or merely a limitation?
Code:
*
* Commute Path - Gillian
* by Krell
* 12 June 2013
* tbaMUD Z163
*
set H_VNUM 16328
set LOBBY 16301
*
* I've made L_TIME a function of S_TIME as two random.# statements
* seem to always choose the same value which suggests that two or
* more random.# statements in a script are not independent. I am
* probably wrong about this.
*
* Modify at your own discretion.
*
set S_TIME %random.3%
set L_TIME %S_TIME% + 1
*set OPEN_TIME 8:00
*set CLOSE_TIME 18:00
context %self.id%
wait until 8:00
set in_commute_z163 1
global in_commute_z163
stand
%teleport% %self% %LOBBY%
%echo% %self.name% enters the lobby doors and walks toward the library.
wait %L_TIME% s
south
wait %S_TIME% s
%echo% %self.name% walks toward the Service Desk.
wait %L_TIME% s
sit
wait %S_TIME% s
%echo% %self.name% opens up some ledgers and turns on %self.hisher% computer.
set in_commute_z163 0
global in_commute_z163
wait until 18:00
set in_commute_z163 1
global in_commute_z163
%echo% %self.name% looks through a ledger, signs off %self.hisher% name.
wait %L_TIME% s
%echo% %self.name% puts some ledgers away.
wait %S_TIME% s
%echo% %self.name% turns off %self.hisher% computer.
wait %S_TIME% s
stand
wait %S_TIME% s
%echo% %self.name% stretches %self.hisher% back.
wait %L_TIME% s
%echo% %self.name% walks toward the library entrance doors
wait %S_TIME% s
north
wait %L_TIME% s
%echo% %self.name% crosses the lobby and leaves the building.
global in_commute_z163
%echo% %self.name% looks through a ledger, signs off %self.hisher% name.
wait %L_TIME% s
%echo% %self.name% puts some ledgers away.
wait %S_TIME% s
%echo% %self.name% turns off %self.hisher% computer.
wait %S_TIME% s
stand
wait %S_TIME% s
%echo% %self.name% stretches %self.hisher% back.
wait %L_TIME% s
%echo% %self.name% walks toward the library entrance doors
wait %S_TIME% s
north
wait %L_TIME% s
%echo% %self.name% crosses the lobby and leaves the building.
%teleport% %self% %H_VNUM%
*
* Variable Checking. Make sure global is where it's supposed to be.
* Perhaps superfluous when using wait-until?
*
if %time.hour% > 8 && %time.hour% < 18 && %in_commute_z163%
set in_commute_z163 0
global in_commute_z163
elseif %time.hour% >= 18 || %time.hour% > 0 && %time.hour% <= 8 && !%in_commute_z163%
set in_commute_z163 1
global in_commute_z163
end
PS. I may have asked this before, but it may have been on the MUD, I see no logs of the event and I don't see it recorded anywhere here in the forum. So, for posterity...