IF statements in an alias

Posted by Tenzyyy on Mon 04 Jan 2010 07:53 AM — 3 posts, 13,219 views.

#0
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!
USA #1
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/
#2
thanks a lot for the quick response. I'll give it a shot.