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
Kaset
Newbie


Joined: 08 Feb 2003
Posts: 8
Location: USA

PostPosted: Sat Feb 08, 2003 3:35 pm   

Help with Random script
 
Ok, in the Mud I play, I have the ability to go incorpreal, evade away from opponents so they can't see me move, and conjure illusions.

I want a script that will randomly conjure an illusion in a direction found in a line that looks like this....

You see exits leading north (open door), east, south (open door), southwest
(open door), west (closed door), and northwest (open door).

HOWEVER. I need it so that it captures the look text of which exits are valid and then randoms those. Thats where I'm getting tripped up.

I think I'll need something akin to the following

#Var ql
#TRIGGER {You see exits leading %1, %2, and %3.} {#case %random {conjure
illusion A ghostly apparition disappears to the %1.}

But how to get the exits Into the variable or make sure that it uses valid exits is beyond me.

Any help would be most appreciated
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sat Feb 08, 2003 4:04 pm   
 
if you use the automapper, then a trigger using %roomexits() would be appropriate. Assuming no:

#tr {You see exits leading (*).} {
#var exitstring %replace( "%1", ",", "|")
i = 1
#forall @exitstring {
#if (%pos( "(closed door)", %i)) {#delnitem exitstring @i}
#add i 1
}
exitstring = %replace( @exitstring, "(open door)", "")
exitstring = %replace( @exitstring, "and", "")
exitstring = %replace( @exitstring, " ", "")
}
#alias runil {conjure illusion A ghostly apparition disappears to the %item( @exitstring, %random( 1, %numitems( @exitstring))).}

should work.

--note: Just leave the trigger on all the time, or disable it when you know you won't need it. When its on, the alias runil will create the correct string. When its off, the behaviour of the alias is undefined.

--------

moon.icebound.net:9000
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