"Cannot return codereturnsboolean to boolean" ?

Komaqtion

You can change this now in User CP.
Reaction score
469
Hi!

I never seem to correctly understand how to properly use functions (Or, in this case methods) as condition...

I'm sure I've asked this same question here several times, though I never seem to remeber it :(

Anyways, I'm getting an error in this line:
[ljass] if .u != null and (.xincrement != 0 or .yincrement != 0 or .zincrement != 0) and function thistype.Filters then[/ljass]

In this code:
JASS:
library ScaleandFade uses T32

    globals
        private integer TempStruct
    endglobals

    struct SaF
    
        real ex
        real ey
        real ez
        real xincrement
        real yincrement
        real zincrement
        unit u
        boolean bx = true
        boolean by = true
        boolean bz = true
        
        public static method Filters takes nothing returns boolean
            return IsUnit(SaF(TempStruct).u, DUMMY) != true
        endmethod
    
        private method periodic takes nothing returns boolean
            local boolean b = true
            local real x
            local real y
            local real z
            
            call BJDebugMsg(" Tick! ")
            
            if .u != null and (.xincrement != 0 or .yincrement != 0 or .zincrement != 0) and function thistype.Filters then
            
                if .bx == true then
                    set x = x + .xincrement
                endif
                
                if .by == true then
                    set y = y + .yincrement
                endif
                
                if .bz == true then
                    set z = z + .zincrement
                endif
                
                call SetUnitScale(.u, x, y, z)
                
                if x == .ex then
                    set .bx = false
                endif
                
                if y == .ey then
                    set .by = false
                endif
                
                if z == .ez then
                    set .bz = false
                endif
                
                set b = false
            else
            
                if .u == null then
                    debug call BJDebugMsg(" The scaling unit is not valid! ")
                elseif .xincrement == 0 then
                    debug call BJDebugMsg(" You'll need to specify different start/end x-values to scale a unit! ")
                endif
                    
            endif
            
            return b
        endmethod
        
        implement T32
        
        static method create takes real startscale_x, real startscale_y, real startscale_z,real endscale_x, real endscale_y, real endscale_z,  unit scaled returns thistype
            local thistype this = thistype.allocate()
            
            set .ex = endscale_x
            set .ey = endscale_y
            set .ez = endscale_z
            set .xincrement = (endscale_x - startscale_x) * T32_PERIOD
            set .yincrement = (endscale_y - startscale_y) * T32_PERIOD
            set .zincrement = (endscale_z - startscale_z) * T32_PERIOD
            set .u = scaled
            set TempStruct = this
            
            return this
        endmethod
        
    endstruct
    
    /*private function Descaling takes nothing returns boolean
        local boolean b
        
        if d.scale > 1. then
            set d.scale = d.scale - 0.05
            call SetUnitScale(d.caster, d.scale, d.scale, d.scale)
            set b = false
        else
            set b = true
        endif
        
        return b
    endfunction

    private function Scaling takes nothing returns boolean
        local boolean b
        
        if d.scale < SCALE then
            set d.scale = d.scale + 0.05
            call SetUnitScale(d.caster, d.scale, d.scale, d.scale)        
            set b = false
        else
            set b = true
        endif
        
        return b
    endfunction*/

endlibrary


Note: The error is the title of the thread ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top