PDA

View Full Version : Self.Cast() suggestion !



pixie_frigo
06-19-2013, 01:44 PM
Hey :)
I know it's a stupid small thing ^^ But whatever !

If would be nice if the function Self.Cast would return false instead of 0 if not casted! :)




function Self.Cast(words, mana)
if(not mana or Self.Mana() >= mana)then
return Self.CanCastSpell(words) and Self.Say(words) and wait(300) or 0
end
end

--->


function Self.Cast(words, mana)
if(not mana or Self.Mana() >= mana)then
return Self.CanCastSpell(words) and Self.Say(words) and wait(300)
end
end


Or not ? :)
Kind regards !

Syntax
06-19-2013, 06:41 PM
Hey :)
I know it's a stupid small thing ^^ But whatever !

If would be nice if the function Self.Cast would return false instead of 0 if not casted! :)




function Self.Cast(words, mana)
if(not mana or Self.Mana() >= mana)then
return Self.CanCastSpell(words) and Self.Say(words) and wait(300) or 0
end
end

--->


function Self.Cast(words, mana)
if(not mana or Self.Mana() >= mana)then
return Self.CanCastSpell(words) and Self.Say(words) and wait(300)
end
end


Or not ? :)
Kind regards !

Most functions in the lib return 0 for false.
Any that return false are probably ones I have made.
DarkstaR and I have our differences :P
Personally I think he did it just so he could win the lua golf tournament, psychic dick.
Or because he deals with most languages where 0 === false. In any case, these functions won't change because it will fuck up other scripts potentially.

pixie_frigo
06-19-2013, 07:42 PM
Most functions in the lib return 0 for false.
Any that return false are probably ones I have made.
DarkstaR and I have our differences :P
Personally I think he did it just so he could win the lua golf tournament, psychic dick.
Or because he deals with most languages where 0 === false. In any case, these functions won't change because it will fuck up other scripts potentially.


yeah, I figured the one that wrote it thought that lua concidered 0 as false :)
ill just keep using if cast and ~= 0 then ^^

Infernal Bolt
06-20-2013, 08:35 AM
I never had a problem with it casting spells when it's not able to.
afaik 0 == false

pixie_frigo
06-23-2013, 03:25 PM
I never had a problem with it casting spells when it's not able to.
afaik 0 == false
Well it won't cast if it can't :)

but for example in a stupid script that drinks a mana potion after exori gran :




if Self.Cast("exori gran") then
Self.UseItemWithMe(268)
end


You will always try to use the potion :)
Because 0 in lua isn't false ! But yeah whatever :)