I’m reviving some old code from many years ago. The code used to work fine, but now it’s loading indefinitely as if caught in a loop.
At a guess, I think it might have something to do with the *if statements used and a change to the way choicescript works. Can anyone shed any light on what could be causing this?
The problem:
In one scene, you are given a choice. If you choose to visit the puzzler, you are taken to a different scene with a *goto_scene command.
The next scene starts with a *rand command, then a *set command. Next, are a large sequence of *if commands.
*rand winning_cigs 4 15
*set puzzle_attempts +1
*if puzzle =1
*set puzzle +25
"Alright everyone, listen up. I'll give you some letters. You need to reorder them and give me one word. First to answer gets the cigarettes."
*line_break
*line_break
"N E S S R G O T T"
*line_break
*line_break
You quickly rearrange the letters and come up with the word:
*input_text puzzle1
*if puzzle1 = "Strongest"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*set cigarettes + winning_cigs
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
*if puzzle1 = "STRONGEST"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
*if puzzle1 = "strongest"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
"Sorry, that's not right." Says the puzzler.
*line_break
*line_break
"What about Strongest?" Shouts a ${man} at the back.
*line_break
*line_break
"Nicely done!" Says the puzzler with a smile. Oh well, you didn't win this time.
Soon after, the klaxon sounds and all the prisoners file out of the yard.
*goto_scene 18cell
*if puzzle =2
*set puzzle +25
"Alright everyone, listen up. I'll give you some letters. You need to reorder them and give me one word. First to answer gets the cigarettes."
*line_break
*line_break
"C U P S I N I O S"
*line_break
*line_break
You quickly rearrange the letters and come up with the word:
*input_text puzzle1
*if puzzle1 = "Suspicion"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*set cigarettes + winning_cigs
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
*if puzzle1 = "SUSPICION"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
*if puzzle1 = "suspicion"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
"Sorry, that's not right." Says the puzzler.
*line_break
*line_break
"What about Suspicion?" Shouts a ${man} at the back.
*line_break
*line_break
"Nicely done!" Says the puzzler with a smile. Oh well, you didn't win this time.
Soon after, the klaxon sounds and all the prisoners file out of the yard.
*goto_scene 18cell
*if puzzle =3
*set puzzle +25
"Alright everyone, listen up. I'll give you some letters. You need to reorder them and give me one word. First to answer gets the cigarettes."
*line_break
*line_break
"H A S E L D O O F"
*line_break
*line_break
You quickly rearrange the letters and come up with the word:
*input_text puzzle1
*if puzzle1 = "Falsehood"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*set cigarettes + winning_cigs
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
*if puzzle1 = "FALSEHOOD"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
*if puzzle1 = "falsehood"
*set puzzle_wins +1
"Nicely done!" Says the puzzler. "The cigarettes are yours." $!{He} hands you ${winning_cigs} cigarettes which you pocket quickly.
*line_break
*line_break
"Everyone else, better luck tomorrow!"
Soon after, the klaxon sounds and everyone files out of the yard.
*goto_scene 18cell
"Sorry, that's not right." Says the puzzler.
*line_break
*line_break
"What about Falsehood?" Shouts a ${man} at the back.
*line_break
*line_break
"Nicely done!" Says the puzzler with a smile. Oh well, you didn't win this time.
Soon after, the klaxon sounds and all the prisoners file out of the yard.
*goto_scene 18cell
This carries on for 75 puzzles, then the 76th ends the sequence.
*if puzzle = 76
*set puzzleaway false
"Alright, time for today's question. It's another tough one. I'm gonna say some numbers. You need to tell me what number comes next in the sequence. First to get it right gets the cigs."
*line_break
*line_break
"6, 5..."
*line_break
*line_break
"Ah this is ridiculous!" Shouts an irate prisoner.
*line_break
*line_break
"Wait, just listen to the question first." Says the puzzler, smiling.
*line_break
*line_break
"It better make sense!" Comes a reply.
*line_break
*line_break
"So the numbers are 6, 5, 6, 5, 6, 3, 3..."
*line_break
*line_break
"This is a con." Says another. The puzzler tries to calm the other prisoners, but the complaints grow louder. Someone pushes the puzzler towards
you. Before you can react, another prisoner pushes ${him} away. A laughter full of malice breaks out among the prisoners and you catch the look
of consternation on the clever ${man}'s face as ${he} is pushed around. Other prisoners move to the area, sensing the bloodsport in action and you find
yourself being hustled in the small space. A loose elbow catches your cheek, drawing blood and forcing you to look away from the centre.
*page_break Wipe the blood away
Once composed, you look back to see the blooded face of the puzzler. $!{his} fears have become real and ${his} usual smug attitude has vanished. A fist
comes from ${his} right, drawing more blood and forcing you to wince, partly out of empathy and partly from your own real pain. $!{his} eyes lock with yours
and he speaks over the din.
*line_break
*line_break
"J-Jingle Bells..."
*line_break
*line_break
It's the last thing ${he} says as the next blow to ${his} head knocks him to the floor. With the kicks to follow, it is hard to say who killed the
puzzler, but when the guards finally break up the fight they find ${his} limp body bereft of life.
*line_break
*line_break
"Who was that?" Asks the prisoner next to you as the guards carry the body away. It's then that you realise you have no idea what this ${man}s name was.
How do you feel about all that has happened?
*fake_choice
#Distraught. $!{He} wasn't doing any harm to anyone.
$!{he} was a clever ${man}, and ${his} intelligence cost ${him} ${his} life.
#Sad. There will be no more puzzles.
With the puzzler gone and no smart person foolish enough to replace ${him}, it seems there will be no more puzzles.
#Indifferent. $!{he} was annoying but I enjoyed the puzzles.
While the puzzles were a nice distraction within the prison, you didn't really know the ${man} and can't say you will miss ${him}.
#Chuffed to bits. The ${man} asked for it with ${his} cocky attitude.
It feels good to know that you won't have to listen to that smug fool again. $!{His} puzzles were ridiculous and you take pleasure in ${his} demise.
At the sound of the klaxon, earlier than normal, you leave the yard.
*goto_scene 18cell
That’s it. For some reason, when the scene is called to load, it doesn’t work. No error is given, the scene just loads indefinitely. This code used to work fine.
I tried adding
*else
*goto_scene 18cell
to the end, hoping that was the issue (no closure after an *if statement, even though it’s not needed) but that didn’t make a difference.