addtriggerex sets "eomitfromlog" when not in flags

Posted by Pompey1 on Wed 19 Mar 2008 01:11 PM — 3 posts, 16,715 views.

#0
The following javascript code snippet sets a gag trigger using a regexp stored in variable 'gag' and with a trigger name based on 'name'.

// code starts

flags = eEnabled | eOmitFromOutput | eIgnoreCase | eTriggerRegularExpression | eReplace;

n = "gag" + name.toLowerCase();

status = world.AddTriggerEx(n,gag,"",flags,-1,0,"","",0,80)

// code ends

However, if I then examine the trigger in the world, the "omit from log" checkbox is selected.

I can fix this by following the addTriggerEx with a setTriggerOption as follows:

// code starts

status = SetTriggerOption(n,"omit_from_log",0);

// code ends

but really the "omit from log" checkbox should not be checked unless I include the eOmitFromLog flag in the trigger flags.

I checked with Beale (as we play the same MUD) and he saw the same problem. I was using 4.22 but now have 4.23 and it affects both of those versions.

Is this intended behaviour ("output" is deemed to include logs) or is it a bug?

Pompey1
Australia Forum Administrator #1
This is a confirmed bug. In fact it was always setting "omit from log" to whatever your "omit from output" flag was (that is, true or false). It was a simple typo in that function.

This will be corrected in version 4.24, meanwhile I suggest you use your work-around.

This bug applies to all scripting languages, not just Javascript.
Amended on Wed 19 Mar 2008 09:18 PM by Nick Gammon
Australia Forum Administrator #2
Another approach, which might be better self-documentation anyway, is to use ImportXML. That won't have that problem, and lets you set all of the flags (some of which are not supported by AddTriggerEx), and is more readable.


http://www.gammon.com.au/scripts/doc.php?function=ImportXML