[Script] Infinite Loop? - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [Script] Infinite Loop? (/thread-12203.html) |
[Script] Infinite Loop? - Dobbydoo - 12-30-2011 Is there any way to make an infinite loop in Amnesia? I've tried: PHP Code: for(int k = 20; k > 50; k+=5) PHP Code: for (;;) PHP Code: while (1 == 1) PHP Code: for(int k = 2; k == 1; k+=5) PHP Code: while (1) But none have worked. They have just resulted in crashes of different kinds :/ RE: [Script] Infinite Loop? - Apjjm - 12-30-2011 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: Code: void OnStart() RE: [Script] Infinite Loop? - Dobbydoo - 12-30-2011 Would you mind explaining that a bit more detailed? I don't understand very much of it :/ RE: [Script] Infinite Loop? - Your Computer - 12-30-2011 In other words: Use a timer where the function that gets called also resets the timer, where the timer loops about every 16ms. RE: [Script] Infinite Loop? - Dobbydoo - 12-30-2011 Why didn't I think about that?! I feel so stupid... But thank you very much |