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.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Trouble with a plugin targeting alias
Trouble with a plugin targeting alias
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Metsuro
USA (389 posts) Bio
|
Date
| Wed 20 Oct 2004 01:50 AM (UTC) |
Message
| Well I made a targeting system. Along with a few other things.
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE muclient (View Source for full doctype...)>
- <!-- Saved on Tuesday, October 19, 2004, 9:20 PM
-->
- <!-- MuClient version 3.50
-->
- <!-- Plugin "KnightsHeaven" generated by Plugin Wizard
-->
- <muclient>
<plugin name="KnightsHeaven" author="Kotetsu" id="cb0d7d383ccf120351a6f4b7" language="VBscript" purpose="Knightly Defense" save_state="y" date_written="2004-10-19 21:19:38" requires="3.50" version="1.0" />
- <!-- Get our standard constants
-->
<include name="constants.vbs" />
- <!-- Triggers
-->
- <triggers>
- <trigger enabled="y" match="*. 'OK' to commence the lesson." sequence="100">
<send>ok</send>
</trigger>
<trigger match="^(\d+)h, (\d+)m, (\d+)e, (\d+)p (\D{0,7})*\-$" regexp="y" sequence="100" />
<trigger custom_colour="5" enabled="y" expand_variables="y" ignore_case="y" keep_evaluating="y" match="(@!friendlist)" regexp="y" repeat="y" sequence="100" />
<trigger enabled="y" match="You are in the Prime Material Plane." sequence="100" />
<trigger custom_colour="11" enabled="y" group="BattleInfo" match="You have recovered balance on all limbs." sequence="100" />
<trigger custom_colour="11" enabled="y" group="BattleInfo" match="You have recovered balance on your * arm." sequence="100" />
<trigger custom_colour="11" enabled="y" group="BattleInfo" match="You have recovered equilibrium." sequence="100" />
- <trigger enabled="y" match="'OK' to commence the lesson." sequence="100">
<send>ok</send>
</trigger>
</triggers>
- <!-- Aliases
-->
- <aliases>
- <alias match="fadd *" enabled="y" send_to="12" sequence="100">
<send>SetVariable "friendlist", getvariable("friendlist") & "|%1"</send>
</alias>
- <alias match="swing" enabled="y" expand_variables="y" sequence="100">
<send>swing @target</send>
</alias>
- <alias script="OnTarget" match="x *" enabled="y" send_to="12" sequence="100">
<send>world.ColourNote "limegreen", "black", "%1 is now Targeted"</send>
</alias>
</aliases>
- <!-- Timers
-->
- <timers>
- <timer enabled="y" second="2" send_to="12">
<send>world.InfoClear world.InfoBackground "black" world.InfoColour "red" world.InfoFont "FixedSys", 12, 1 world.Info " Target: " & getvariable("target") & " |"</send>
</timer>
</timers>
- <!-- Variables
-->
- <variables>
<variable name="target">rat</variable>
<variable name="friendlist">|Metsuro</variable>
</variables>
- <!-- Script
-->
- <script>
- <![CDATA[
sub OnTarget (strTriggerName, trig_line, arrWildCards)
world.setvariable "target", arrWildcards (1)
target = arrWildcards (1)
end sub
]]>
</script>
</muclient>
Thats the plugin in and i get this error
scripting error
error number -2146827788
Event Execution of line 135 column 3
description Variable is undefined: 'target'
Called by Function/Sub: OnTarget called by alias
Not sure how to fix it, any help would be nice |
Everything turns around in the end | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #1 on Wed 20 Oct 2004 08:31 AM (UTC) |
Message
| For every scripting variable, you need to define them before you try to put something in them.
For instence, instead of
Quote:sub OnTarget (strTriggerName, trig_line, arrWildCards)
world.setvariable "target", arrWildcards (1)
target = arrWildcards (1)
end sub
You should have
Quote:Dim target
sub OnTarget (strTriggerName, trig_line, arrWildCards)
world.setvariable "target", arrWildcards (1)
target = arrWildcards (1)
end sub
When you do that, it tells the intepreter or whatever that Hey, we have a variable called target now. Then you can put stuff in it
I don't know how it works exactly, but if I'm wrong could someone lemme know? :p | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #2 on Wed 20 Oct 2004 01:50 PM (UTC) |
Message
| VBScript doesn't require you to declare variables. Maybe something is messing with the include file? Try to change the name to strTarget or something like that and see what happens. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Wed 20 Oct 2004 07:22 PM (UTC) |
Message
| Why dont you just put that sub in the alias? That alias is already sending to script, and youre not reusing it.
And why are you setting a vbscript variable "target"?
And you dont need that include file anyway, I cant imagine it'd cause problems though. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Metsuro
USA (389 posts) Bio
|
Date
| Reply #4 on Wed 20 Oct 2004 11:10 PM (UTC) |
Message
| The way i have it set up when you do "x rat" is sends the world a note saying that and then i have a timer to display on info, and I couldn't find another way to work it. |
Everything turns around in the end | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #5 on Wed 20 Oct 2004 11:17 PM (UTC) |
Message
| You never use the VBScript variable "trigger" though.
Youre using the MC variable trigger (using getvariable).
Which you can set with the alias using:
setvariable "target, "%1"
put that before (or after) your note about the target being set.
Then you dont need to worry about the script. Which is extraneous anyway. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #6 on Thu 21 Oct 2004 05:16 AM (UTC) |
Message
|
Quote:
VBScript doesn't require you to declare variables.
Unless you have:
Then it does. That line is in some of the supplied files (eg. exampscript.vbs).
However, this is too complicated:
Quote:
sub OnTarget (strTriggerName, trig_line, arrWildCards)
world.setvariable "target", arrWildcards (1)
target = arrWildcards (1)
end sub
You don't need the line "target = arrWildcards (1)" at all, and since you don't need it, you don't need to declare it.
Having got that far, just set the trigger to "send to variable", and put %1 in the "send" field. Then you don't need any scripting at all.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #7 on Thu 21 Oct 2004 05:31 AM (UTC) |
Message
| He wants to have a note on the world as well.
So he just has to add the setvariable line to his trigger (which is already send to script). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | 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.
22,944 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top