Problem with a loop in CTB System

Hi,
 
So this is maybe a little complicated to explain.
I'm currently writing my own event and picture based cbs in RM2003 and everything was fine so far but now I'm running at a brick wall.
I wanted to have a Charge time battle system and the alghorithm itself seems to work (no UI for that part yet so I checked the variables)
and for the first turn everything works nicely for the enemys as well, but after an actor had its first turn the loop to determine who's
turn is up only executes once and then stops, and I just can't figure out why, as all that changes are the numbers in the "goal" variables ( I use the agility of each act/mon to count down their goal to zero).
 
Here the Code for the turn order event:
(I know it might be near impossible to understand without the whole project but maybe I'm just not seeing a glaring mistake I made)
 

@> Comment: Decide Turn Order@> Control Variables: [0889:Turn ID Pointer] = 881 @> Control Variables: [0911:Turn Act ID Pointer] = 101 @> Control Variables: [0890:Current Turn ID] = 0 @> Control Variables: [0781:Act 1 Goal] = Variable [0818]@> Control Variables: [0782:Act 2 Goal] = Variable [0819]@> Control Variables: [0783:Act 3 Goal] = Variable [0820]@> Control Variables: [0784:Act 4 Goal] = Variable [0838]@> Control Variables: [0785:Mon 1 Goal] = Variable [0839]@> Control Variables: [0786:Mon 2 Goal] = Variable [0840]@> Control Variables: [0787:Mon 3 Goal] = Variable [0858]@> Control Variables: [0788:Mon 4 Goal] = Variable [0859]@> Control Variables: [0789:Mon 5 Goal] = Variable [0878]@> Control Variables: [0790:Mon 6 Goal] = Variable [0879]@> Loop @> Loop @> Comment: Move to goal @> Comment: Act 1 @> Conditional Branch: Variable [0101:Actor 1 ID] > 0 @> Conditional Branch: Variable [0108:Actor 1 Hp] > 0 @> Conditional Branch: Switch [0173:Act 1 Para] is OFF @> Control Variables: [0781:Act 1 Goal] -= Variable [0793] @> Conditional Branch: Variable [0781:Act 1 Goal] <= 0 @> Control Variables: [0781:Act 1 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Act 2 @> Conditional Branch: Variable [0121:Actor 2 ID] > 0 @> Conditional Branch: Variable [0128:Actor 2 Hp] > 0 @> Conditional Branch: Switch [0174:Act 2 Para] is OFF @> Control Variables: [0782:Act 2 Goal] -= Variable [0794] @> Conditional Branch: Variable [0782:Act 2 Goal] <= 0 @> Control Variables: [0782:Act 2 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Act 3 @> Conditional Branch: Variable [0141:Actor 3 ID] > 0 @> Conditional Branch: Variable [0148:Actor 3 Hp] > 0 @> Conditional Branch: Switch [0175:Act 3 Para] is OFF @> Control Variables: [0783:Act 3 Goal] -= Variable [0795] @> Conditional Branch: Variable [0783:Act 3 Goal] <= 0 @> Control Variables: [0783:Act 3 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Act 4 @> Conditional Branch: Variable [0161:Actor 4 ID] > 0 @> Conditional Branch: Variable [0168:Actor 4 Hp] > 0 @> Conditional Branch: Switch [0176:Act 4 Para] is OFF @> Control Variables: [0784:Act 4 Goal] -= Variable [0796] @> Conditional Branch: Variable [0784:Act 4 Goal] <= 0 @> Control Variables: [0784:Act 4 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Mon 1 @> Conditional Branch: Variable [0181:Monster 1 ID] > 0 @> Conditional Branch: Variable [0186:Monster 1 Hp] > 0 @> Conditional Branch: Switch [0192:Mon 1 Para] is OFF @> Control Variables: [0785:Mon 1 Goal] -= Variable [0195] @> Conditional Branch: Variable [0785:Mon 1 Goal] <= 0 @> Control Variables: [0785:Mon 1 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Mon 2 @> Conditional Branch: Variable [0201:Monster 2 ID] > 0 @> Conditional Branch: Variable [0206:Monster 2 Hp] > 0 @> Conditional Branch: Switch [0193:Mon 2 Para] is OFF @> Control Variables: [0786:Mon 2 Goal] -= Variable [0215] @> Conditional Branch: Variable [0786:Mon 2 Goal] <= 0 @> Control Variables: [0786:Mon 2 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Mon 3 @> Conditional Branch: Variable [0221:Monster 3 ID] > 0 @> Conditional Branch: Variable [0226:Monster 3 Hp] > 0 @> Conditional Branch: Switch [0194:Mon 3 Para] is OFF @> Control Variables: [0787:Mon 3 Goal] -= Variable [0235] @> Conditional Branch: Variable [0787:Mon 3 Goal] <= 0 @> Control Variables: [0787:Mon 3 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Mon 4 @> Conditional Branch: Variable [0241:Monster 4 ID] > 0 @> Conditional Branch: Variable [0246:Monster 4 Hp] > 0 @> Conditional Branch: Switch [0195:Mon 4 Para] is OFF @> Control Variables: [0788:Mon 4 Goal] -= Variable [0255] @> Conditional Branch: Variable [0788:Mon 4 Goal] <= 0 @> Control Variables: [0788:Mon 4 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Mon 5 @> Conditional Branch: Variable [0261:Monster 5 ID] > 0 @> Conditional Branch: Variable [0266:Monster 5 Hp] > 0 @> Conditional Branch: Switch [0196:Mon 5 Para] is OFF @> Control Variables: [0789:Mon 5 Goal] -= Variable [0275] @> Conditional Branch: Variable [0789:Mon 5 Goal] <= 0 @> Control Variables: [0789:Mon 5 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Comment: Mon 6 @> Conditional Branch: Variable [0281:Monster 6 ID] > 0 @> Conditional Branch: Variable [0286:Monster 6 Hp] > 0 @> Conditional Branch: Switch [0197:Mon 6 Para] is OFF @> Control Variables: [0790:Mon 6 Goal] -= Variable [0295] @> Conditional Branch: Variable [0790:Mon 6 Goal] <= 0 @> Control Variables: [0790:Mon 6 Goal] = 0 @> : Branch End @> : Branch End @> : Branch End @> : Branch End @> Conditional Branch: Variable [0790:Mon 6 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 281 @> Control Variables: [0890:Current Turn ID] = 10 @> Control Variables: [0790:Mon 6 Goal] = 10000 @> Control Variables: [0790:Mon 6 Goal] *= Variable [0910] @> Control Variables: [0790:Mon 6 Goal] /= 100 @> Control Variables: [0910:Skillspeed Mon 6] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0789:Mon 5 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 261 @> Control Variables: [0890:Current Turn ID] = 9 @> Control Variables: [0789:Mon 5 Goal] = 10000 @> Control Variables: [0789:Mon 5 Goal] *= Variable [0909] @> Control Variables: [0789:Mon 5 Goal] /= 100 @> Control Variables: [0909:Skillspeed Mon 5] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0788:Mon 4 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 241 @> Control Variables: [0890:Current Turn ID] = 8 @> Control Variables: [0788:Mon 4 Goal] = 10000 @> Control Variables: [0788:Mon 4 Goal] *= Variable [0908] @> Control Variables: [0788:Mon 4 Goal] /= 100 @> Control Variables: [0908:Skillspeed Mon 4] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0787:Mon 3 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 221 @> Control Variables: [0890:Current Turn ID] = 7 @> Control Variables: [0787:Mon 3 Goal] = 10000 @> Control Variables: [0787:Mon 3 Goal] *= Variable [0907] @> Control Variables: [0787:Mon 3 Goal] /= 100 @> Control Variables: [0907:Skillspeed Mon 3] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0786:Mon 2 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 201 @> Control Variables: [0890:Current Turn ID] = 6 @> Control Variables: [0786:Mon 2 Goal] = 10000 @> Control Variables: [0786:Mon 2 Goal] *= Variable [0906] @> Control Variables: [0786:Mon 2 Goal] /= 100 @> Control Variables: [0906:Skillspeed Mon 2] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0785:Mon 1 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 181 @> Control Variables: [0890:Current Turn ID] = 5 @> Control Variables: [0785:Mon 1 Goal] = 10000 @> Control Variables: [0785:Mon 1 Goal] *= Variable [0905] @> Control Variables: [0785:Mon 1 Goal] /= 100 @> Control Variables: [0905:Skillspeed Mon 1] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0784:Act 4 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 161 @> Control Variables: [0890:Current Turn ID] = 4 @> Control Variables: [0784:Act 4 Goal] = 10000 @> Control Variables: [0784:Act 4 Goal] *= Variable [0904] @> Control Variables: [0784:Act 4 Goal] /= 100 @> Control Variables: [0904:Skillspeed Act 4] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0783:Act 3 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 141 @> Control Variables: [0890:Current Turn ID] = 3 @> Control Variables: [0783:Act 3 Goal] = 10000 @> Control Variables: [0783:Act 3 Goal] *= Variable [0903] @> Control Variables: [0783:Act 3 Goal] /= 100 @> Control Variables: [0903:Skillspeed Act 3] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0782:Act 2 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 121 @> Control Variables: [0890:Current Turn ID] = 2 @> Control Variables: [0782:Act 2 Goal] = 10000 @> Control Variables: [0782:Act 2 Goal] *= Variable [0902] @> Control Variables: [0782:Act 2 Goal] /= 100 @> Control Variables: [0902:Skillspeed Act 2] = 100 @> Break Loop @> : Branch End @> Conditional Branch: Variable [0781:Act 1 Goal] == 0 @> Control Variables: [0911:Turn Act ID Pointer] = 101 @> Control Variables: [0890:Current Turn ID] = 1 @> Control Variables: [0781:Act 1 Goal] = 10000 @> Control Variables: [0781:Act 1 Goal] *= Variable [0901] @> Control Variables: [0781:Act 1 Goal] /= 100 @> Control Variables: [0901:Skillspeed Act 1] = 100 @> Break Loop @> : Branch End @> Wait: 0.0 seconds @> : Repeat Above @> Comment: Put Act/Mon in Place @> Control Variables: Variable [0889] = Variable ID [V[0911]] @> Control Variables: [0889:Turn ID Pointer] += 10 @> Control Variables: Variable [0889] = Variable [0890] @> Control Variables: [0889:Turn ID Pointer] -= 10 @> Conditional Branch: Variable [0889:Turn ID Pointer] > 887 @> Control Variables: [0889:Turn ID Pointer] = 881 @> Break Loop @> : Branch End @> Control Variables: [0889:Turn ID Pointer] += 1 @> Wait: 0.0 seconds @> : Repeat Above@> Control Switches: [0165😀etermine Turn done] = ONEdit: Put the code in via the very fitting code command :|
1) Please put your code into a code block 
2015_10_04_14_00_56_problem_with_a_loop_in_ctb_system___rpg_maker_2000_2003___rpg_maker_forums.png
, otherwise the indention is gone and it makes the code much harder to read.

2) You might be the victim of the "Break Loop" bug which has existed in RM2k and RM2k3 for ages already (I intend to get rid of it probably in the next update). I said "might" because due to point #1, I was unable to read the code properly. The point is that "Break Loop" will basically jump to the next ": Repeat Above" line, regardless of which indention it has. If you have a loop like this:

- Loop

-- ...

-- Break Loop

-- ...

-- Loop

--- ...

-- : Repeat Above

-- ...

- : Repeat Above

...Then the blue "Break Loop" will jump to the red ": Repeat Above" instead of the green one which you would have expected it to jump to.

The solution for now is to avoid structures like this and/or use labels instead of "Break Loop".

As said, I'm working on including the fix for this bug in the next update or so.
Thank you I'll try the same thing with labels then ^^

Edit: So I tried that and it seems after a certain number of executions even with the label-variant the event just stops doing anything 😳?

It's actually quite many repetitions it does before stopping... about a hundred. (Counting from tenthousand in 50 per repetition but stops at about 5000) Is there an upper limit to things like that?
No... sounds more like an error in your script itself. Can you maybe post your current label-version? And please tell us where/how it is "stopping", i.e. which part of the code is not executing, etc. And the exact number (instead of "about 5000") might give a clue as well. Thanks!

Witzig, als ich gerade meinen Post las, dachte ich mir "stimmt, da steht ja meine First Language. Steht die bei anderen auch? Ist mir noch gar nicht aufgefallen." Schau ich auf deine... und es ist auch Deutsch ^^
Edit: I'm sorry it seems it just runs terribly slow -.- but the same problem as with the loop version still exists.

Edit: So I found the point where it stops working, it still only happens after the first actor finished its turn, the script runs till it reaches a jump to label 2 command (any one) and then stops working, I inserted a sound right below label 2 to check for this, that's how I know it doesn't have anything to do with the code after label two.

So the exact number varies each time, highest I had was 101 lowest 53 times.

As for why or how it stops I have no Idea it just doesn't count down anymore so the goal-variables never reach zero thus preventing everything else from running :/

I marked the parts that execute a couple of times.

Edit: I just dont understand how it could exit the label-loop as it doesn't do it the first timeso it would have to continue till its counted down...

Code:
@> Comment: Decide Turn Order@> Control Variables: [0881..0898] = 0 @> Control Variables: [0889:Turn ID Pointer] = 881 @> Control Variables: [0911:Turn Act ID Pointer] = 101 @> Control Variables: [0890:Current Turn ID] = 0 @> Control Variables: [0781:Act 1 Goal] = Variable [0818]@> Control Variables: [0782:Act 2 Goal] = Variable [0819]@> Control Variables: [0783:Act 3 Goal] = Variable [0820]@> Control Variables: [0784:Act 4 Goal] = Variable [0838]@> Control Variables: [0785:Mon 1 Goal] = Variable [0839]@> Control Variables: [0786:Mon 2 Goal] = Variable [0840]@> Control Variables: [0787:Mon 3 Goal] = Variable [0858]@> Control Variables: [0788:Mon 4 Goal] = Variable [0859]@> Control Variables: [0789:Mon 5 Goal] = Variable [0878]@> Control Variables: [0790:Mon 6 Goal] = Variable [0879]@> Control Variables: [0912] = 0 @> Label: 1@> Control Variables: [0912] += 1 <------ I used this to count the repetitions@> Comment: Move to goal@> Comment: This part executes <------------------ from here@> Comment: Act 1@> Conditional Branch: Variable [0101:Actor 1 ID] > 0  @> Conditional Branch: Variable [0108:Actor 1 Hp] > 0    @> Conditional Branch: Switch [0173:Act 1 Para] is OFF      @> Control Variables: [0781:Act 1 Goal] -= Variable [0793]      @> Conditional Branch: Variable [0781:Act 1 Goal] <= 0        @> Control Variables: [0781:Act 1 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Act 2@> Conditional Branch: Variable [0121:Actor 2 ID] > 0  @> Conditional Branch: Variable [0128:Actor 2 Hp] > 0    @> Conditional Branch: Switch [0174:Act 2 Para] is OFF      @> Control Variables: [0782:Act 2 Goal] -= Variable [0794]      @> Conditional Branch: Variable [0782:Act 2 Goal] <= 0        @> Control Variables: [0782:Act 2 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Act 3@> Conditional Branch: Variable [0141:Actor 3 ID] > 0  @> Conditional Branch: Variable [0148:Actor 3 Hp] > 0    @> Conditional Branch: Switch [0175:Act 3 Para] is OFF      @> Control Variables: [0783:Act 3 Goal] -= Variable [0795]      @> Conditional Branch: Variable [0783:Act 3 Goal] <= 0        @> Control Variables: [0783:Act 3 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Act 4@> Conditional Branch: Variable [0161:Actor 4 ID] > 0  @> Conditional Branch: Variable [0168:Actor 4 Hp] > 0    @> Conditional Branch: Switch [0176:Act 4 Para] is OFF      @> Control Variables: [0784:Act 4 Goal] -= Variable [0796]      @> Conditional Branch: Variable [0784:Act 4 Goal] <= 0        @> Control Variables: [0784:Act 4 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Mon 1@> Conditional Branch: Variable [0181:Monster 1 ID] > 0  @> Conditional Branch: Variable [0186:Monster 1 Hp] > 0    @> Conditional Branch: Switch [0192:Mon 1 Para] is OFF      @> Control Variables: [0785:Mon 1 Goal] -= Variable [0195]      @> Conditional Branch: Variable [0785:Mon 1 Goal] <= 0        @> Control Variables: [0785:Mon 1 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Mon 2@> Conditional Branch: Variable [0201:Monster 2 ID] > 0  @> Conditional Branch: Variable [0206:Monster 2 Hp] > 0    @> Conditional Branch: Switch [0193:Mon 2 Para] is OFF      @> Control Variables: [0786:Mon 2 Goal] -= Variable [0215]      @> Conditional Branch: Variable [0786:Mon 2 Goal] <= 0        @> Control Variables: [0786:Mon 2 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Mon 3@> Conditional Branch: Variable [0221:Monster 3 ID] > 0  @> Conditional Branch: Variable [0226:Monster 3 Hp] > 0    @> Conditional Branch: Switch [0194:Mon 3 Para] is OFF      @> Control Variables: [0787:Mon 3 Goal] -= Variable [0235]      @> Conditional Branch: Variable [0787:Mon 3 Goal] <= 0        @> Control Variables: [0787:Mon 3 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Mon 4@> Conditional Branch: Variable [0241:Monster 4 ID] > 0  @> Conditional Branch: Variable [0246:Monster 4 Hp] > 0    @> Conditional Branch: Switch [0195:Mon 4 Para] is OFF      @> Control Variables: [0788:Mon 4 Goal] -= Variable [0255]      @> Conditional Branch: Variable [0788:Mon 4 Goal] <= 0        @> Control Variables: [0788:Mon 4 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Mon 5@> Conditional Branch: Variable [0261:Monster 5 ID] > 0  @> Conditional Branch: Variable [0266:Monster 5 Hp] > 0    @> Conditional Branch: Switch [0196:Mon 5 Para] is OFF      @> Control Variables: [0789:Mon 5 Goal] -= Variable [0275]      @> Conditional Branch: Variable [0789:Mon 5 Goal] <= 0        @> Control Variables: [0789:Mon 5 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: Mon 6@> Conditional Branch: Variable [0281:Monster 6 ID] > 0  @> Conditional Branch: Variable [0286:Monster 6 Hp] > 0    @> Conditional Branch: Switch [0197:Mon 6 Para] is OFF      @> Control Variables: [0790:Mon 6 Goal] -= Variable [0295]      @> Conditional Branch: Variable [0790:Mon 6 Goal] <= 0        @> Control Variables: [0790:Mon 6 Goal] = 0         @>       : Branch End      @>     : Branch End    @>   : Branch End  @> : Branch End@> Comment: This part doesn't     <--------------Executes till here the next part can't execute because the goals never reach zero@> Conditional Branch: Variable [0790:Mon 6 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 281   @> Control Variables: [0890:Current Turn ID] = 10   @> Control Variables: [0790:Mon 6 Goal] = 10000   @> Control Variables: [0790:Mon 6 Goal] *= Variable [0910]  @> Control Variables: [0790:Mon 6 Goal] /= 100   @> Control Variables: [0910:Skillspeed Mon 6] = 100   @> Text: bla 1  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0789:Mon 5 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 261   @> Control Variables: [0890:Current Turn ID] = 9   @> Control Variables: [0789:Mon 5 Goal] = 10000   @> Control Variables: [0789:Mon 5 Goal] *= Variable [0909]  @> Control Variables: [0789:Mon 5 Goal] /= 100   @> Control Variables: [0909:Skillspeed Mon 5] = 100   @> Text: bla 2  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0788:Mon 4 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 241   @> Control Variables: [0890:Current Turn ID] = 8   @> Control Variables: [0788:Mon 4 Goal] = 10000   @> Control Variables: [0788:Mon 4 Goal] *= Variable [0908]  @> Control Variables: [0788:Mon 4 Goal] /= 100   @> Control Variables: [0908:Skillspeed Mon 4] = 100   @> Text: bla 3  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0787:Mon 3 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 221   @> Control Variables: [0890:Current Turn ID] = 7   @> Control Variables: [0787:Mon 3 Goal] = 10000   @> Control Variables: [0787:Mon 3 Goal] *= Variable [0907]  @> Control Variables: [0787:Mon 3 Goal] /= 100   @> Control Variables: [0907:Skillspeed Mon 3] = 100   @> Text: bla 4  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0786:Mon 2 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 201   @> Control Variables: [0890:Current Turn ID] = 6   @> Control Variables: [0786:Mon 2 Goal] = 10000   @> Control Variables: [0786:Mon 2 Goal] *= Variable [0906]  @> Control Variables: [0786:Mon 2 Goal] /= 100   @> Control Variables: [0906:Skillspeed Mon 2] = 100   @> Text: bla 5  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0785:Mon 1 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 181   @> Control Variables: [0890:Current Turn ID] = 5   @> Control Variables: [0785:Mon 1 Goal] = 10000   @> Control Variables: [0785:Mon 1 Goal] *= Variable [0905]  @> Control Variables: [0785:Mon 1 Goal] /= 100   @> Control Variables: [0905:Skillspeed Mon 1] = 100   @> Text: bla 6  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0784:Act 4 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 161   @> Control Variables: [0890:Current Turn ID] = 4   @> Control Variables: [0784:Act 4 Goal] = 10000   @> Control Variables: [0784:Act 4 Goal] *= Variable [0904]  @> Control Variables: [0784:Act 4 Goal] /= 100   @> Control Variables: [0904:Skillspeed Act 4] = 100   @> Text: bla 7  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0783:Act 3 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 141   @> Control Variables: [0890:Current Turn ID] = 3   @> Control Variables: [0783:Act 3 Goal] = 10000   @> Control Variables: [0783:Act 3 Goal] *= Variable [0903]  @> Control Variables: [0783:Act 3 Goal] /= 100   @> Control Variables: [0903:Skillspeed Act 3] = 100   @> Text: bla 8  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0782:Act 2 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 121   @> Control Variables: [0890:Current Turn ID] = 2   @> Control Variables: [0782:Act 2 Goal] = 10000   @> Control Variables: [0782:Act 2 Goal] *= Variable [0902]  @> Control Variables: [0782:Act 2 Goal] /= 100   @> Control Variables: [0902:Skillspeed Act 2] = 100   @> Text: bla 9  @> Jump to Label: 2  @> : Branch End@> Conditional Branch: Variable [0781:Act 1 Goal] == 0  @> Control Variables: [0911:Turn Act ID Pointer] = 101   @> Control Variables: [0890:Current Turn ID] = 1   @> Control Variables: [0781:Act 1 Goal] = 10000   @> Control Variables: [0781:Act 1 Goal] *= Variable [0901]  @> Control Variables: [0781:Act 1 Goal] /= 100   @> Control Variables: [0901:Skillspeed Act 1] = 100   @> Text: bla 10  @> Jump to Label: 2  @> : Branch End@> Wait: 0.0 seconds <--------------------Those two lines @> Jump to Label: 1  <--------------------execute as well@> Wait: 0.0 seconds@> Label: 2@> Comment: Put Act/Mon in Place@> Control Variables: Variable [0889] = Variable ID [V[0911]]@> Control Variables: [0889:Turn ID Pointer] += 10 @> Control Variables: Variable [0889] = Variable [0890]@> Control Variables: [0889:Turn ID Pointer] -= 10 @> Conditional Branch: Variable [0898:Turn ID 8]  != 0  @> : Branch End@> Conditional Branch: Variable [0889:Turn ID Pointer] == 888  @> Control Variables: [0889:Turn ID Pointer] = 881   @> Jump to Label: 3  @> : Branch End@> Control Variables: [0889:Turn ID Pointer] += 1 @> Wait: 0.0 seconds@> Jump to Label: 1@> Wait: 0.0 seconds@> Label: 3@> Control Switches: [0165:Determine Turn done] = ON
Hm, it's a mystery for me as well at the moment. There is one limitation which comes to my mind (sorry, forgot about this before): Only 10000 event commands (belong to the same script, including called other events) may be executed in one frame. However this should a) not abort the event but just delay execution to the next frame and 😎  shouldn't apply to your situation because I see you use tons of "Wait 0.0s" commands (which also explains why the script runs so slowly).

Apart from that: Sorry, I didn't fully understand your script yet, I can't see a reason why it stops.

Another idea, which will only work if your game doesn't use any of the features which are exclusive to the new official RM2k3 version (just try it out if you are not sure)*:

- Create a copy of your game

- If your game uses any resources from the new official RTP which are not in the old inofficial RTP, copy them (or just the whole RTP) into the copy of your project.*

*: These things are necessary because the addon which we will use was designed for use with the inofficial RM2k3 in version 1.08, not the official one.

- Download this addon and copy the provided RPG_RT.exe and revhelper.dll files into the copy of your project. You can either overwrite the existing RPG_RT.exe or copy it under a new name. (Make sure you are operating on the copy of your project, not the original).

- Start the new RPG_RT.exe file and play until you reach the moment the script should be running. It's best if you switch to windowed mode.

- Press F3. It should show you a window where you can select which events to log to a file. You can adjust the filter settings if you want to match your situation (depending on how many other events you have running, you might get a very large output file otherwise). Confirm.

- Let the script run until the error occurs where it stops.

- Press F3 again. The flashing "Tracing" text in the top-left should disappear.

- Look into the "trace.log" file which was just created in your project's folder. It will contain all the executed event script lines, together with relevant variable read/write operations. Note that the event and page numbers might be wrong, but the line number will be always correct. (The "Frm" column shows the number of frames since the game was started.)

Maybe this will give a clue what is going on.
Okay I'll try that. Yeah I put in the waits because it didn't need to be incredibly fast and I didn't want to clutter the available lines per tick because that has led to laging but it seems it's not neccessarry here ^^ Thanks for the addon i really hope this helps ^^

Edit: Unfortunatelly I can't download the file it says the file is corrupted :/ Do you know another address I can get it at?
Try again, not sure why there was that internal error, but I fixed it.
Unfortunately I can't seem to use that addon as I use picture numbers over 100 which seems to be the limit for the version of the rpg_rt file :/
You can try increasing the limit (see the English instructions at the bottom).
So the german shouldn't be a problem as I am german myself ^^ Anyway I can't change the picture limit, do I have to use the rescource hacker for that? Or is it just not available in the demo?

So I just went ahead and tried the rescource hacker thing but of course it was already set to 1000 but the option in Hyper 2 is still greyed out, before as well as after changing the limit to 9999 :/
(Oh now I forgot about the German thing, directly after I mentioned it myself. I'm dumb.)

Resource Hacker won't help you there.

Hm, for me it works fine. Just make sure you use the latest version from my website, that you open the copy of your project and not the real one and that the debug addon's RPG_RT.exe is called "RPG_RT.exe" and not something else (like "debug.exe" or something).

2015_10_05_12_34_14_problem_with_a_loop_in_ctb_system___rpg_maker_2000_2003___rpg_maker_forums.png
Ah it was the wrong exe name ^^

Edit:

So after some trying around I managed to get a usuable trace log, and it seems that the event actually simply stops without apparent reason it doesn't execute the next line  >jump to label 2<

I uploaded the log to my dropbox as it ,of course, is too long to post here ^^

https://www.dropbox.com/s/cf15l9v9g9af2j1/trace.log?dl=0

I would really appreciate it if you can tell what I'm doing wrong.
Indeed weird, I don't see any reason why it would simply stop there.

Hm, I just had an idea.

Does this event have any start condition? Is it possible that something simply turns off the switch, for example? I know this is very basic but maybe there was an oversight.
I had hope for a second there but unfortunately no it doesnt have starting conditions because it only runs on call anyway 🙁
And what about the caller? And the caller's caller, if any? Etc.

Remember that even if the interpreter is currently handling a called script, it's still associated with the original "root" script, so if you pull the plug on the root script (i.e. when its start conditions are not fulfilled any longer), regardless of where in the code the interpreter is (even if it's in another event which was called), execution will be stopped.
So how far back does that reach? All the way? 😳

That was exactly the reason... ugh... so I just have to decouple the events from each other -:- and here I tried to not use parallell processes all the time to minimize bugs :l Thank you so much for all the help and thought you put into this ^^
Yes. You have to think of it this way: Each parallel event is like its own process, and of course called subroutines are part of the parent process. It's merely a "coincidence" that subroutines are events of their own, because the only scripting entity in the RM is an event.

(In this scenario you could even have the same event running twice at the same time, consider the following situation: Event A is a PP and is active, and it calls event B. Event B is however also a PP and is also active. You will now have event B running twice, once under the process "event A" and once under "event B".)
I simply assumed that it just starts the event like a normal button press then again propably that also works in this way ^^

It works now thanks to you ^^

Now if I only can find out what's wrong with my turn calculation everything should be fine xD

Aaand that's done as well ^^

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-a-loop-in-ctb-system.45461/