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 ➜ Tips and tricks ➜ Still trying to get ahold of coding knowledge

Still trying to get ahold of coding knowledge

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


Posted by Jordan   (14 posts)  Bio
Date Thu 02 Nov 2006 04:24 PM (UTC)
Message
If r = 0

then cast blind

else cast 'cure blind'


how would i code something like this?
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Thu 02 Nov 2006 05:05 PM (UTC)
Message
What scripting language are you working in?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Jordan   (14 posts)  Bio
Date Reply #2 on Thu 02 Nov 2006 08:48 PM (UTC)
Message
Lua i think. So i have to create a script in order to do it?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Fri 03 Nov 2006 05:29 AM (UTC)

Amended on Fri 03 Nov 2006 05:33 AM (UTC) by Nick Gammon

Message
Well, a minor bit of scripting is needed to make decisions, however it can be done "inline" in your trigger or alias.

Assuming the trigger or whatever-it-is matches, your code would look something like this:


if r == 0 then
  Send ("cast blind")
else
  Send ("cure blind")
end -- if


The test of equality is "==" not "=", as "=" is used for assignment, eg.


a = 42  --> a is now 42


For this to work perfectly you need to establish a value for the variable "r".

You need to set the trigger or whatever you are making to "send to script" so that the script commands are executed as a script, and not just sent straight to the MUD.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


15,001 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.