ID:263828
 
Code:
            if(src.npcident==0)
for(var/mob/L in world)
if(L.key==src.enemy2)
var/filmfix=0
for(var/obj/Saved_Films/CurrentReplay/D in L.contents)
for(var/A in D.actionp1c1)
if(filmfix==0)
filmfix=1
if(A!="|end|")
src.BattleChoice=A
D.actionp1c1-=A
src.NPCCombat()
D.actionp1c1-="|end|"
filmfix=0
for(var/obj/Saved_Films/CurrentReplay/D in L.contents)
for(var/A in D.actionp1c2)
if(filmfix==0)
filmfix=1
if(A!="|end|")
src.BattleChoice=A
D.actionp1c2-=A
src.NPCCombat2()
D.actionp1c2-="|end|"
if(src.npcident==1)
for(var/mob/L in world)
if(L.key==src.enemy2)
var/filmfix=0
for(var/obj/Saved_Films/CurrentReplay/D in L.contents)
for(var/A in D.actionp2c1)
if(filmfix==0)
filmfix=1
if(A!="|end|")
src.BattleChoice=A
D.actionp2c1-=A
src.NPCCombat()
D.actionp2c1-="|end|"
filmfix=0
for(var/obj/Saved_Films/CurrentReplay/D in L.contents)
for(var/A in D.actionp2c2)
if(filmfix==0)
filmfix=1
if(A!="|end|")
src.BattleChoice=A
D.actionp2c2-=A
src.NPCCombat2()
D.actionp2c2-="|end|"


Problem description:

Basically i'm making replays for my game that allow you to relive a match. I ran a debug mode to tell me the status of all four lists which determine your actions that ''AI'' mobs make for you to re-create the scenario.

When I debug'd the lists, it turns out the lists are perfect and re-created the match, so this code should have been able to read the first entry, then the second, and so on.

However, what this is making the thing do is spam one move about five times, then just keeps on ending it's turn.

It looks like it might be having trouble removing entries from the lists, but I don't know.

Is there anything wrong with the above coding? That would help