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
DeReP
Adept


Joined: 14 Jun 2003
Posts: 222
Location: Chile

PostPosted: Wed Feb 18, 2004 10:34 pm   

Variables
 
Hi, I've been trying to make this work for a while now, just cant, maybe i'm too tired.
Ok here's the deal, I have a variable "@allexits" and I need to substract the current room exits from it at a given point, then pick a random exit from the remaining ones to use in a command.
@allexits = n|s|e|w|u|d

I'm using %roomexit to get the current room exits, but I cant substract them directly from the @allexits variable, so I guess I need to separate each item in the @exits variable (wich is called with %roomexit function). and when all that is done, I have to pick a random non-room-exit from the remaining in @allexits variable and use it in a comand like
kick "random non-exit direction" mob
any guidance through this?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Feb 19, 2004 1:14 am   
 
It has all the concepts you mentioned, but I couldn't quite figure out how you really wanted it structured. I figure you are probably going to be staying in the same room so it makes more sense to proccess the list once for the room rather then rebuilding it every time.

#ALIAS PrepKick {KickDirs="";#FORALL "n|s|e|w|u|d" {#IF (%ismember("%i",%roomexit)=0) {#ADDITEM KickDirs {%i}}}}
#ALIAS RndKick {kick %item(@KickDirs,%eval(%random(%numitems(@KickDirs)+1)) %1}
Reply with quote
DeReP
Adept


Joined: 14 Jun 2003
Posts: 222
Location: Chile

PostPosted: Thu Feb 19, 2004 7:14 pm   
 
Great, never thought of that way, I was trying to handle the variables more and made a mess. Works like a charm, thanks.
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