Don't be afraid to send your suggestions there!
Do a full combo with repeating skills:
Spoiler
If you ever wanted to do a combo with repeating skills, to cast QEQW on Ryze, you can now. Just look at the code below!
And now, instead of standart QEW route:
1) Cast Q.
2) Cast E.
3) Cast W.
We will do next one:
1) Can cast Q? Yes. Cast Q, break chain.
2) Can cast Q? No.
3) Can cast E? Yes. Cast E, break chain.
4) Can cast Q? No.
(or, in case of Ryze passive active!)
4) Can cast Q? Yes. Cast Q, break chain.
4.1) Can cast Q? No.
5) Can cast E? No.
6) Can cast W? Yes. Cast W, break chain.
7) Can cast Q? ...
and so on.
So you will try to cast first spell each time after you casted one of spells, then second one and so on. At least you increase chances for that!
This thing is extremely nessesary for champions like Taric, or the ones who have LichBane/Sheen/TrinityForce/Runeglavie/Frostgauntlet, and maybe even some shapeshifters like Nidalee.
function Q_Cast() if CanUseSpell(GetMyHero(),_Q) ~= READY then return false end CastSkillShot(_Q, GetMousePos()) return true end function W_Cast(target) if CanUseSpell(GetMyHero(),_W) ~= READY then return false end CastTargetSpell(target, _W) return true end function E_Cast(target) if CanUseSpell(GetMyHero(),_E) ~= READY then return false end CastTargetSpell(target, _E) return true end function Combo() -- This function is called somewhere you want! if (Q_Cast()) then return end if (E_Cast()) then return end if (W_Cast()) then return end endNow, what it means? Each time you cast a spell, you returning a boolean - true or false. If spell casted sucessfully, it returns true. Else (for example, spell on CD, or you are silenced) it returns false.
And now, instead of standart QEW route:
1) Cast Q.
2) Cast E.
3) Cast W.
We will do next one:
1) Can cast Q? Yes. Cast Q, break chain.
2) Can cast Q? No.
3) Can cast E? Yes. Cast E, break chain.
4) Can cast Q? No.
(or, in case of Ryze passive active!)
4) Can cast Q? Yes. Cast Q, break chain.
4.1) Can cast Q? No.
5) Can cast E? No.
6) Can cast W? Yes. Cast W, break chain.
7) Can cast Q? ...
and so on.
So you will try to cast first spell each time after you casted one of spells, then second one and so on. At least you increase chances for that!
This thing is extremely nessesary for champions like Taric, or the ones who have LichBane/Sheen/TrinityForce/Runeglavie/Frostgauntlet, and maybe even some shapeshifters like Nidalee.
Interesting usage of TSMMnHM module link here: deLibrary
Spoiler
I think you already know about Custom modes, that is provided by this modular manager. So what do we can do?
Twitch "Poison-All-The-Things" Minion Manager mode
This thing, BTW, can be used for everyone who have debuff on hit. Teemo, Darius, etc.
Other custom modes will come eventually!
Twitch "Poison-All-The-Things" Minion Manager mode
function TwitchPoisonSortingMode(arg1, arg2) if (arg2 == nil) then return GotBuff(arg1, "twitchdeadlyvenom") == 0 else return true end endThis function will return all minions that is NOT poisoned by Twitch! So it useful in LaneClears. Just do this:
local notPoisonedMinionsList = MinionManager.GetMinionList(GetRange(GetMyHero()), MINION_TEAM_NOTALLY, TwitchPoisonSortingMode) if #notPoisonedMinionsList ~= 0 then AttackUnit(notPoisonedMinionsList[1]) endThis code ensures that every minion in your attack range is debuffed by your passive. But you can go further!
function TwitchPoisonSortingModePlus(arg1, arg2) if (arg2 == nil) then return true else return GotBuff(arg1, "twitchdeadlyvenom") < GotBuff(arg2, "twitchdeadlyvenom") end endThis sorting mode will never return nil (unless there is no targettable minions nearby), but first minion will have least poison stacks, so you will always target someone with lesser stacks, until they all receive at least one. And then it will return minions with one stack. Two stacks. And so on. <3
This thing, BTW, can be used for everyone who have debuff on hit. Teemo, Darius, etc.
Other custom modes will come eventually!
Ternary Operators:
Spoiler
There exist one funny thing, called Ternary Operator.
Let me give you example how to use.
Let's start with something easy. For example, you need to do next code.

In short it looks like this:
(condition) and (what to return if condition is true) or (what to return if condition is false)
So you can compact some of strings into small codes. Like:
In LUA, Ternary Operator can't return any kind of 'false' value in first value (what to return if condition is true).
So next code WILL NOT work
It is because 'and' and 'or' operators is kinda linear.
First operator in check list is 'and'
'and' operator checks both operand, and returns the value of last.
So if you have something like
"bees" and "birds" - it always will return "birds".
"bees" and "birds" and "killers" - always will return "killers"
BUT! nil and "killers" (as alternative, "kittens and nil") - always will return false... why?
Let me notice, 'and' operator returns 'false' if any of operands is false. About 'non-true' operands read below.
Next operator in check list is 'or'
'or' operator checks both operands, and return the value of first 'non-false' operands, or if every operand is 'non-true' then it returns last operator.
'non-true' operands is:
false, nil
Other operators is 'true' ones!
even empty tables ( {} ), empty functions (function(arg) end), empty strings( "" or '' ), and even number zero (0).
So following codes will return:
"bees" or "birds" - return "bees"
nil or "birds" - return "birds"
nil or 0 - return 0
"sex" or "drugs" or "rock-n-roll" - return "sex"
false or "drugs" or "rock-n-roll" - return "drugs"
false or true or "rock-n-roll" - return true
I hope you understood me
So, at the end you have two checks.
( (condition and first value) or second value )
Breaking everything into situations:
1) Condition = false? If so, then whole thing will be false, so everything transforms into -> (false or second value) <- . Of course, according how to 'or' operator works, we always will chose second value.
2) Condition = true? If so, what is first value? If first value is 'non-false', then whole thing returns 'first thing value', so everything transforms into (first thing or second value). According to 'or' mechanics, we choosing first value.
3) BUT!? If first value is 'non-true'!? Then, of course, 'and' operator will return 'false' instead of 'first value', and everything is going as showed in Situation 1.
So, if we want to do this code the right way:
Following code solves this problem.
Second return can be any? Yes. It is.
Job done!
Enjoy your newly aquired skill with Ternary Op.
By the way, this thing should also return tables good as well, so you can try this code too!
Like, this part of code CAN possibly be unsuccessful and bugged, so avoid this:
This part CAN return FALSE, and as you know, if this part receives 'false', it automatically gets disposed by 'or' operator. Try to avoid it. If you need this, then use if-else construction - it is more stable for such things.
Let me give you example how to use.
Let's start with something easy. For example, you need to do next code.
if (GetCurrentHP(first_hero) > GetMaxHP(any_minion)) then return GetMaxHP(first_hero) else return GetKillCount(any_minion) endLong, long string - right? You can actually do it smaller, by removing all 0x13 symbols (enter key)
if (GetCurrentHP(first_hero) > GetMaxHP(any_minion)) then return GetMaxHP(first_hero) else return GetKillCount(any_minion) endBetter? Not really. Then what we can do? THIS!
return (GetCurrentHP(first_hero) > GetMaxHP(any_minion) and GetMaxHP(first_hero) or GetKillCount(any_minion)What the f**k, you will ask? It is a Ternary Operator.

In short it looks like this:
(condition) and (what to return if condition is true) or (what to return if condition is false)
So you can compact some of strings into small codes. Like:
string_to_print = IsDead(myHero) and "He is dead" or "It is Alive!!! IT IS ALIVE!!!" PrintChat(string_to_print)By the way, following code is also possible
PrintChat(IsDead(myHero) and "He is dead" or "It is Alive!!! IT IS ALIVE!!!")And this one too!
PrintChat("Hero status: "..(IsDead(myHero) and "He is dead" or "It is Alive!!! IT IS ALIVE!!!"))But! There is a one restriction you should always remember.
In LUA, Ternary Operator can't return any kind of 'false' value in first value (what to return if condition is true).
So next code WILL NOT work
IsAlive = IsDead(myHero) and false or trueThis piece of code will ALWAYS return 'true', regardless of IsDead status.
It is because 'and' and 'or' operators is kinda linear.
First operator in check list is 'and'
'and' operator checks both operand, and returns the value of last.
So if you have something like
"bees" and "birds" - it always will return "birds".
"bees" and "birds" and "killers" - always will return "killers"
BUT! nil and "killers" (as alternative, "kittens and nil") - always will return false... why?
Let me notice, 'and' operator returns 'false' if any of operands is false. About 'non-true' operands read below.
Next operator in check list is 'or'
'or' operator checks both operands, and return the value of first 'non-false' operands, or if every operand is 'non-true' then it returns last operator.
'non-true' operands is:
false, nil
Other operators is 'true' ones!
even empty tables ( {} ), empty functions (function(arg) end), empty strings( "" or '' ), and even number zero (0).
So following codes will return:
"bees" or "birds" - return "bees"
nil or "birds" - return "birds"
nil or 0 - return 0
"sex" or "drugs" or "rock-n-roll" - return "sex"
false or "drugs" or "rock-n-roll" - return "drugs"
false or true or "rock-n-roll" - return true
I hope you understood me

So, at the end you have two checks.
( (condition and first value) or second value )
Breaking everything into situations:
1) Condition = false? If so, then whole thing will be false, so everything transforms into -> (false or second value) <- . Of course, according how to 'or' operator works, we always will chose second value.
2) Condition = true? If so, what is first value? If first value is 'non-false', then whole thing returns 'first thing value', so everything transforms into (first thing or second value). According to 'or' mechanics, we choosing first value.
3) BUT!? If first value is 'non-true'!? Then, of course, 'and' operator will return 'false' instead of 'first value', and everything is going as showed in Situation 1.
So, if we want to do this code the right way:
IsAlive = IsDead(myHero) and false or trueWe must do something so 'false' value will be the SECOND one.
Following code solves this problem.
IsAlive = not IsDead(myHero) and true or falseLet's check. First return ('true') is 'non-false' value? Yes.
Second return can be any? Yes. It is.
Job done!
Enjoy your newly aquired skill with Ternary Op.

By the way, this thing should also return tables good as well, so you can try this code too!
allies, enemies = {}, {} (IsEnemy(hero) and enemies or allies)[GetNetworkID(hero)].Name = GetObjectName(hero)Oh, and also, be careful! If you returning a boolean values, make sure it is always 'true' ones in first condition!
Like, this part of code CAN possibly be unsuccessful and bugged, so avoid this:
return (hero2 ~= nil) and GetHP(hero1) > GetHP(hero2) or GetHP(hero1) < 500-> GetHP(hero1) > GetHP(hero2)
This part CAN return FALSE, and as you know, if this part receives 'false', it automatically gets disposed by 'or' operator. Try to avoid it. If you need this, then use if-else construction - it is more stable for such things.
Other tips will be there as I progress through LUA
