How to get a trigger to fire only once per room

amateras
Posts: 13
Joined: Mon Dec 24, 2012 12:39 am

How to get a trigger to fire only once per room

Post by amateras » Wed Feb 27, 2013 2:24 pm

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.

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: How to get a trigger to fire only once

Post by kevutian » Wed Feb 27, 2013 2:28 pm

Question, as it will make things much, much easier if it's the case.

Does your game support GMCP?

amateras
Posts: 13
Joined: Mon Dec 24, 2012 12:39 am

Re: How to get a trigger to fire only once

Post by amateras » Wed Feb 27, 2013 3:01 pm

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?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

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

Post by Heiko » Wed Feb 27, 2013 6:53 pm

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.

amateras
Posts: 13
Joined: Mon Dec 24, 2012 12:39 am

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

Post by amateras » Wed Feb 27, 2013 7:41 pm

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 2045 times

amateras
Posts: 13
Joined: Mon Dec 24, 2012 12:39 am

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

Post by amateras » Wed Feb 27, 2013 8:12 pm

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 2043 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 2043 times

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

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

Post by Heiko » Wed Feb 27, 2013 9:16 pm

Your forgot to set the first pattern = red color trig for room title.

amateras
Posts: 13
Joined: Mon Dec 24, 2012 12:39 am

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

Post by amateras » Wed Feb 27, 2013 9:54 pm

That isn't consistent - it changes color based on the type of room it is ... red happens to be nosummon

hogarius
Posts: 35
Joined: Mon Nov 21, 2011 8:35 pm

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

Post by hogarius » Wed Feb 27, 2013 9:59 pm

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.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

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

Post by Heiko » Wed Feb 27, 2013 10:06 pm

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).

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests