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
➜ General
➜ Accessing wildcards from scripts with out using an external script file
|
Accessing wildcards from scripts with out using an external script file
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jimbob
(4 posts) Bio
|
| Date
| Thu 05 Mar 2009 02:49 PM (UTC) |
| Message
| I've looked at the script examples for triggers to capture text but I'm not sure how to call the subs with out using an external script file and I don't want to use an exteranl script file for various reasons. For example in vbscript I paste the following example in the send box and select send to script
sub MyTrigger (name, line, wildcards)
world.Note "Trigger " & name & " matched."
world.Note "Wildcard 1 was" & wildcards (1)
end sub
This doesn't give me any output, how do I get this to actually output to the world? Thanks | | Top |
|
| Posted by
| Worstje
Netherlands (899 posts) Bio
|
| Date
| Reply #1 on Thu 05 Mar 2009 03:20 PM (UTC) |
| Message
| That is because you should not place it in the Send box. You need to place it in your scriptfile (See: Configuration->Scripting->Scripts, and then the 'External Script file' bit. Just make a new one, throw your code in that file, and make sure the language is set to VBScript since that is the language you are using.
Finally, adjust your trigger - there should be NOTHING inside the Send box, and the Script field should match the name of the sub (MyTrigger in your example).
After that, it should work. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Thu 05 Mar 2009 07:10 PM (UTC) |
| Message
|
Quote:
I don't want to use an exteranl script file for various reasons
In that case, don't put a sub there (that only declares something you can use later). Just go straight into script commands. Also in "send to script" wildcard 1 is %1, wildcard 2 is %2, and so on. Like this:
<triggers>
<trigger
custom_colour="4"
enabled="y"
match="* arrives from *."
send_to="12"
sequence="100"
>
<send>
Note "Trigger matched."
Note "Wildcard 1 was %1"
Note "Wildcard 2 was %2"
</send>
</trigger>
</triggers>
See: http://mushclient.com/pasting for how to copy that into the client.
When testing, I saw:
A stray arrives from the north.
Trigger matched.
Wildcard 1 was A stray
Wildcard 2 was the north
|
- 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.
13,750 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top