• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Does this work?

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
Why doesn't this work?

I'm saving numbers from 0 and up to later let me use combinations of unit handles & ability raw codes as parent keys.

I don't have the data so I wanted it to be a bit dynamic to just let me fill in the raw codes later.

edit: removed useless stuff and updated with indents and removed empty comments.

JASS:
function Trig_buildSys_store_loops_Copy_2_Actions takes nothing returns nothing
    local integer i = 0
    local integer j
    local integer a = 0
    local integer h = 1
    local integer aId
    // unit handle id
    set udg_buildSys_init_unit[0] = gg_unit_o001_0001
    set udg_buildSys_init_unit[1] = gg_unit_o001_0002
    // ability raw codes
    set udg_buildSys_init_abilityId[0] = 'A000'
    set udg_buildSys_init_abilityId[1] = 'A001'
    set udg_buildSys_init_abilityId[2] = 'A002'
    // ----------------------------------
    loop
        exitwhen udg_buildSys_init_abilityId[a] == 0
        set a = a +1
    endloop
    call DisplayTextToForce( GetPlayersAll(), (I2S(a) ) )
    loop
        exitwhen h == 0
        set h = GetHandleId( udg_buildSys_init_unit[i] )
        call DisplayTextToForce( GetPlayersAll(), (I2S(h) ) )
        set j = 0
        set aId = 1
        loop
            exitwhen aId == 0
            set aId =  udg_buildSys_init_abilityId[i]
            call DisplayTextToForce( GetPlayersAll(), (I2S(aId) ) )
            call SaveInteger(udg_hash_buildSys, h, aId, i * a + j)
            set j = j +1
        endloop
        set i = i +1
    endloop
endfunction

//===========================================================================
function InitTrig_buildSys_store_loops_Copy_2 takes nothing returns nothing
    set gg_trg_buildSys_store_loops_Copy_2 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_buildSys_store_loops_Copy_2, function Trig_buildSys_store_loops_Copy_2_Actions )
endfunction
 
Last edited:
JASS:
    // ------------------------------------------------------------------
    loop
    exitwhen aId == 0
will crash.

you also have no event

also... comments are for commenting... indents are for seperating loops.
 
you also have no event

also... comments are for commenting... indents are for seperating loops.

Event is in another trigger, and well the comments are remnants from the GUI custom script (The custom text colors are really annoying for me too look at so it's not until after posting inside
JASS:
 tags that I can actually see with the white background.

[quote="Arhowk, post: 2636078"][code=jass]
    loop
    exitwhen aId == 0
will crash.
[/QUOTE]
The exitwhen h == 0 might abort the execution of the thread since h has no initial value.

Well it's not crashing, Instead it's being completely ignored because no messages are being shown ingame. The problem persists after giving both variables initial values.

Also why did this part work when it's the same as the rest?
JASS:
loop
    exitwhen udg_buildSys_init_abilityId[a] == 0
    set a = a +1
    endloop
 
Now the initial value of h and aId are 0. Then you have exitwhen h == 0 and exitwhen aId == 0. Maybe load another value to h and aId and only then use exitwhen.

You don't need aId != 0 and h != 0, exitwhen takes care of those.

And indent the code properly.

I've updated it and now the loop isn't exited until j is at 4542.

aId which should be the ability raw codes has 1093677104 as it's value in the last loop (there's too much so the log can't fit the previous loops)

And it's pretty weird since I've only got 2 unit handles and 3 ability raw codes put in atm...
 
Status
Not open for further replies.
Back
Top