Hey all, it’s me again with yet another randomtest recursion error. (I swear these things are the bane of my CSG creation.)
So, I just spent a while trying to track down seemingly random recursion errors which weren’t there last time I tested the game and putting fail safes in for the *rand rolls etc and it didn’t fix it.
Only then did I remember I’d removed the option to reset the game back to the startup menu because I need to keep elements saved between playthroughs. (When you “play again” from the ending screen, it instead sends you to the chapter 1 page, not the start up file. I added this command to the ending file thinking it would cause the game to reset rather than loop forever and cause the computer to melt down.
*if (choice_randomtest)
*goto_scene startup
I didn’t particularly want to do that given I’m worried there might be some choices I’ve missed that aren’t being re-selectable on playthroughs (I think I’ve got them all but still…) but even this doesn’t seem to work. So far I haven’t gotten a recursion error again since adding this code, but it’s still looping even when I just ask it for 1 round of testing until the whole program starts to melts down and eventually crashes.
(Anyone seen firefox melt down and start looking like a gremlin is throwing your letters around while running random test? Here ya go!) No more luck on CSIDE (it just freezes and needs a force restart.)
Your recursion variable will always vary between 1 and 0. It will never reach 3. This has the potential of creating an infinite loop if randsouth will roll on the same value as roll north multiple times. I’m not sure what the last *set recursion 0 instruction is meant to achieve, but I’m pretty sure that’s the cause of your problem.
Let’s take a step back. What exactly are you trying to achieve? Judging by the code, you want each variable (north, south, east and west) to have unique values ranging from 1-4?
Hey quartz. Yes basically what it is, is I need a back up random set for elements to be placed north, south, east, west in a unique way in case the player chooses to allow them to be set randomly or they fail to influence the order.
I don’t think the error is here (I don’t think so anyway I could be wrong. It wasn’t flagging it prior to stopping the ability to completely restart the game.) I think the next thing I’ll need to do is take out the ability to loop around and see if that fixes the recursions or not but have run out of time for a bit. If taking out the loop works, I have no idea how to get this game to pass random test for submission. If it doesn’t then I’m going to have to hunt down another looping error(s) which yeah, are highly likely to be in one of the procedural random sets.
I really need to be doing other things, but it’s annoying me so I decided to just disable the loop which I’m assuming probably solves the infinite loop problem (although I need it to loop so no idea what to do with that bit). But now it’s back to running though <10 times and seemingly throwing up completely random recursion errors. It’s different every time, and where it seems to be pointing to a problem isn’t making any sense to me. A few examples below.
I’ve also tried running it with *looplimit 100000000000 which I would have thought should have stopped any recursion errors completely but it still tells me there’s a problem without telling me what line its on. (I also tried setting the looplimit low to see if it’d trigger on a line but it doesn’t.)
Sorry this is incredibly frustrating. I have no idea where to go from here.
Edit: By the way, there’s no story text as this no longer seems to work on the browser. I’ve tried running this game on CSIDE but it just freezes up in random places when random testing and then crashes needing a hard reset (I’m not even sure where it thinks the problem is). Given both are not working on this game I’m assuming there’s a issue somewhere. (Although CSIDE doesn’t like my notepad++ files so it could be reacting to something else. Probably not though.)
It sounds like you checked everything… How did you disable the loop? Does each scene have its own looplimit? Could the image headers be the problem? (I wonder what it could be… )
Unfortunately this is a design flaw in CSIDE’s current architecture. Everything (the UI and CS game) runs in the same process so when a CS game crashes, so does CSIDE. Definitely not ideal.
One of my non-public development versions of CSIDE has improved on this so that only your game window will crash rather than the whole application (unfortunately nothing any of us can do about run away game code!).
As I think you’ve worked out, looplimit is applied per scene, so you might need to get more liberal with it.
If I understand you correctly, you’ve coded around the restart option that appears at the end of every CS game, in order to control how replaying the game works. Does that mean that the *ending command is never executed in your project?
Have you tried running an empty project with just this code in it? It seems a likely suspect for the source of the recursion trouble.
Sorry! I wasn’t meaning to criticise. If it came across that way it was the frustration talking. I just meant to note I was also having issues with CSIDE as a double check to whether there was something wrong with my downloaded CS tester or a browser issue.
Yes so that’s it. My mistake, I thought that sending it back to the startup file would cause a reset of everything, but it seems that you actually need to use the *ending command to do that.
I’ll try putting the looplimit command with a high number of passes on all the scenes (not just the rand ones that I thought were causing the issue) and see if that fixes the issue
Thank you for everyone’s help! This one was driving me crazy because of the randomly thrown up errors. When I get a chance I’ll try the looplimit fix and see how we go to stop players encountering issues if they replay it a few times. I may also need to see if I can get the randomtester to run through an *ending command instead to stop the infinite loop when it tries to test it as that is also likely causing crashes (maybe I can set a counter under the *if (choice_randomtest) so it runs through a couple of times to pick up any null selectable choice errors anywhere etc, but stops after a limited number of rounds.)
Ok so I thought the issue was solved (and I think it is partially solved), but unfortunately I still seem to be getting random recursion errors when I up the number of randomtests even with the loop completely turned off (going only to *ending) and every scene having a looplimit that’s sky high. I’m not sure what I’m missing as I can’t see an issue with code like this one?
The only other thing I can think of unless I’m missing something is does the random tester eventually freak out by the image command being used too often? The only other change I can think of is that I’ve added image bars to the top of every page. I could try turning them all off with an *if not (random_tester) command I think, but it’ll be quite a bit of work to go through and change them all so wondering if anyone knows if that’s actually where the issue is likely to be first? It’s just weird that it’ll run through over 400 rounds (some of which are much longer than this with more *images without an issue then jam up. It’s thrown up a few other recursion errors in different areas too (not just here). Maybe I’m missing a problem genuine problem in this code though? Really not certain. Thanks.
Edit: Here’s another example in a completely different file of the same error
Could the issue be the fight loop in finalattackraishall? Although you did say you added looplimits to all the scenes… Hmm…
If you haven’t figured it out yet, do you mind uploading the newest versions with the looplimits and *ending placements in dashingdon? Maybe if I follow the code, I’ll see something new.
What if you replace all *image with *comment image? Randomtest ignores comments, right? And it’ll be easy to change *comment image back to *image if it’s still the same.
Yep, on all scenes is now *looplimit 1000000000000
I honestly can’t see how anything could possibly be going over that unless there’s multiple true error loops scattered all over the game, or the randomtester is getting upset about something different and flagging it as a recursion error when its not.
I could, or also just have it switched off for random test and if that works I can just leave it like that for submission. Either should work if it’s a random test issue rather than a true bug right? It’s just there’s so many images to change. I’ll do it, was just hoping to know if anyone knew it was an error or not before I spend yet more time on something that might not even be the problem. (I really can’t understand why the image command would set off the random tester as it’s a command not a repeat script.) If no one else is sure, I think that’s my next step though.
Edit- Just out of interest, does anyone know how Paradox factor got around the looping issues? I’m assuming it does the same as what I’m trying to do (in the final game, currently the loop is turned off to prevent issues from that sector while we sort this one). Did it just use a high looplimit or something else?
Edit: Actually it looks like I can access the first page of code for Paradox factor at least… And oh dear, I think this game might be doomed. I guess thanks for the head’s up Lucid? Should I laugh or cry right about now
Based on the files that RT is running through when it fails, I would look at places in the code where there are a lot of consecutive or nested subroutine calls. That would be my first suspicion.
Yep thanks Hazel. Will have to keep looking. It’s just making it extremely hard to track down as the error seems random in various places on various files and I can’t find the error anywhere it’s saying it occurs. It seems like it’s failing at a different place each test which is weird.
Ok, no idea what to do from here I just *if not (choice_randomtest) flagged all the header images in the first doc to start with, and now it’s flagging every single choice in order in that document as “too much recursion”. If you tell it to skip that choice with an *if (choice_randomtest) *goto next section type command, it then just flags the next choice even when it can’t be a recursion error as it’s just a straight forward choice with no nesting or rand rolls.
There’s no looping (I have it currently disabled and going through *ending after each round).
I have a looplimit that’s in the thousands.
I’ve disabled the images for random test in the first doc and it’s made the problem worse!
The game seems to play fine. It passes quick test.
I honestly have no idea what to do at this stage. I can’t think of anything else that should be setting this game off. Can overuse of the (choice_random) break the game? Because that’s what its looking like.
So the first recursion error occurs right at the beginning of the startstory file, no loops whatsoever, at the choice with the names?
If overuse of (choice_randomtest) can also break the game, then I still think it might be helpful to try the *comment image idea on the first file to see if the images are the source of the problem. Maybe try it without blocking the other files, and if the error continues to pop up, then with blocking the other files so it ends at startstory just to focus the testing further.
And if that doesn’t work, what happens if you use CSIDE’s stepping function? While the recursion error may not show up while manually testing, perhaps there’s a hidden loop that will present itself.
Hey @expectedoperator. I’m hoping I might have found the error (although I’ll need to rerun the randomtest a whole heap of extra times and then run the other 2 paths. Probably going to also need to try a few loops as well to make sure.
I honestly have no idea why it’s throwing up such random line errors which makes me worried maybe there’s something else wrong, but I think where the source of the problem might be is a clash between the needed settings on the first story and the needed settings on the second story. Some of the second story settings are on random, so that’s probably why sometimes the two clashed, and sometimes they didn’t causing an error only sometimes when if statements were being checked in the element setting sequence in story one. I’ve moved the story two element set to a different file which I hope will stop at least this particular error from happening. It’s kind of annoying that I can’t get full text on random test anymore. It would have made this error far easier to work out.
I actually have no idea what that is. I’ll have to look into it.