Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Mbwana
Beginner


Joined: 18 May 2002
Posts: 10
Location: Canada

PostPosted: Thu Apr 18, 2002 3:56 am   

Room Script question/problem
 
I'm playing RiftShadow mud. One of the "features" of my home city is lifts which connect various portions of the city which are situated on nearby mountaintops. The text goes something like this. (Input marked by *)

You see a large contraption to your west. A steel lever is here.
*pull lever (here one of two things happens. If the lift is already present, the lever is pulled into the up position and after a couple seconds the lift leaves for the connecting location. If the lift is not present, the lever is pulled into the down position and after a few seconds, the lift arrives.

After determining the position of the lever (must be "up") I issue the appropriate direction command (which is different for each lift location). I have created an alias as follows: #ALIAS lift {#TEMP {^You pull the lever into the (%w) position.} {#IF (%%1 =~ "up") {%1;#OK} {#TEMP {^The doors to the lift slide open with a loud clang.} {pull lever;%1;#OK}}};pull lever} "Mapper"

However inelegant the alias may be, it works. (If anyon knows a better way to do this, I'm all ears. However, this is not the issue I currently have.) What I have been trying to do is use the Room script option in the Mapper to replace the appropriate direction with the alias for one time only. For instance, say the lift direction is west. I want to be able to push the NUM4 button and have the alias executed. (I've tried the #key command, it doesn't seem to work in room scripts, it still issues "w"). Alternatively, while in this room, I'd like to have the first instance of "w" captured and substituted for "lift w" so that when the mapper issues the "w" command in this room while speedwalking (and when I push the NUM4 button while navigating manually) the lift alias is executed only once. I've tried #oninput, but it causes a neverending loop, as one might imagine. I've also tried #temp (in place of #oninput) but this winds up issuing the pull lever command four times without ever giving the "w" command, then quits. Any help would be appreciated.
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Mon Apr 22, 2002 4:31 am   
 
Have you tried to define an alias in the room script? like:
#ALIAS w {lift w}

However it might be difficult to get rid of the alias again.
My old 5.54 doesn't update roomscripts on #MOVE or #TELEP commands, that might be fixed in one of the newer version (I'm still in the process of upgrading to v6.26).
Reply with quote
Mbwana
Beginner


Joined: 18 May 2002
Posts: 10
Location: Canada

PostPosted: Mon Apr 22, 2002 5:44 am   
 
quote:

Have you tried to define an alias in the room script? like:
#ALIAS w {lift w}

However it might be difficult to get rid of the alias again.
My old 5.54 doesn't update roomscripts on #MOVE or #TELEP commands, that might be fixed in one of the newer version (I'm still in the process of upgrading to v6.26).





I did not try the alias you suggested largely because I assumed it would cause an endless loop much like the #oninput command. Unless #alias works in some way I don't understand it should cause the same problem.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 22, 2002 6:16 am   
 
This script would probably be a minor improvement on the one you have. It does pretty much the same thing.
#AL lift {#VAR lift %1;#T+ lift;pull lever}
#CLASS lift
#TR {You pull the lever into the up position} {@lift;#OK;#T- lift}
#TR {The doors to the lift slide open with a loud clang} {pull lever}
#CLASS 0


The real problem is modifying the movement command without creating a loop. Probably a #ONINPUT inside a class.
#ONINPUT {^w } {#T- liftw;lift w} {liftw}

Your roomscript would be:
#T+ liftw
To be on the safe side, you should probably use
#T- liftw
in the roomscript for all connecting rooms.

I'm not sure this will work, but it's worth a try. Good luck!

LightBulb
Vague questions get vague answers
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Tue Apr 23, 2002 6:41 am   
 
This is more tricky then I thought.
Usually you can use ~command if you want to send the command litterally, instead of calling an alias with the same name.
So just replacing the w in the trigger that lift w by a ~w would have done the trick.

But somehow zMUD's command parser gets in your way here, and refuses to instert a single ~.
A workaround would be using #EXEC:
#ALIAS lift {#TEMP {^You pull the lever into the (%w) position.} {#IF (%%1 = "up") {#EXEC {~~%1};#OK} {#TEMP {^The doors to the lift slide open with a loud clang.} {pull lever;#EXEC {~~%1};#OK}}};pull lever} "Mapper"
now the #EXEC {~~%1} becomes a #EXEC {~~w} which becomes a 'normal' ~w when #EXEC is processed.
So together with a
#ALIAS w {lift w}
in the room script it should work fine.
(tested offline with v6.26a)

Lightbulbs solution is 'cleaner', with the only drawback that it clutters your settings a bit.

PS.
If you just want to do compare two words like 'west' and 'up', there is no point in using the pattern matching operator =~.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Apr 24, 2002 7:52 am   
 
Blantant OT but

Great seeing you in the forum
Sildaren!

Ton Diening
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net