Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Script] Infinite Loop?
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#2
RE: [Script] Infinite Loop?

The crash is caused by the infinite loop working. The game will hang until the script function call is finished - which obviously won't happen if you are stuck in an infinite loop. I am assuming you want some form of event which is fired once per step, in which case, try the following:

void OnStart()
{
   loopStep("LoopTimer1");
}

//Loop the specified timer with delay of fDelay
const float fDelay = 1.0f / 60.0f; //60 steps per second
void loopStep(string &in asTimer) {
  OnStep(asTimer);
  AddTimer(asTimer,fDelay,"loopStep");
}

//Our loopStep code will call this once per step.
void OnStep(string &in asTimer)
{
  //CODE HERE
}
12-30-2011, 08:01 PM
Find


Messages In This Thread
[Script] Infinite Loop? - by Dobbydoo - 12-30-2011, 07:35 PM
RE: [Script] Infinite Loop? - by Apjjm - 12-30-2011, 08:01 PM
RE: [Script] Infinite Loop? - by Dobbydoo - 12-30-2011, 08:26 PM
RE: [Script] Infinite Loop? - by Your Computer - 12-30-2011, 09:02 PM
RE: [Script] Infinite Loop? - by Dobbydoo - 12-30-2011, 09:20 PM



Users browsing this thread: 1 Guest(s)