I’m having trouble with fixing an error found by randomtest.
The error I’m getting is: visited this line too many times.
I’ve gotten this previously when I looped back through choices, but this section doesn’t involve a loop. I even changed the numbers from 1/2 to true/false.
The scene establishes the history between two characters. The scene can take place at either the start or the end of the chapter. If it takes place at the start, then the next label is “luvia_answer_two.” If it takes place at the end, the next label is “luvia_late_2.”
The line *label luvia_answer_two is the one getting marked for the error.
My code looks like this:
(I’ve snipped the text from each choice as it is just text).
*label luvia_history
*if asexual = false
*set luvia_actions 3
*if asexual = true
*set luvia_actions ace_type
[Text, asking a question re: your shared history]
*choice
# No.
*if luvia_meet = true
*goto luvia_answer_two
*if luvia_meet = false
*goto luvia_late_2
# Yes, once. I'm not proud of it.
*label luvia_encounter
[text w/ multireplace for if proud and if not]
*if luvia_proud = true
*return
*if luvia_meet = false
*goto luvia_end_encounter
*label luvia_end_encounter
[text if not proud]
*if luvia_meet = true
*goto luvia_answer_two
*if luvia_meet = false
*goto luvia_late_2
# Yes, once. I enjoyed it.
*gosub luvia_encounter
[text if proud]
*if luvia_meet = true
*goto luvia_answer_two
*if luvia_meet = false
*goto luvia_late_2
# It wasn't just once.
*if luvia_meet = true
*goto luvia_answer_two
*if luvia_meet = false
*goto luvia_late_2
*label luvia_answer_two
[story continues]
I’m tempted to just copy/paste this whole encounter again at the end and not bother with the luvia_meet variable at all. Then I can probably even make this a fake_choice and get rid of the luvia_answer_two label entirely. I just hate to repeat like that, though.
I don’t know if this will fix the error but I suggest you use Ifelse, and not IfIf
That error tells you you’ve created a loop, the error might not show up in the piece of code you show here, but in some other place that is redirecting you here nonstop.
Switching to if/elseif won’t fix anything. Randomtest thinks there’s a loop. How many ways are there to get to *label luvia_history?
Or if you want “mutually exclusive, but not mandatory” outcomes – see here for examples. Elseif | ChoiceScript Wiki | Fandom. When it’s a Boolean, all elseif can add is confusion.
Later in the chapter, I have a gosub or goto going to luvia_history (I can’t remember which I stuck with). I’ll double check that it isn’t mentioned elsewhere when I get home from lunch.
I’ve had issues with loops before (and still do with two different and completely unrelated loops), but this one is baffling me because there shouldn’t be a loop anywhere.
All right. So I found the other luvia_history mention. I did end up going with a goto, but I’d left the next label nested under the *if. I moved luvia_late_2 to its own area (no indents) and it works.
OK, I’m waving the white flag, I need help! I keep getting the visited this line too many times error when I go to a specific part of my story. Stepping shows me that it’s trying to skip this section, but I can’t figure out why. Here’s the code:
*label woods
You feel overwhelmed, somewhat panicked. You turn and run blindly into the woods. Your heart races as you run through the completely unfamiliar landscape. You hear your breathing, harsh in the stillness of the woods. FInally you slow, looking around you. You don’t think you could even find your way back to the clearing.
The trees are think around you and the light is dim. There isn’t a lot of brush or bushes, the trees stand starkly straight from the moist earth. You hear footsteps and you turn to see the old man from the clearing before you.
*if listenedsamuel = true
*if samuel = true
Samuel
*if samuel = false
The old man
looks at you with pity in his eyes. “Follow me back to the clearing, please.” You look around at the trackless woods and sigh. “Lead on,” you say feeling suddenly worn out. You are silent as you follow him back to the clearing.
*goto clearing1
*if listenedsamuel = false
You look at the old man, feeling confused and dismayed. He stands silently, looking at you with some pity in his eyes. “Please, come with me, back to the clearing. We can talk more there.” You nod slowly, feeling tired and overwhelmed. You follow the old man back to the clearing, marveling that he can find his way back so easily. In a short time, you find your way back to the clearing in the woods.
*goto listen
Can anyone help me figure out what is wrong? Thank you all!
Is this exactly as your indentation appears (namely, with no indentation) in wherever you’re writing this? If not, could you share what the indentation looks like?
No, the indentation didn’t copy correctly. Here it is corrected:
*label woods
You feel overwhelmed, somewhat panicked. You turn and run blindly into the woods. Your heart races as you run through the completely unfamiliar landscape. You hear your breathing, harsh in the stillness of the woods. FInally you slow, looking around you. You don’t think you could even find your way back to the clearing.
The trees are think around you and the light is dim. There isn’t a lot of brush or bushes, the trees stand starkly straight from the moist earth. You hear footsteps and you turn to see the old man from the clearing before you.
*if listenedsamuel = true
*if samuel = true
Samuel
*if samuel = false
The old man
looks at you with pity in his eyes. “Follow me back to the clearing, please.” You look around at the trackless woods and sigh. “Lead on,” you say feeling suddenly worn out. You are silent as you follow him back to the clearing.
*goto clearing1
*if listenedsamuel = false
You look at the old man, feeling confused and dismayed. He stands silently, looking at you with some pity in his eyes. “Please, come with me, back to the clearing. We can talk more there.” You nod slowly, feeling tired and overwhelmed. You follow the old man back to the clearing, marveling that he can find his way back so easily. In a short time, you find your way back to the clearing in the woods.
*goto listen
Oh for heaven’s sake, it still didn’t come in! Let me try typing it out instead of pasting it in.
*label woods
[text]
*if listenedsamuel = true
*if samuel = true
Samuel
*if samuel = false
The old man
[text]
*goto clearing1
*if listenedsamuel = false
[text]
*goto listen
I hope that's better! Thank you all again!
It’s actually a section after this one that pops the error. It seems to be trying to skip this one entirely You get to it like this:
*choice
#Walk over to the stones
*goto stones
#Run away!
*goto woods
#Go to Velneth
*goto velneth
I fixed it! I thought something had to be wrong with this section since it was getting skipped, but I was wrong. Thank you all for your help (and patience, lol)