Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Ashur
Novice


Joined: 25 Jul 2011
Posts: 39

PostPosted: Thu Sep 29, 2011 11:57 pm   

Long trigger
 
I'm trying to make a trigger that will basically allow me to kick it off and it will herb a specified path. I figured I would accomplish this with a huge multi-state trigger.

In each room I need to:
search here for <herb name>

I will either be prompted with
Your search reveals nothing special.
or
You find a <herb>

If I don't find anything I need to move to the next room and try again. If I *do* find something, I need to 'search here for <herb name>' two more times, and then move on.

There's a good 60 rooms that I need to do this in, and it seems like there's a limit on how many states a trigger can have. Any suggestions from anyone would be helpful.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Sep 30, 2011 12:24 am   
 
There's no limit on number of states as far as I know (I've seen at least 7), but I think you'll only need one state anyway. Try something like this:
Code:
#ALIAS herb {#IF %1 {#T+ HerbSearching;herb = %-1;currentherbpath = @fullherbpath;search here for @herb} {#SAY "Syntax: herb <herb name>"}}
#CLASS HerbSearching
#VAR herb {}
#VAR currentherbpath {}
#VAR fullherbpath {n|s|e|w|etc}
#TRIGGER {^({Your search reveals nothing special.|You find a *})$} {#IF %match(%1,"^You find a ") {search here for @herb;search here for @herb};#IF %numitems(@currentherbpath) {#SEND %pop(currentherbpath);search here for @herb} {#T- HerbSearching}}
#CLASS 0

Just threw that together quickly, it's not tested so there's no guarantees it'll work, but I think it should. You'll need to put your list of directions in the fullherbpath variable.
Reply with quote
Ashur
Novice


Joined: 25 Jul 2011
Posts: 39

PostPosted: Fri Sep 30, 2011 2:04 pm   
 
Ahh, so this works by setting up a specified path and the 'pop'ing the next direction at the appropriate time, right?

My question, then, is that the path is not necessarily linear. There is a fork and I need to search both ends of the fork. In essence, at some point I'll need to do:

Code:
search here for <herb>; s;sw;se;se;ne;search here for <herb>


Hopefully that makes sense. Any ideas?


*edit* Upon re-reading the code. Can I accomplish multiple moves by editing the fullherbpath to look more like
Code:
#VAR fullherbpath {n;e;n;nw|s;e;s;w|etc}

Does the '%pop(currentherbpath)' just whatever is between then |....| in the path?


Last edited by Ashur on Fri Sep 30, 2011 4:09 pm; edited 1 time in total
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Sep 30, 2011 4:08 pm   
 
Just store s;sw;se;se;ne as one of the items in that list, and then change the bit that says #SEND %pop(currentherbpath) to #EXEC %pop(currentherbpath), so it expands.
Reply with quote
Ashur
Novice


Joined: 25 Jul 2011
Posts: 39

PostPosted: Fri Sep 30, 2011 4:10 pm   
 
Laughing Perfect, thank you Daern. Looks like I was just a little slow with my epiphany.

Thanks again!
Reply with quote
Ashur
Novice


Joined: 25 Jul 2011
Posts: 39

PostPosted: Fri Sep 30, 2011 4:43 pm   
 
Hmmm, last thing (I hope) how to I kick this thing off?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Sep 30, 2011 7:39 pm   
 
Heh, type herb <herb name>.
Reply with quote
Ashur
Novice


Joined: 25 Jul 2011
Posts: 39

PostPosted: Fri Sep 30, 2011 9:08 pm   
 
Ahh, I was close. So, I have run into a small snag. Each room that contains 3 herbs. The syntax for "you found an herb" is always the same. So what I'm running into is the following

>You find a *
-trigger fires (search;#WAIT 900;search;#WAIT 9000)

But upon finding the second herb, the trigger fires again. So I end up being stuck searching when it's actually time to move to the next room. Can I make the trigger do something like on 'You find a *'

Code:
disable myself
search here for @herb
WAIT 9000
search here for @herb
WAIT 9000
move to the next room
enable myself


It seems like this should be very doable, I'm just not sure of the syntax Sad

*edit*Hooray, I figured it out. Thanks!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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