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
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Oct 10, 2006 1:01 am   

Need a bit of guidance here...
 
Here's the situation - I want to create some sort of macro that I can push to create the following effect:

No matter what direction I go in (using numpad for directions), the macro will perform an action in the room I just passed - for instance, if I press 6 on the numpad to go east, and then I press a macro to shut door, I want it to return 'shut door west', or if I press 2 for south, the macro returns 'shut door north.'

Anyone who can even guide me in the right direction, I will greatly appreciate it. Thank you.

Charneus
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Oct 10, 2006 3:38 am   
 
This one's fairly easy to do. First, unless you've done so already for some other reason, create local copies of all the keypad macros (the ones Zugg provide are inherited versions and best left alone themselves). For this purpose, you can just copy and paste them all. Next, in each one set a variable to contain the command being sent by that macro and send the command:

#key KEY8 {direction = n;n}

Finally, in all your other macros that you want to have directional capability, use a %case() function to test @direction:

shut door %case(%ismember(@direction,"n|s|e|w|ne|nw|se|sw|u|d")s,n,w,e,sw,se,nw,se,d,u)

This will, of course, fail if you are using the mapper and the mapper uses OTHER type exits. In that case, ZMud internally looks up the associated command and automatically substitutes the normal directional command with it. Thus, while you did press the 8 key the direction used might not have been NORTH (it could be something like GO DOOR)
_________________
EDIT: I didn't like my old signature
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