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


Joined: 17 May 2024
Posts: 17

PostPosted: Fri May 17, 2024 8:30 pm   

line break in trigger pattern OR multiple lines trigger? [SOLVED]
 
Hi.

Scenario: I want to make a trigger for some protection spells with the syntax of:

Code:

Peter chants: Hoo Boo Woo!
You feel protected!


This trigger must be across multiple lines because 1) if i trigger for the first line I do not know whom is being targeted, and 2) if I trigger for the second line I do not know what spell is being cast.
The whole purpose of the trigger is to set a variable (for each protection spell) so that these can be displayed in the status window as being either up or down.

How can i achieve this kind of trigger in cmud? I've searched and tried several things, but alas I am no programmer so my effort thus far have been in vain.


Last edited by Pauley on Sat May 18, 2024 8:13 am; edited 1 time in total
Reply with quote
mikeC130
Apprentice


Joined: 03 Jul 2006
Posts: 110

PostPosted: Fri May 17, 2024 10:09 pm   Re: line break in trigger pattern OR multiple lines trigger?
 
You are looking for a multi-state trigger.

This is essentially a way to string triggers together. You'd likely use the first state to capture the chant and set a variable, and the second stage would look for the message you receive. You can put a limit on the second stage so that if it doesn't receive a message within a line or two it will simply reset since the spell wasn't cast on you.

Mike
Reply with quote
Pauley
Beginner


Joined: 17 May 2024
Posts: 17

PostPosted: Sat May 18, 2024 7:40 am   
 
Hmm, I suppose I'm mucking up the syntax somewhat, because this doesn't work. (I specifically made the trigger to work when i cast it on myself for this testing stage)

The variable MIPOI stand for minor poison (resistance spell) and the trigger is supposed to color it either green or red to indicate whether it is up or down atm.

Edit:The #COND part of the trigger is the part that's not working.


Screenshot: https://i.ibb.co/xj2dBTd/screen.png

Edit edit: I removed the space between #COND and the { } and now it works (the example had a space between them).
Thanks for the help :) greately appreciated


New Screenshot: https://i.ibb.co/DWTRK3J/screen.png


Last edited by Pauley on Sat May 18, 2024 8:34 am; edited 1 time in total
Reply with quote
Pauley
Beginner


Joined: 17 May 2024
Posts: 17

PostPosted: Sat May 18, 2024 8:32 am   
 
It works perfectly according to what i want it to do, but it also now gives an error msg: "ERROR: Trigger "%1 chant 'Meiyou Du De.'" fired but did not compile"

Edit: turns out it was the space I inserted between #COND and { }, and that what really solved it earlier was a typo mismatch in the trigger pattern. "chant" vs "chants".

Alright, so now it works without giving any error messages :)
Reply with quote
Pauley
Beginner


Joined: 17 May 2024
Posts: 17

PostPosted: Sat May 18, 2024 8:50 am   
 
A new problem arises with this method - some times when the 1st trigger triggers it creates a new 2nd trigger, leading to en endless string of new 2nd triggers nesting themselves below the 1st trigger in settings.

I'm not sure what triggers this, because it doesn't happen every time, I've cast the spell 5 times now and got 3 new 2nd triggers nested below the 1st trigger in settings. Also these secondary nested triggers persist when i exit and reopen cmud.

Edit: I think I solved this now, need to test a few times to make sure - it appears that this occurs only when the trigger window is focused, and that when I close the trigger window it doesn't pile up with nested 2nd triggers like this.

Edit edit: I was wrong, it nests the 2nd trigger forever even when the trigger window is not focused, I somehow have to figure out how to make it stop doing this, or delete those "extra" triggers - I reset everything and cast the spell 7 times, this resulted in 4 "extra" 2nd triggers nested below the 1st in setting window

5 in 9 now, it's just slowly collecting "extra" 2nd triggers
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Sun May 19, 2024 5:17 pm   
 
#CONDITION on its own will attach to the last defined #TRIGGER, therefore it is recommended to only be used from the command line when first creating a trigger.
It should never be in the body of a trigger.

To make a multistate trigger from the GUI, there is an arrow on the "NEW" button that you can select new trigger state from.
_________________
Discord: Shalimarwildcat
Reply with quote
Pauley
Beginner


Joined: 17 May 2024
Posts: 17

PostPosted: Thu May 30, 2024 9:35 am   
 
shalimar wrote:
#CONDITION on its own will attach to the last defined #TRIGGER, therefore it is recommended to only be used from the command line when first creating a trigger.
It should never be in the body of a trigger.

To make a multistate trigger from the GUI, there is an arrow on the "NEW" button that you can select new trigger state from.


Ah yes, this fixes the whole situation. I used #COND in the trigger body when I should have simply added a new conditon from the menu. 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