Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ AddTrigger(Ex) Queston/Problem

AddTrigger(Ex) Queston/Problem

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Flannel   USA  (1,230 posts)  Bio
Date Sat 29 Mar 2003 01:47 AM (UTC)

Amended on Sat 29 Mar 2003 02:04 AM (UTC) by Flannel

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

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Sleeve   (31 posts)  Bio
Date Reply #1 on Sat 29 Mar 2003 02:42 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #2 on Sat 29 Mar 2003 05:37 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #3 on Sat 29 Mar 2003 09:39 AM (UTC)

Amended on Sat 29 Mar 2003 09:44 AM (UTC) by Flannel

Message
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?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 30 Mar 2003 12:11 AM (UTC)
Message
New features will be supported by the SetTriggerOption function. Just add the trigger and then modify options, like the group name, afterwards.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,471 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.