set integer = 1 + 1 is an invalid type

Shaggi

New Member
Reaction score
1
[Resolved]set integer = 1 + 1 is an invalid type

when I try to enable this trigger it tells me that set liSlot = liSlot + 1 is an invalid type for specified operator...

JASS:
function Trig_Magical_Stone_Actions takes nothing returns nothing
    local item litComponent1
    local item litComponent2
    local integer liSlot = 0
    local boolean lbManaStone
    local boolean lbMaskMagic
    if ( Trig_Magical_Stone_Mana() ) then
        loop
            exitwhen (Trig_Magical_Stone_Mask_of_Magic())
            set liSlot = liSlot + 1
            call PolledWait (0.1)
        endloop
    else
    endif
endfunction
 

Shaggi

New Member
Reaction score
1
ok...but there's nothing to learn there and it's not finished yet

JASS:
function Trig_Magical_Stone_Func002C takes nothing returns boolean
    if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00H' ) ) then
        return true
    endif
    if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00I' ) ) then
        return true
    endif
    return false
endfunction

function Trig_Magical_Stone_Conditions takes nothing returns boolean
    if ( not Trig_Magical_Stone_Func002C() ) then
        return false
    endif
    return true
endfunction

function Trig_Magical_Stone_Mana takes nothing returns boolean
    if ( not ( GetItemTypeId(GetManipulatedItem()) == 'I00H' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Magical_Stone_Mask_of_Magic takes nothing returns nothing
endfunction

function Trig_Magical_Stone_Actions takes nothing returns nothing
    local item litComponent1
    local item litComponent2
    local integer liSlot = 0
    local boolean lbManaStone
    local boolean lbMaskMagic
    if ( Trig_Magical_Stone_Mana() ) then
        loop
            exitwhen (Trig_Magical_Stone_Mask_of_Magic())
            set liSlot = liSlot + 1
            call PolledWait (0.1)
        endloop
    else
    endif
endfunction

//===========================================================================
function InitTrig_Magical_Stone takes nothing returns nothing
    set gg_trg_Magical_Stone = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Magical_Stone, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Magical_Stone, Condition( function Trig_Magical_Stone_Conditions ) )
    call TriggerAddAction( gg_trg_Magical_Stone, function Trig_Magical_Stone_Actions )
endfunction
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
JASS:
            exitwhen (Trig_Magical_Stone_Mask_of_Magic())

That function returns nothing, so it can't be used there. It needs to return a boolean to be used.
 

Shaggi

New Member
Reaction score
1
...I never thought it was physically possible to make that stupid mistake...thanks trb92
 

Vexorian

Why no custom sig?
Reaction score
187
Yes, you made a mistake, your mistake is : you are using normal WE for compiling Jass code.
 

SFilip

Gone but not forgotten
Reaction score
634
Unrelated to the question, your code can be simplified, you don't need all those functions and you don't need an else before endif:
JASS:
function Trig_Magical_Stone_Conditions takes nothing returns boolean
    return (GetItemTypeId(GetManipulatedItem()) == 'I00H') or (GetItemTypeId(GetManipulatedItem()) == 'I00I')
endfunction

function Trig_Magical_Stone_Actions takes nothing returns nothing
    local item litComponent1
    local item litComponent2
    local integer liSlot = 0
    local boolean lbManaStone
    local boolean lbMaskMagic
    if ( GetItemTypeId(GetManipulatedItem()) == 'I00H' ) then
        loop
            exitwhen () // put your loop condition(s) here
            set liSlot = liSlot + 1
            call PolledWait (0.1)
        endloop
    endif
endfunction

//===========================================================================
function InitTrig_Magical_Stone takes nothing returns nothing
    set gg_trg_Magical_Stone = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Magical_Stone, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Magical_Stone, Condition( function Trig_Magical_Stone_Conditions ) )
    call TriggerAddAction( gg_trg_Magical_Stone, function Trig_Magical_Stone_Actions )
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top