Page 1 of 2

How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 2:24 pm
by amateras
I setup what I thought was a simple trigger for looting corpses ...

(*.) is lying here.

send("get all all.corpse")

This works great until you have multiple corpses: for example:

The corpse of Dug devil warrior is lying here.
The corpse of Aldov lava troll warrior is lying here.

the trigger then fires twice - once for each line. Is there a way to make it only trigger one time? Of course I would need it triggered one time each time i entered a room.

Thanks for your help.

Re: How to get a trigger to fire only once

Posted: Wed Feb 27, 2013 2:28 pm
by kevutian
Question, as it will make things much, much easier if it's the case.

Does your game support GMCP?

Re: How to get a trigger to fire only once

Posted: Wed Feb 27, 2013 3:01 pm
by amateras
I don't know - it says it is based on CircleMud 3.0

Is there a test I can do to tell if it is supported?

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 6:53 pm
by Heiko
There are many possible solutions. A simple solution would be: multi state AND trigger pattern #1 would be your current pattern, pattern #2 would be a prompt trigger. This would fire when you get the prompt and you have corpses in the room. If you have an easy way to detect that you are in a new room you could add this as pattern #0 e.g. color trigger for room description or whatever fits for your game.
This trigger would only fire when you get into a new room with at least 1 corpse when you get a new prompt. Set the line delta to something suitable to make sure you cover rooms with long descriptions and many objects.

To find out if your game supports ATCP or GMCP click on the statistics button on the left in trigger editor.

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 7:41 pm
by amateras
Thanks for the advice/suggestion on the room description - I'll start looking for ways to get that to work.

I've included a screen copy of the statistics report.
Screen Shot 2013-02-27 at 2.23.59 PM.png
Screen Shot 2013-02-27 at 2.23.59 PM.png (36.88 KiB) Viewed 8417 times

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 8:12 pm
by amateras
I've added a multi-line trigger to focus on the white text in the description as well as looking for the corpse.

It is still firing multiple times:
Screen Shot 2013-02-27 at 2.52.40 PM.png
Screen Shot 2013-02-27 at 2.52.40 PM.png (54.37 KiB) Viewed 8415 times
Here's a screenshot of it working:
Screen Shot 2013-02-27 at 2.52.01 PM.png
Screen Shot 2013-02-27 at 2.52.01 PM.png (94.87 KiB) Viewed 8415 times

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 9:16 pm
by Heiko
Your forgot to set the first pattern = red color trig for room title.

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 9:54 pm
by amateras
That isn't consistent - it changes color based on the type of room it is ... red happens to be nosummon

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 9:59 pm
by hogarius
Perhaps, instead of triggering to get all from all the corpses, you should program the trigger to get all from each corpse individually. If there are two corpses in the room, the trigger fires twice, and you get all from both corpses. If there are three corpses, the trigger fires three times, and you get all from all three corpses.

Re: How to get a trigger to fire only once per room

Posted: Wed Feb 27, 2013 10:06 pm
by Heiko
amateras wrote:That isn't consistent - it changes color based on the type of room it is ... red happens to be nosummon
If you can't get a reliable room title trigger as pattern #0 you need to add a Lua function pattern that checks if a trigger has already fired before recieving the next prompt (-> simple lock).