Code acting strange

Homer

New Member
Reaction score
2
Its a fairly simple function. Anyways, everything above the loop seems to work, and anything below it does not.

Here the destroy part works( i dont even want to destroy, but it was the easiest way to make sure everything was working).
JASS:
function UpdateSelector takes nothing returns nothing
local integer i =0
local integer imax=g_ftext_num
local location point = GetRectCenter(gg_rct_Setting_Spawn)
local location point2 = OffsetLocation(point, 200, 0)
call SetUnitY(g_selector,GetLocationY(point2)+(-200*g_setting))
call DestroyTextTag(g_ftext[g_setting])
loop
exitwhen i>imax
call SetTextTagColorBJ(g_ftext<i>,100,100,100,1)
endloop

call SetTextTagColorBJ(g_ftext[g_setting],100,0,0,1)

endfunction</i>



and here the destroy and color red do not work.
JASS:
function UpdateSelector takes nothing returns nothing
local integer i =0
local integer imax=g_ftext_num
local location point = GetRectCenter(gg_rct_Setting_Spawn)
local location point2 = OffsetLocation(point, 200, 0)
call SetUnitY(g_selector,GetLocationY(point2)+(-200*g_setting))

loop
exitwhen i&gt;imax
call SetTextTagColorBJ(g_ftext<i>,100,100,100,1)
endloop
call DestroyTextTag(g_ftext[g_setting])
call SetTextTagColorBJ(g_ftext[g_setting],100,0,0,1)

endfunction</i>


Anyone know why?
 

DrEvil

FCRI Associate!
Reaction score
111
you need to increase " i " somewhere within the loop

My guess is its hitting the op limit and crashing the thread.
therefore not doing anything under the loop

JASS:
loop
   exitwhen i&gt;imax
   call SetTextTagColorBJ(g_ftext<i>,100,100,100,1)
   set i = i + 1 // &lt;--- increase
endloop</i>


+ you might want to remove the leaks after.
 

Homer

New Member
Reaction score
2
hmm, i feel dumb :/. Not use to doing loops like this. use to for loops :(. Thanks for the fast response.
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
Start indenting your code. When you start making more complicated scripts it will be too annoying to read, and most people wont be apt to read through and find errors.
 
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