# Looping & Debugging

**URL:** <https://forum.choiceofgames.com/t/looping-debugging/143979>\
**Category:** ChoiceScript Help\
**Created:** [October 30, 2023, 7:43am UTC](https://forum.choiceofgames.com/t/looping-debugging/143979 "2023-10-30T07:43:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![HarrisPS](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/harrisps/32/240120_2.png) [@HarrisPS](https://forum.choiceofgames.com/u/HarrisPS)\
**Post date:** [October 30, 2023, 8:18am UTC](https://forum.choiceofgames.com/t/looping-debugging/143979/3 "2023-10-30T08:18:54Z")

</div>

I am not sure if you are using RandomTest for debugging, so disregard this part is you are - but if not it is essential especially if you have complicated code as you describe. You can use `*if (not(choice_randomtest))` to block RandomTest from picking certain choices if you want to focus on a particular path or section.

You can use `*looplimit 0` to switch off the limit on infinite loops but that will cause issues when using RandomTest. I would suggest including an option that forces the combat to end, at least for testing purposes, so when playtesting you don’t have to play through the whole section every time and RandomTest can move past the section.

Here is more about `*looplimit`:

> [@New in ChoiceScript: Limits on infinite loops enabled for all games](https://forum.choiceofgames.com/t/new-in-choicescript-limits-on-infinite-loops-enabled-for-all-games/104757):
>
> It’s possible to write an “infinite loop” bug in ChoiceScript, where the game keeps running the same lines of code over and over again, forever. These bugs can be hard to find and fix. Last year, we announced that [our Randomtest tool would begin enforcing limits on infinite loops](https://forum.choiceofgames.com/t/new-in-choicescript-limits-on-infinite-loops-in-randomtest/76555). Now, in the latest version of ChoiceScript on GitHub, we limit infinite loops in actual games as well. If your game has an infinite-loop bug, your players may now begin seeing errors like this: startup line 31: vi…

---

_[View the full topic](https://forum.choiceofgames.com/t/looping-debugging/143979)._
