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


Joined: 08 Aug 2005
Posts: 70

PostPosted: Sat Mar 10, 2007 10:12 am   

Item replacement Trigger
 
I have a trigger for checking inside an oven. if it sees a roast x in the oven, it removes the item using its item id (eg lamb21546).

However i'd like to modify the trigger so that is does a couple of things. Firstly id like it to then check the inventory (info inv), but gag the output so i dont get spammed and if it contains "some prepared [x]" to replace the item removed with that item. im just not sure how to go about this. Can anyone talk me through what i need to do?

Thanks
Fergal
Reply with quote
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Sat Mar 10, 2007 12:48 pm   
 
Looks like you'll need at least two triggers.

The first is the one you already have and this one will activate the second trigger.
You can choose to approach this in one of two ways. You may make two seperate triggers and use the first trigger to 'enable' or 'disable' the second trigger using the #t+ or #t- command, or you can create one trigger with multiple states, where your first trigger is 'state 0' and your second trigger is 'state 1'.

Here is the logic.

Your first trigger will see the roast x and remove it.
send 'info inv' to your mud and enable the second trigger (unless you used the multi state trigger approach, in which case the second trigger will be enabled automatically once the first trigger finishes processing)

Your second trigger will fire at the output of your inventory (whatever that may look like.. i am assuming it is all in one line)
Here you can use the #gag command to gag whatever the output is
$Variable1=%null
use %regex to find and capture the "some prepared x" pattern if it exists in the line matched by the trigger ... eg. %regex(%line,"(some prepared \w+)",Variable1)
#if !%null($variable1) {put $variable1 in oven} {#echo Don't have anything prepared.}
Disable this trigger using #t- (unless you took the multi-state trigger approach)


If you show us what your inventory output looks like and what your current triggers are, I'm sure we can be of more help.
_________________
That which does not kill us, makes us stronger.
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