Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Fri Jan 09, 2009 5:27 pm   

Mapper triggers firing twice
 
Vista32
3.03a Pro

Recently, my mapper triggers have started firing twice.

for example
When I walk into a room, the room trigger automatically types clear branches(to disable a trap in the room), it will fire twice.
There is no trigger set up, it's all done by the mapper.
I only have 1 tracking object.

Locations (* is current):
* :Player at room 30025 (blue) <mapname Map>

Anyone have any explanation?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Jan 09, 2009 6:37 pm   
 
Room triggers in v3.03 are handled very differently than in the 2.x versions, so your scripts might need some tweaking.

In v3.x, each Class Folder can have a script run when the folder is enabled and disabled. If you go into your Settings editor, you should see an object for your map (usually "Map of xxx" is the name). This is like a special type of module/window entry. If you expand this map object, you will see class folders for each room in your map that had a script assigned to it. Each room folder has a name like "RoomXXX" where XXX is the room number.

Click on one of your RoomXXX folders and you will see tabs for the Enable script and the Disable script. Click on the Enable script tab to see the room script that is executed when you enter the room.

Now, if your room script creates any other settings, such as triggers, aliases, etc, then the first time your room script runs, CMUD will create those triggers and scripts within the RoomXXX class folder. Once these triggers are created, you don't need to keep creating them again every time you enter the room. When you enter the room, the RoomXXX class folder is enabled, so any triggers or scripts within that folder will be enabled.

So, if your Enable script for the RoomXXX folder creates other settings, you can edit this script to remove those lines ones the triggers have been created the first time.

For example, let's say you have a room script that creates a trigger when you enter the room:

#TRIGGER {Entering room 123} {#show entered room}

This script gets added to the Enable Script tab for the Room123 class folder. When you enter the room, the Room123 class folder is enabled, causing the Enable script to run. This creates the trigger within the Room123 class folder. So now in the settings editor, you should see the trigger listed if you expand the Room123 folder in the tree on the left. Once this trigger has been created, you can edit the Enable Script and remove the #TRIGGER statement from it to prevent it from recreating the trigger over and over again when you enter the room.

Normally, this new method shouldn't cause multiple triggers to be created or executed, but you might have something specific in your room script that causes multiple triggers to be created or to fire. That is why I gave the full explanation so that you can edit your room script and update it for the new version.

If this still doesn't work and you still have problems, then you'll need to post your exact room script.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sat Jan 10, 2009 11:09 am   
 
The problem didn't get fixed.

<class name="Room28114" keyword="Room28114" enabled="false" id="6771">
<onenable>search branch</onenable>
</class>


Also, I'm curious. Is there a way aside from using alarm or wait, to prevent a trigger from firing for x seconds?
I've found alarms don't always work, and #wait prevents other triggers from firing properly.
it would be nice to have a box in the settings window that says Prevent this trigger from firing for specified time [ 2000 ]
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Jan 10, 2009 3:02 pm   
 
Do you mean you have a trigger that once it fires the first time, you want to wait x seconds before the trigger will fire again?

If so, you could convert it to a multistate trigger. The first state would be your normal trigger pattern and script. The second state would be a Wait type trigger with an empty pattern. This means that the trigger would go back to the first state immediately after the specified time had elapsed. Something like this one which will fire when Test is seen and then won't fire when Test is seen again until after 5 seconds have elapsed:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="4970" copy="yes">
    <pattern>^Test$</pattern>
    <value>#show Fired</value>
    <trigger type="Wait" param="5000"/>
  </trigger>
</cmud>
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sat Jan 10, 2009 3:04 pm   
 
First I'd like to say that I found my problem. For some reason I had 2 full sets of room triggers that I didn't notice before. So that's been fixed.

Secondly, instead of making multi-stage triggers, using wait or alarms to turn them off/on, it would be nice to just have an inherant setting right within the trigger that will turn itself on/off.
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Jan 10, 2009 3:22 pm   
 
I thought it had to be multistate based on the way the Wait trigger type is documented, but it looks like you can do what you want just by making the single trigger a Wait trigger:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger type="Wait" param="5000" priority="4970" copy="yes">
    <pattern>^Test$</pattern>
    <value>#show Fired</value>
  </trigger>
</cmud>

This fired the first time test was received, then waited 5 seconds before it would fire again.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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