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 ➜ General ➜ IF statements in an alias

IF statements in an alias

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


Posted by Tenzyyy   (2 posts)  Bio
Date Mon 04 Jan 2010 07:53 AM (UTC)
Message
I am making a alias to attack a target. I have variable shieldup and reboundingup to be set to 1 or 0 (1 means shield/rebounding is up and I have to raze instead of dsl).

I am curious on how I make an if statement to check that these are both 0 then DSL @target or if one is set to 1 or both then RAZE @target.

Thanks!
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Mon 04 Jan 2010 08:01 AM (UTC)
Message
Assuming you haven't changed the script language setting, your scripting language will probably be Lua. The example below assumes you're using Lua.

Firstly, you want to set the "Send to" dropdown to "Script". This changes where the big Send box's contents are sent. By default, it's World, which means its contents are sent just like you typed them into the command bar and hit enter. But Script is different - you can't put loose commands in, you have to use the scripting functions and statements.

Example script:
if @shieldup == 1 or @reboundingup == 1 then
  Send("raze @target")
else
  Send("dsl @target")
end


Hope that helps! Also, if you want to learn more about Lua, this guide is fantastic [1].

[1] http://www.lua.org/pil/

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Tenzyyy   (2 posts)  Bio
Date Reply #2 on Mon 04 Jan 2010 08:02 AM (UTC)
Message
thanks a lot for the quick response. I'll give it a shot.
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.


12,655 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.