[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  help with a bit of code:

help with a bit of code:

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Acton   (13 posts)  [Biography] 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,
[Go to top] top

Posted by Cage_fire_2000   USA  (119 posts)  [Biography] 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?
[Go to top] top

Posted by Acton   (13 posts)  [Biography] 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,
[Go to top] top

Posted by Norry   (16 posts)  [Biography] 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:

if (dir = "east") then


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.
[Go to top] 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,073 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]