Register forum user name Search FAQ

Gammon Forum

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 ➜ Lua ➜ trouble writing to take variable value then execute action

trouble writing to take variable value then execute action

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


Posted by Erick   (4 posts)  Bio
Date Sun 07 Dec 2008 11:20 PM (UTC)
Message
I have trouble scripting for healing in my MUD.
im using LUA. I have set the triggers
FEELING SAD to send to variable sad the value of 1
FEELING MAD to send to variable mad the value of 1
and I see 1 in both mad and sad under variables when the triggers comeup.

My trouble is executing an action when my alias shows that im mad or sad.
this is what ive tried to write
the alias is diagnoss and I send to script:

if @sad=1 then
Execute "eat ash"
elseif @mad=1 then
Execute "eat ash"
else
Note "you are not sad or mad"
end

I apologize for being such a caveman, but I am having fun learning and I'm really stuck.
Respectfully, Erick
Top

Posted by Nick Gammon   Australia  (23,159 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 07 Dec 2008 11:57 PM (UTC)
Message
I hope you have "expand variables" checked, and that you are talking about MUSHclient variables and not Lua variables.

In any case, the test for equality is == not =. so it should read:


if @sad == 1 then



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Erick   (4 posts)  Bio
Date Reply #2 on Mon 08 Dec 2008 12:14 AM (UTC)
Message
Mr. Gammon,
You are my hero! It works!
This is great,
Thank You
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.


10,297 views.

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

Go to topic:           Search the forum


[Go to top] top

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