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
Mhildrum
Beginner


Joined: 03 Aug 2004
Posts: 11
Location: Seattle

PostPosted: Mon Nov 27, 2006 12:53 pm   

Help with a time delay/ multiple trigger firings
 
I will just get straight to the point. Sample of the problematic Mud Output:

You have finished concentrating on the skill.
You search the room for herbs.
You find some lotus!
You find some borage!
You find some hops!
You find some echinacea!

Ideally my trigger would fire on all of these "you find some" lines to collect data about what I am finding. However, as a result of any given foraging instance, I want to send the command to forage again only once, whether I find one herb, four herbs that are all different, or 4 herbs that are all the same. I feel like I am okay with syntax and adjusting my #ifs and #whiles , I am just having a tough time figuring out the logic of how to make this work.

Thanks a bunch.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Mon Nov 27, 2006 1:34 pm   
 
#TRIGGER {You search the room for herbs.} {forage = 0}
#TRIGGER {You find some (%w)!} {#if (@forage = 0) {forage;forage = 1} {}}

Should do it
So you have a 'forage' variable that's reset to 0 whenever you start a search. Then first time you find something you forage and it sets the variable to 1. So then anything else that's found is ignored until you forage again (and the variable is reset)
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Nov 27, 2006 2:24 pm   
 
#CLASS Forager
#VARIABLE HerbsFound {} {}
#VARIABLE ForageCount {0} {0}
#ALIAS forage {#T+ Foraging;#SEND {forage};#ADD ForageCount 1}
#TRIGGER "Foraging" {^You search the room for herbs.$} {HerbsFound="";#T+ Foraging2;#T+ ForageTimer;#T- Foraging} "" {case|disable}
#TRIGGER "Foraging2" {^You find some (%w)!$} {#ADDITEM HerbsFound {%1}} "" {case|disable}
#TRIGGER "ForageTimer" {*.2} {#T- ForageTimer;#T- Foraging2;#IF ((%numitems(@HerbsFound)=1)|(%numitem(@HerbsFound)=4)) {#IF (@ForageCount=1) {forage} {ForageCount=0}} {ForageCount=0}} "" {alarm|disable}
#CLASS 0

I think that should handle what your looking for. You may have to adjust the alarm's time and all of it was written off the top of my head, so it is totally untested.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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