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
peewee
Wanderer


Joined: 22 Oct 2000
Posts: 90
Location: Sweden

PostPosted: Fri Aug 30, 2002 1:32 am   

Aid with an aid
 
I'll this short.

MISSION: Collect herbs while I go make some tea.
AVAILABLE: Named path, names of the primary and secondary herbs I want to search for.

1. Set primary herb
2. Set secondary herb

3. Search for the primary herb in this room.
-If there are no such herbs in this room "Your search reveals nothing special." is returned, search for <secondary herb> (4)
-If there is such a herb "You find a <primary herb name>!" is returned, search for <primary herb> again.
-If there was such a herb, but none at the moment, "You search everywhere but find no herbs." is returned, move on (5)

4. Search for secondary herb
-If there is such a herb "You find a <secondary herb name>!" is returned, search for <secondary herb> again.
-If there was such a herb, but none at the moment, "You search everywhere but find no herbs." is returned.
-If there are no such herbs in this room "Your search reveals nothing special." is returned, ignore the room and move on (5)

5. Place all herbs in your jar and move to the next room in the path. Stop there (no trigging string available, could be anything, may not even be obvious exits, it has to stop after one single step no matter what.) and go to 3.


I had massive problems creating the path, since I couldn't find a way to stop walking after one single step without any triggers whatsoever. This has to be a general script, where all I want to specify is the name of the herbs I want to search for and the name of the recorded path to follow. No matter what string meets me after taking that step, it has to stop. There is nothing to trigger on. And I might be passing through the room without using the script, so adding a script in the room won't do it either.

So... I made another cranky soultion, which does not work... it works as follows.
I use the "do" command on the mud to create a path "do e,e,e,e,e,e,e,w,n,n,n,se,se,se" etc, and stops with a #wait 400; do ("do" pauses the execution of the "do" command, and "resume" resumes execution. In the room, I activate the class "search_primary", which triggers as (3) above, disable "search_secondary" and begin searching. HOWEVER. No matter how I do, "Your search reveals nothing special." sets off the trigger for the string in "search_secondary", EVEN IF THE CLASS IS DISABLED. Figure that. So what happens is that the script sets off the trigger as if I want to move on, but I want to search for the secondary herb first! ONLY if I cannot find the secondary ("Your search reveals nothing special." is returned shall I go on.

I'm missing something here. Worked on the darn thing for 3 hours now.




"May the Force be with you"
[url]peeweesweden@bredband.net[/url]
Reply with quote
LEit
Novice


Joined: 27 Jul 2002
Posts: 38
Location: USA

PostPosted: Fri Aug 30, 2002 3:16 pm   
 
Try this: (You'll have to modify it for exact commands for searching, and probably tweak it for triggers on finding an herb

#CLASS {HerbSearch}
#ALIAS herbsearch {#VAR Primary %1;#VAR Secondary %2;#VAR Path "%-3";#say searching for @Primary and @Secondary in path @Path;#T+ {HerbSearch|Primary};#T- {HerbSearch|Secondary};#VAR Count 0;search for @Primary}
#ALIAS MoveOn {put herbs jar;#T- {HerbSearch|Primary};#T- {HerbSearch|Secondary};#IF (@Count < %numwords(@Path)) {#T+ {HerbSearch|Primary};#ADD Count 1;%word(@Path,@Count);search for @Primary}}
#CLASS 0

#CLASS {HerbSearch|Primary}
#TRIGGER {Your search reveals nothing special.$} {search for @Secondary;#ALARM +1 {#T+ {HerbSearch|Secondary}};#T- {HerbSearch|Primary}} "" {notrig}
#TRIGGER {You find a @Primary!$} {search for @Primary}
#TRIGGER {You search everywhere but find no herbs.$} {MoveOn}
#CLASS 0

#CLASS {HerbSearch|Secondary}
#TRIGGER {You find a @secondary!$} {search for @secondary}
#TRIGGER {You search everywhere but find no herbs.$} {MoveOn}
#TRIGGER {Your search reveals nothing special.$} {MoveOn} "" {notrig}
#CLASS 0
Reply with quote
peewee
Wanderer


Joined: 22 Oct 2000
Posts: 90
Location: Sweden

PostPosted: Sat Aug 31, 2002 3:37 pm   
 
I did some tweaking back and forth, and came up with the idea that an array with the directions would be smoother to admin, so I re-wrote some of the code.. and I got it to work! So now I can watch a movie in a window while I can overlook my herbing...
Also, it's very easy to just stop the script as well, since you can send
stop search
to interrupt the searching, thus ending the script.

Using a "bot" like this is illegal unless you are interactive on my MUD, so the ability to end the script to interact with other players and NPC's was crucial...

Many a thanks for all help with the ideas!!
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