Randomtest: Visited this line too many times

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 If else, and not If If

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.

1 Like

The if/if is a revision from my original if/else that had the same error. I’ll try it/elseif next.

This snippet shows the only 5 instances of “luvia_answer_two” in the file.

If elseif is only used when you have 3 or more conditions, otherwise it’s just if else.

I think the problem is somewhere else, and not in the snippet you showed here.

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.

I’ll swap it back to if/else.

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.

1 Like

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.

Onto the next issue.

Thanks!

3 Likes