Ok, By looking at some of the posts this question has been asked but I don't understand the answers given.
ok Bascially I was trying out that example on the help file for Trigger sending to script.
I copied and pasted and renamed a VBscript example file
to myscript. Then I copied and pasted the Example code from the help File:
My trigger looks like this:
Australia Forum Administrator
#1
ok Bascially I was trying out that example on the help file for Trigger sending to script.
I copied and pasted and renamed a VBscript example file
to myscript. Then I copied and pasted the Example code from the help File:
Quote:
Trigger scripts
Triggers can execute script commands by simply putting the command into the "send" box and selecting "send to script".
However for more complex scripts you can put scripts into your script file (see scripting configuration tab for the world) and then call the script from the trigger. To do this put the name of the script subroutine into the trigger's script box.
The script subroutine must have three arguments, as follows:
· Name of the trigger
· The matching line
· An array of the first 10 wildcards
An example script in the VBscript language would be:
sub MyTrigger (name, line, wildcards)
world.Note "Trigger " & name & " matched."
world.Note "Wildcard 1 was" & wildcards (1)
end sub
Wildcard 10 is the entire matching sequence, which is not necessarily the same as the matching line in the case of regular expressions.
Other wildcards can be accessed by using the GetTriggerWildcard script routine (for example, named wildcards, or wildcards over number 9).
Trigger scripts
Triggers can execute script commands by simply putting the command into the "send" box and selecting "send to script".
However for more complex scripts you can put scripts into your script file (see scripting configuration tab for the world) and then call the script from the trigger. To do this put the name of the script subroutine into the trigger's script box.
The script subroutine must have three arguments, as follows:
· Name of the trigger
· The matching line
· An array of the first 10 wildcards
An example script in the VBscript language would be:
sub MyTrigger (name, line, wildcards)
world.Note "Trigger " & name & " matched."
world.Note "Wildcard 1 was" & wildcards (1)
end sub
Wildcard 10 is the entire matching sequence, which is not necessarily the same as the matching line in the case of regular expressions.
Other wildcards can be accessed by using the GetTriggerWildcard script routine (for example, named wildcards, or wildcards over number 9).
My trigger looks like this:
Quote:
<!-- triggers -->
<triggers
muclient_version="3.50"
world_file_version="15"
date_saved="2004-08-01 18:06:27"
>
<trigger
enabled="y"
match="^[EDMUD\: (.*?) has entered the realm\.]$"
regexp="y"
send_to="12"
sequence="100"
lowercase_wildcard="y"
>
<send>MyTrigger</send>
</trigger>
</triggers>
[/qoute]
and I am getting the Following :
Error code: -2146827838
Event: Execution of line 1 column 1
Description:
Wrong number of arguments or invalid property assignment: 'MyTrigger'
Line in error:
CalledBy:
Immediate execution
I know that I am missing something simple, it has has been a long time since I have worked with any code or scripting.
It is like a diffrent language to me now. I would appreaciate any help possible... Thank You very much.
<!-- triggers -->
<triggers
muclient_version="3.50"
world_file_version="15"
date_saved="2004-08-01 18:06:27"
>
<trigger
enabled="y"
match="^[EDMUD\: (.*?) has entered the realm\.]$"
regexp="y"
send_to="12"
sequence="100"
lowercase_wildcard="y"
>
<send>MyTrigger</send>
</trigger>
</triggers>
[/qoute]
and I am getting the Following :
Error code: -2146827838
Event: Execution of line 1 column 1
Description:
Wrong number of arguments or invalid property assignment: 'MyTrigger'
Line in error:
CalledBy:
Immediate execution
I know that I am missing something simple, it has has been a long time since I have worked with any code or scripting.
It is like a diffrent language to me now. I would appreaciate any help possible... Thank You very much.
You are mixing two different methods here. If you have the script in a script file, then you just put its name (MyTrigger) in the "script" box in the trigger dialog, and leave the "send" text blank.
Or, you can put what you actually want to do in the "send" box and "send to script". eg. in the "send" box you might put:
world.Note "Trigger " & name & " matched."
world.Note "Wildcard 1 was %1"
Note that in this case you simply use %1 for wildcard 1, as there is no subroutine call in this case.
This will not be a big success. Things in square brackets are simply a group of letters to match.
eg.
match = "[cat and dog]"
This will *not* match the sequence "cat and dog" as you appear to expect, but a *single* letter, consisting of any of the letters "c", "a", "t", " ", "a", "n", "d", "d", "o", "g".
If you actually see the square brackets then they need to be escaped with a \ before them.
(edit)
Looking at your post in more detail I see the \ is actually there. When posting to the forum you need to double them up (like "\\[") as the sequence \[ has a special meaning to the forum.
You can use MUSHclient's notepad, paste the trigger there, select all and choose "Convert -> Quote Forum Codes" to do that automatically.
Or, you can put what you actually want to do in the "send" box and "send to script". eg. in the "send" box you might put:
world.Note "Trigger " & name & " matched."
world.Note "Wildcard 1 was %1"
Note that in this case you simply use %1 for wildcard 1, as there is no subroutine call in this case.
Quote:
match="^[EDMUD\: (.*?) has entered the realm\.]$"
match="^[EDMUD\: (.*?) has entered the realm\.]$"
This will not be a big success. Things in square brackets are simply a group of letters to match.
eg.
match = "[cat and dog]"
This will *not* match the sequence "cat and dog" as you appear to expect, but a *single* letter, consisting of any of the letters "c", "a", "t", " ", "a", "n", "d", "d", "o", "g".
If you actually see the square brackets then they need to be escaped with a \ before them.
(edit)
Looking at your post in more detail I see the \ is actually there. When posting to the forum you need to double them up (like "\\[") as the sequence \[ has a special meaning to the forum.
You can use MUSHclient's notepad, paste the trigger there, select all and choose "Convert -> Quote Forum Codes" to do that automatically.