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


Joined: 14 Jul 2005
Posts: 3

PostPosted: Sun Nov 19, 2006 4:20 am   

Question on a 'find' trigger.
 
Ok, this is for 'the two towers' mud. What i'm trying to do is have it where when someone sends me a tell saying 'find (whatever the person's name is)', and I run the find on that person and send the person asking back the results of the find. It would look something like this:

Someone1 tells you: find someone2

find someone2

Someone2 is in South Rhovanion at The ruins of Osgiliath.
In the room: inside a tent.
Someone2 is not wanted.

tell someone1: Someone2 is in South Rhovanion at The ruins of Osgiliath. In the room: inside a tent.


Obviously the names and places will vary.
This is what I have so far:

Pattern: (*) tells you: find (*)
Value: do find %2

That will cause me to run the find on %2, obviously. I've tried a few things but with no luck. I can't figure out how get information back to the person that requested it automatically.

Any ideas would be greatly appreciated. I'm fairly new at this stuff and have tried reading the help files and browsing zugg's site.
_________________
Only when you fall all the way down, you can get up and soar into the sky.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Nov 19, 2006 5:44 am   
 
#trig {(%w) tells you: find (%w)} {#var finder %1;do find %2}
#cond {(%w) is in (*).$In the room: (*)} {tell @finder %1 is in %2 in the room %3}

I haven't actually tested this (I've stopped using zMUD in favour of CMUD) but it should still work. If it's going to stop working, the place it's going to do it is at .$In in the second trigger state. What you'll need to do is either save the location from the first line to another variable and make another state to capture the second one and send the tell, or make another state and send the info as two tells, so it'll look something like this:

#trig {(%w) tells you: find (%w)} {#var finder %1;do find %2}
#cond {(%w) is in (*).} {tell @finder %1 is in %2}
#cond {In the room: (*)} {tell @finder In the room %1}

EDIT: I also realised that you're going to want to create a trigger for when someone tells you to find an invalid name, to reset the trigger to its first state. You'll need to give the trigger an ID by changing it to #trig "idname" {pattern} and then use the #state command to reset the trigger :)
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