RANDOMTEST FAILED too much recursion

I’m getting this error on random test. It’s showing up as infinite *page_break’s . Unfortunately this game is very code heavy. I’m assuming it’s somewhere in this section of code spread over 2 scenes. (I think anyway. Wish random test gave line numbers). I’ve been over and over it but can’t work out where it would have an infinite loop of pagebreaks. Any suggestions please?


image

*if (coins > 0)

	*if ((traps >= 0) and (traps < 31))	
		*if (thief < 5 )
			To your knowledge, no thieves were able to break into your home this year.
		*if (thief > 4)
			To your dismay, you find that your home has been broken into. 
			*if (thieftype = 1)
				At least they were not as capable as some of their kind, only managing to steal 5% of your treasure.
				*set calcstolen (coins * 0.05)  
			*if (thieftype = 2)
				They were reasonably competent for their kind, managing to steal 15% of your treasure.
				*set calcstolen (coins * 0.15) 
			*if (thieftype = 3)
				In a panic, you find that they were able to make off with almost 30% of your hoard and there is no way to trace them. They must have been skilled at their work indeed. 
				*set calcstolen (coins * 0.30) 

*set coins (coins - calcstolen)
*set totalstolen (calcstolen + totalstolen)	



*page_break

*if (goblin = "leave")
	*set goblin "leaveend"
	

*goto_scene years	
			

(Scene years)

*label summary
*page_break
*temp modifyfood 0
*temp modifycoins 0
*temp temphealth 0
*temp tempfood 0
*temp foodloss ""


*if (skin = "scales")
	*if (hibernateno = 0)
		*set hibernatefood 100
	*if (hibernateno = 1)
		*set hibernatefood 150
	*if (hibernateno = 2)
		*set hibernatefood 200
	*if (hibernateno = 3)
		*set hibernatefood 250

*if (skin != "scales")
	*if (hibernateno = 0)
		*set hibernatefood 100
	*if (hibernateno = 1)
		*set hibernatefood 150
	*if (hibernateno = 2)
		*set hibernatefood 250
	*if (hibernateno = 3)
		*set hibernatefood 300		

*set foodeaten 0
*set food 0
*set tempfood 0
*set temphealth 0
*set hunt ""
*set treasurehunt ""
*set elementhunt ""
*set securityhunt""
*comment reset each year



*comment survival check for overstayed hibernation times.
*if (hibernate = 6)
	*set health -10
*if (hibernate = 7)
	*set health -10
*if (hibernate > 7)
	*set health -20
	
*if (health < 1)	
	Lack of rest has taken its toll on your growing body. You've overstayed your time in the waking world, and as a result your health fails. Eventually you find yourself weakened to the point that you can no longer rise and slip into a deep sleep from which you never wake.			
	
	*goto_scene died
	
*comment knight check has been moved to summarydragon page and under the hibernate label on this one due to RNG	

*if ((humans >20) and (humans < 41))
	*if (knight = 10)
		*goto_scene knightbattle
*if ((humans > 40) and (humans <61))	
	*if (knight > 7)
		*goto_scene knightbattle
*if ((humans > 60) and (humans <81))	
	*if (knight > 5)
		*goto_scene knightbattle
*if ((humans > 80) and (humans <100))	
	*if (knight > 2)
		*goto_scene knightbattle
*if (humans = 100)
		*goto_scene knightbattle


*if (completedevent1 = "no")
	*if (hibernateno = 0) and (hibernate =4)
		*goto_scene randomevent
*if (completedevent2 = "no")
	*if (hibernateno = 1) and (hibernate =2)
		*goto_scene randomevent
*if (completedevent3 = "no")
	*if (hibernateno = 2) and (hibernate =1)
		*goto_scene randomevent
*if (completedevent4 = "no")
	*if (hibernateno = 3) and (hibernate =3)
		*goto_scene randomevent		
	
	
*if (health > 100)
	*set health 100
*if (health < 0)
	*set health 0

*if (health > 84)
	*set healthtxt "and in excellent health"
	*comment 85-100%
*if ((health > 69) and (health < 85))
	*set healthtxt "and in good health"
	*comment 70-84%
*if ((health > 54) and (health < 70))
	*set healthtxt "and in fair health"	
	*comment 55-69%
*if ((health > 39) and (health < 55))
	*set healthtxt "and are weakened"	
	*comment 40-54%	
*if ((health > 24 ) and (health < 40))
	*set healthtxt "and are significantly weakened"	
	*comment 25-39%	
*if ((health > 9) and (health < 26))
	*set healthtxt "and are dangerously unwell"	
	*comment 10-25%	
*if (health < 10)
	*set healthtxt "and are so weak that some days you are barely able to rise"	
	*comment <10%	
*if (humans > 100)
	*set humans 100
*if (humans < 0)
	*set humans 0	
	
You are currently ${age} years old ${healthtxt}.

RT automatically aborts a test when a run went through a section too many times – I’m assuming that’s what happened here.

If it’s a just a simple, non-critical, game-mechanics subroutine – and you’re surely 100% sure it can pass no matter the combination the players’ stats – you can make RT skips over it using *if not(choice_randomtest).

1 Like

That’s just it. I think there is something wrong. There shouldn’t be a way for it to have a recurring page_break issue. I just can’t find where it is :confused:

Thanks for the code, I’m actually not sure if I can use it though. I’ve been trying to pinpoint where the error is, but can’t seem to find it.

Can you write down some text between two page_breaks and then run random test? It’ll narrow things down.

edit: say, “text a” after first page_break and before goto_scene and “text b” after second page_break.

1 Like

Thanks @anon8836198 :slight_smile: I was actually doing something similar to your suggestion but was using a goto_scene ending and somehow I’ve managed to break my game even more (whoops). Your suggestion is better, I should’ve used “text a”

2 Likes

Ok, I got the game functioning again and used something a bit less distructive to troubleshoot and think I’ve pinned it down to the two events I have that are currently unwritten scenes, but do have the correct code (I think ) so that they should be working ok. I can fix it for now by disabling those choices, but can anyone see why they would cause a loop? Thanks

This is the code I think is the problem
Scene: Event1
code1

Scene: years

This is what the randomtest looks like with the above

Edit: Oh! I see it now. Only took me a few hours :P. I’ve messed up the completevent numbering.

1 Like

If serve you of something your code problem had served me to spot that i was planning something similar in my own code That caused a infinite loop So thanks

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.