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
➜ General
➜ help with a bit of code:
Posting of new messages is disabled at present.
Refresh page
Posted by
| Acton
(13 posts) Bio
|
Date
| Thu 01 May 2008 11:45 PM (UTC) |
Message
| Hello,
I've got the following error:
[string "Trigger: "]:5: '=' expected near 'direction'
and the code is:
world.send "say to imp perch"
world.send "ff"
world.send "ff"
world.send "ff"
dim direction
direction = world.GetVariable("dir")
if (dir = "east") then
world.send "east"
else
world.send "west"
end if
Any ideas why this is not working?
Thanks, | Top |
|
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Reply #1 on Fri 02 May 2008 01:15 AM (UTC) |
Message
| Well, just glancing at it, I notice you're using dir instead of direction in the one place. Also, which language is this in? | Top |
|
Posted by
| Acton
(13 posts) Bio
|
Date
| Reply #2 on Fri 02 May 2008 01:20 AM (UTC) |
Message
| hello,
Dir is the variable stored within mush. I'm getting that var with my script.
and it's in vbs.
Thanks,
| Top |
|
Posted by
| Norry
(16 posts) Bio
|
Date
| Reply #3 on Fri 02 May 2008 03:46 AM (UTC) |
Message
| First, you have a mistake in the script.
dim direction
direction = world.GetVariable("dir")
This is saying "declare a VB variable called 'direction' and place the contents of the Mushclient variable 'dir' in it". But in the next line, you are using a 'dir' variable:
This is not the same as the Mushclient variable 'dir', this is an unknown VB variable 'dir', so the direction will never be east. This line should be:
if (direction = "east") then
Second, this script gave me no errors, no matter if I placed the code in a script file or in the trigger "Send" box (with "Send to: Script" enabled). Are you sure you selected "VBScript" in the script configuration screen? It's set to Lua by default.
| 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.
14,210 views.
Posting of new messages is disabled at present.
Refresh page
top