if (mystance == "Rizet" or "Gyanis" or "none") then
send("combo trip lowhook lowhook "..target)
elseif (mystance == "Ein-Fasit" or "Laesan" or "Vae-Sant") then
send("combo lowhook trip lowhook" ..target)
end
I've got a few aliases that are similar to this one that aren't behaving the way I want them to. Basically they're just firing the first "send" when mystance == one of the stances following the "elseif"
I am definitely a novice in LUA, but I feel like I've been learning alot and this is frustrating me to no end.
Comments
Those answers are correct. This is why they are correct. Note, I'm not a LUA person, but this answer should be accurate nonetheless.
Two things you need to know here:
With that in mind let's say that you're in Vae-Sant when you run the "if (mystance == "Rizet" or "Gyanis" or "none")" check. This statement will be checked against the three following conditions:
It evaluates the conditions as follows:
Since at least one test condition in the OR statement is true, the entire thing evaluates to true and it takes the "then" and not the "else". As written, that statement will ALWAYS evaluate to true and the "elseif" will NEVER be reached.
The corrected if statement "if ( (mystance == "Rizet") or (mystance == "Gyanis") or (mystance == "none") )", on the other hand, evaluates the following conditions:
If the value is Vae-Sant, it should evaluate those conditions as FALSE, FALSE, FALSE and it will skip the "then" and move into the "else".
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
in Lua, 0 is true. Only 'false' and uninstantiated variables are 'false'.
That is the most ****-backwards horrible thing.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
A bit late, but I thought I'd give you an example of how to do this without if/then at all:
stanceTable = stanceTable or {} stanceTable.trip_lowhook = { ["Ein-Fasit"] = "lowhook trip lowhook", ["Laesan"] = "lowhook trip lowhook", ["Vae-Sant"] = "lowhook trip lowhook", Ryzet = "trip lowhook lowhook", Gyanis = "trip lowhook lowhook", none = "trip lowhook lowhook", } -- ^ In your scripts, make a table like that for each attack combo type, in this example I assume it is something you do when you want to prone someone. -- Then in your aliases/macros/attack functions: send( "combo " .. stanceTable.trip_lowhook[ mystance ] .. " " .. target )
I've got macros that enter:
if (combatattack == "afflict") then expandAlias("aff")
elseif (combatattack == "damage") then expandalias("dmg") end
When I use that alias it does squat. It's not showing errors. It just does... nothing.
I know the aff and dmg aliases work correctly so the issue isn't there.
combatattack = ("damage")
combatattack = ("afflict")
EDIT:
I think the explanation here is that if you do it straight-out combatattack = damage, combatattack is equating itself to a variable called damage, rather than the text "damage", which is what your if-then statement is using to determine whether to use alias "aff" or alias "dmg".
(may vanish for periods of time)
combatattack = "afflict"
display(combatattack)
if combatattack == "damage" then expandAlias("dmg")
elseif combatattack == "afflict" then expandAlias("aff")
else cecho("\n<sienna> No pvp mode selected.")
end
First, get rid of the unnecessary stuff, like the (round brackets).
Then check very carefully for typos or missing "quotes" where they are needed.
If it still doesn't work, put temporary test echoes into it (like the display(combatattack) line, which you should delete after it is working.)