boolean converted to (1) when compiling

Level 14
Joined
Oct 18, 2013
Messages
724
globals integer dosuPassCharges=0 integer DOSU_REASONATE_THRESHOLD = 35 endglobals function isReasonate takes nothing returns boolean return (dosuPassCharges >= DOSU_REASONATE_THRESHOLD) endfunction function dosuWupdate takes nothing returns boolean if isReasonate then return true endif return false endfunction

When I call this function further down in script, isReasonate gets compiled to (1), which throws "cannot convert int to bool"
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Not sure why that's not allowed but the fix is simple:
vJASS:
function isReasonate takes nothing returns boolean
    local boolean b = false
    if dosuPassCharges >= DOSU_REASONATE_THRESHOLD then
        set b = true
    endif
    return b
endfunction

Or maybe it's because you forgot the parenthesis?
vJASS:
if isReasonate then
Should be:
vJASS:
if isReasonate() then
^ It's a function. Without the () it'll be looking for a variable with that name.

Also, I believe you meant to say "resonate" not "reasonate", although reasonate is a pretty cool word ;)
 
Last edited:
Top