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
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Sun Apr 07, 2002 8:50 am   

Capturing directions
 
This should be an easy one.

I want to write a script that will walk around, pickup obvious room exits, and map out the unexplored areas.

I'm really only concerned about picking up the obvious exits. Syntax is like this

Room name (n,s,e,w,sw,nw,ne,se,u,d,cave,out,tunnel)

basically, the only thing I have to go by is the "()" and the "," that seperates each one ... so i guess I need to capture a RANDOM amount of DIFFERENT directions between () and put them in a var.
Reply with quote
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Sun Apr 07, 2002 9:40 am   
 
Ok, it looks like I'm able to answer my own question. I wrote a trigger that looks like this:

#TRIGGER ~((*)~)
#VAR exits %replace(%1,",","|")

this will match everything that has a () around it, including possible non-exits. but I can't think of anything better. (if you can, i'd love to hear it)

now my trouble is getting a command to randomly execute one of the obvious directions out of the var. I tried:

#1 {%item(@exits,%random(1,15))}

the problem with this is that %random doesn't always return a number that matches something in the @exits var. Is there a way to count how many items are in a var?

Also, I need to pause this room wandering when I encounter a monster. Monsters are unfortunatly hard to define. Output looks like this:

Room name (n,w,s,e)
An Ugly Troll.

The mobs always come next line after the exits and i believe they all end with a "." ... maybe i can match something on this?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 07, 2002 11:22 am   
 
Look up %numitems to find out how many.

To give pause on mobs you will either have to put the execution of the direction command into a trigger that you know will come after mobs (prompt trigger comes to mind); or you will haave to use an ALARM. The format for such would be #EXEC %expand(#ALARM {+1} {%item(@exits,%random(1,%numitems(@exits))}).

Then you just need a way to turn the sending of the command off when mobs have been detected...perhaps an #IF would work in the case of doing the direction through the prompt trigger. In the case of using an ALARM you will have to vastly enhance the syntax so that you control expansion on each part of the ALARMS script, in order to that you will have to look up %concat and %expand in the help and tweak it a lot.
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