Snake0391 Posted January 11, 2010 Share Posted January 11, 2010 Hi, I'm trying to create a loop using Label and goto but the game crashes everytime I try. how do I fix this, I just want to create a basic loop. The code works fine except when I add the loop. here is my code for my script:scn SxSTheThingMainScript ; Coded by Snake0391 on 1/1/2010 ref Target short KeyInit short InitMessage short InvalidKey short InvalidMouseKey short Continue short Type long BindKey ref LoopTarget begin GameMode if (KeyInit == 0) if (InitMessage == 0) ShowMessage SxSInitMessage Set InitMessage to 1 endif Set InvalidKey to GetControl 5 Set InvalidMouseKey to GetControl 4 Set BindKey to GetKeyPress 0 ;Set BindMouseKey to GetMouseButtonPress 0 if (BindKey == InvalidKey) ShowMessage SxSInvalidKeyMessage Set InitMessage to 0 Set Continue to 0 else Set Continue to 1 endif if (BindKey > 0) if (Continue == 1) ShowMessage SxSInitDoneMessage Set KeyInit to 1 endif ;else if (BindMouseKey > 0) ;if (Continue == 1) ;ShowMessage SxSInitDoneMessage ;Set KeyInit to 1 ;endif endif endif set Target to GetCrossHairRef if (IsKeyPressed BindKey) if (Target) Set Type to GetType Target if (Type == 42) Set LoopTarget to GetFirstRef 42 Label 25 if (LoopTarget);&& LoopTarget.GetInFaction FollowerFaction == 0 && LoopTarget.GetInFaction TeamMateFaction == 0 && LoopTarget.GetInFaction PlayerFaction == 0) if (LoopTarget.GetDisabled == 0) if (LoopTarget.GetDead == 0) if (LoopTarget != Target) if (LoopTarget.GetLOS Player) LoopTarget.SetDisposition Player -100 endif endif endif endif endif Set LoopTarget to GetNextRef Goto 25 end Link to comment Share on other sites More sharing options...
Snake0391 Posted January 12, 2010 Author Share Posted January 12, 2010 can anyone help me? Link to comment Share on other sites More sharing options...
Recommended Posts