AddTrigger(Ex) Queston/Problem

Posted by Flannel on Sat 29 Mar 2003 01:47 AM — 5 posts, 20,675 views.

USA #0
Alright, Im trying to add triggers via code and I tried the example for the command (on this site) and it worked, and then I tried my own (it follows) and it didnt. As far as I know, this should add the trigger, and then it should be a normal trigger, in the trigger list, etc.

World.AddTriggerEx "ScoreLine1", "^Name\: ([A-Za-z]+)[ ]+Sex\: (male|female|sexless)$", 
"", eKeepEvaluating or eTriggerRegularExpression, 9, 0, "", "Hook_Score1", 0, 100


I tried that with, and without the Ex (and the last two arguements respectivly), as well as tried the Flags and summated numbers (40) the words, and 32 + 8.

I originally tried to do this via the command line (with my script prefix), and then tried to do a world paste (which I found out didnt parse, just paste) and then tried putting it into a sub in my script file. Lastly I tried the immediate window.

So In otherwords, I tried, to my knowledge, everything.. and still dont know what the problem is.
One thing I thought it might be is the fact that Its a regular expression, and some of the characters are being absorbed by VBScript, and then ending the line, or whatnot, but I would assume if that was the case, I'd get an error, or something.

(edited to make it two lines and not scroll, if you just delete the return, youll get the one line command)

Any help would be appreciated.
Amended on Sat 29 Mar 2003 02:04 AM by Flannel
#1
Hmm, perhaps the flags have to be set at 41 instead of 40 like you said you had it. This would mean keep evaluating, regular expression and trigger enabled. I'm not sure if this is the problem or not but I noticed that the enabled flag was not set in your example.
Australia Forum Administrator #2
The first thing to do is find out why MUSHclient isn't adding the trigger. The AddTriggerEx function returns a value (a number) which you can look up on the scripting page. This should give you a clue.

In other words, change it to be like this:


dim result

result = World.AddTriggerEx ( blah blah )

if result <> 0 then
  world.Note "AddTriggerEx failed, result was " & result
end if


The parenthese are required when calling it as a function, otherwise everything else is the same.
USA #3
Thanks Nick, I shouldve thought about that earlier.

It ended up being 30009 (Script name invalid), which explains why the example works.
(I also fixed the renegade script names and it works perfectly now)

On a side note, any intent on having AddTrigger be able to add group names?
Amended on Sat 29 Mar 2003 09:44 AM by Flannel
Australia Forum Administrator #4
New features will be supported by the SetTriggerOption function. Just add the trigger and then modify options, like the group name, afterwards.