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
➜ getting mismatch variable error
getting mismatch variable error
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Talith
(3 posts) Bio
|
Date
| Thu 20 Jan 2005 01:02 PM (UTC) |
Message
| this script is a counter that counts my skill improvments. I will get a message that will say something like "* You think your offensive skill has improved. *" It will then say "ooc +offensive-X" where x is the number of times i have gotten that message.
Problem is whenever i get a message that says * You think your two-handed sword skill has improved. * i get an error about mismatch variable type.
Here is the trigger and script:
<triggers>
<trigger
enabled="y"
match="* You think your * * skill has improved. *"
script="skills"
send_to="9"
sequence="1"
variable="skills"
other_text_colour="black"
other_back_colour="black"
>
<send>%2%3</send>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="* You think your * skill has improved. *"
script="skills"
send_to="9"
sequence="2"
variable="skills"
other_text_colour="black"
other_back_colour="black"
>
<send>%2</send>
</trigger>
</triggers>
sub skills (sName, b, c)
dim skill
dim chan
skill = world.getvariable ("skills")
chan = world.getvariable (skill)
chan = chan + 1
world.setvariable skill, chan
world.send "ooc +" & skill & "-" & chan
end sub | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #1 on Thu 20 Jan 2005 03:20 PM (UTC) |
Message
| It might be due to this line in your script:
By the time you reach this point, chan holds a string (since that's what GetVariable() returns), trying to add an integer to a string will give you a type error. Change the line where chan is set, to be:
chan = cint(world.GetVariable(skill))
to make sure that it holds an integer. | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #2 on Thu 20 Jan 2005 07:20 PM (UTC) |
Message
| Why are you setting a variable, and not using the wildcard?
If anything, you could set the variable in your script.
You'd need to do that anyway. Mushclient Variables cannot contain "-" only letters, numbers, and underscores.
So, the "two-handed" is messing it up (you could easily replace - with _, which will get rid of your extra setting/getting of the variable as well (you set the variable via the trigger, then you get it right away, you could use the wildcard, and if you needed to set it (to use in other scripts) you could then set it. If you don't need to set it, you've saved yourself a variable, and a good deal of time. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Talith
(3 posts) Bio
|
Date
| Reply #3 on Sun 23 Jan 2005 04:51 PM (UTC) |
Message
| sub skills (sName, b, c)
dim skill
dim chan
skill = world.getvariable ("skills")
chan = world.getvariable (skill)
chan = chan + 1
world.setvariable skill, chan
world.Replace "skill", "-", "_",
world.send "ooc +" & skill & "-" & chan
end sub
is that how i would use the replace function? Kinda stumped on this one also. If i could get that to work it seems would fix my problems completly. thanks | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #4 on Mon 24 Jan 2005 06:56 AM (UTC) |
Message
| Replace is a VB function, not a Mushclient one. You don't use world. infront of it.
And you need to replace before you set the variable as well.
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="* You think your * skill has improved. *"
script="skills"
send_to="1"
sequence="2"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>
sub skills (sName, b, c)
dim skill
dim chan
skill = c(2)
skill = replace skill," ", ""
skill = replace skill,"-", "_"
chan = world.getvariable("skill")
chan = chan + 1
world.setvariable skill, chan
world.send "ooc +" & skill & "-" & chan
end sub
That's both of those previous triggers in one trigger. You can edit out the space via a replace (which you had previously used your first trigger for). You can also (since you don't need to share your script) put the script into the send box of the trigger, to encapsulate it better (you'll have to change c(2) to "%2", actually, remove that first line, and replace the 'skill' in the replace function to "%2"). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 26 Jan 2005 01:12 AM (UTC) |
Message
| |
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.
19,094 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top