So in short, I decided to make a random event generator for my game which involves random dreams. And then after awhile it started to cycle through events and go to on the lycan-quiz and it keeps crashing every time I load a dream:
*if (status = "asleep")
*rand selector 1 12
*if (selector = 1)
*gosub pleasant_dream
*elseif (selector = 2)
*gosub scary_dream
*elseif (selector = 3)
*gosub good_nightmare
*elseif (selector = 4)
*gosub werewolf_nightmare
*elseif (selector = 5)
*gosub voices1
*elseif (selector = 6)
*gosub random_dream
*elseif (selector = 7)
*gosub olapen_visit
*elseif (selector = 8)
*gosub misako_visit
*elseif (selector = 9)
*gosub candy_heaven
*elseif (selector = 10)
*gosub voices2
*elseif (selector = 11)
*gosub gabriel_visit
*elseif (selector = 12)
*gosub voices3
*return
*label pleasant_dream
You dream of something that was very nice indeed. You are near a river which is filled to the brim with fishes of all kinds
*fake_choice
*if (hp < 50) #Drink from the river
You drink from the river and it tastes of molten silver
*set hp + 50
*set accessory "silver flask"
*if (Myano_present = true) #Watch Myano eat a mouse
You watch Myano gleefully chase a mouse through the reedy bulrushes.
*set myano_friendship + 1
*if (species = "werewolf") #Howl at the silver moon
You give a mournful howl at the light of the silvery moon. It soothes you and makes you feel at home, like an old friend of yours.
#Enjoy the moonlight river
You enjoy the moonlight
*set eccentric + 2
*page_break Leave the river
*line_break
*set status "awake"
*return
*label scary_dream
You dream of something that was very scary indeed. You are in an endless forest which is misty and long.
*fake_choice
*if (species = "bakeneko") # You watch a scary black dog approch you
Suddenly a giant Grim approaches you, its black shaggy fur mottled with grey as its jowls drip drool. It longs for cat-meat.
*set hp - 13
*set accessory &" a Grim reminder"
*if (species = "werewolf") #A giant cat hisses at you
You watch a giant version Myano morph into a giant cat.
*set myano_friendship - 10
*set accessory &"giant hairball"
*if (species = "vampire") #A vampire hunter in the night
You are pursued by a vampire huntress through the woods.
*set hp - 15
*set accessory &" garlic necklace"
#Walk through the forest
*set hp - 40
*page_break Leave the river
*line_break
*set status "awake"
*return
*label good_nightmare
You dream of something that was weird. You are being chased by a shrouded figure called Death as it glides through the air
*fake_choice
*if (species = "bakeneko") #You toss a hair-ball
Suddenly you thought of something and toss a hair-ball at Death. It shatters his hour-glass
*set hp - 13
*set accessory &" Death's shattered hourglass"
*if (species = "werewolf") #Death is a cat
You watch as Death morphs into a giant cat-lady. You bark at it
*set myano_friendship - 5
*if (species = "vampire") #Death turns into a garlic monster
You are pursued by Death who had now transformed into your worst nightmare, a garlic monster. You bite the garlic.
*set eccentric + 5
#Play chess with Death
You howl
*page_break Death departs...
*line_break
*set status "awake"
*return
*label werewolf_nightmare
You dream that you are transforming into a giant dog…
*fake_choice
*if (species = "bakeneko") #You are terrified
You are terrified as you transform into a giant were-dog. You hurt yourself in confusion
*set hp - 10
*set accessory &" shattered mirror,"
*if (species = "werewolf") #You are fine with it
You shrug. Eh, you are already fine with being a werewolf
*set feral + 5
*if (species = "vampire") #Hiss!
You sulk at the mirror, not funny.
*set eccentric + 5
#Howl at the moon
You howl
*page_break You shatter the mirror...
*line_break
*set status "awake"
*return
*label voices1
You hear a voice that cries out for you, "Save us from our doom…", "Who will save us from our despair?!"
*page_break You scream...
*line_break
*set status "awake"
*return
*label random_dream
You dream that your teeth are falling-out…
*fake_choice
*if (species = "bakeneko") #You shrug
You are a cat? Why should you care about it?
*set hp - 10
*set accessory &" human dentures"
*if (species = "werewolf") #You are fine with it
You shrug. Eh, you are already fine with losing your fangs
*set feral + 5
*set accessory &" werewolf dentures"
*if (species = "vampire") #Hiss!
You sulk at the mirror, not funny.
*set eccentric + 5
#You panic
*set eccentric - 5
*page_break You eat a jawbreaker...
*line_break
*set status "awake"
*return
*label olapen_visit
You are in a nicely furnished room with a heart-shaped bed…
*if (Olapen_present = true)
Olapen is in the bed too! "Yatta!"
*fake_choice
*if (Olapen_present = false) #Spend a lonely night by yourself
You sob uncontrollably through the entire night
*set accessory &" bottle of tears,"
*set olapen_friendship - 5
*if (Olapen_present = true) #Talk to Olapen
You talk to Olapen all through the night
*set olapen_friendship + 5
*page_break You eat a jawbreaker...
*line_break
*set status "awake"
*return
*label misako_visit
You are in a nicely furnished room with a heart-shaped bed
*if (Misako_present = true)
Misako glares at you.
*fake_choice
*if (Misako_present = false) #Spend a lonely night by yourself
You sob uncontrollably through the entire night
*set accessory &" empty chair,"
*set misako_friendship - 4
*if (Misako_present = true) #Talk to Misako
You talk to Misako all through the night
*set misako_friendship + 5
*page_break You awaken...
*line_break
*set status "awake"
*return
*label candy_heaven
You dream that you surrounded by candy…
*fake_choice
*if (species = "bakeneko") #You dislike candy
You yowl in confusion
*set hp - 5
*set accessory &" broken lollipop,"
*if (species = "werewolf") #You wolf down as much candy as possible
You pant happily as you gobble up all the candy, until your gut is bulging.
*set feral + 5
*if (species = "vampire") #Hiss!
You break your jaw on a jawbreaker candy that tastes of raspberry
*set eccentric + 5
#You enjoy the candy
You consume half the candy.
*set eccentric + 5
*page_break You enjoyed that dream...
*line_break
*set status "awake"
*return
*label voices2
You hear a voice that cries out for you, "You are our only hope…"
*page_break You scream...
*line_break
*set status "awake"
*return
*label gabriel_visit
You are in a nicely furnished room.
*if (Misako_present = true)
Misako glares at you.
*fake_choice
*if (Misako_present = false) #Spend a lonely night by yourself
You sob uncontrollably through the entire night
*set accessory &" empty chair,"
*set misako_friendship - 4
*if (Misako_present = true) #Talk to Misako
You talk to Misako all through the night
*set misako_friendship + 5
*page_break You awaken...
*line_break
*set status "awake"
*return
*label voices3
You hear a voice that cries out for you, "You are the walrus…"
*page_break Goo goo...
*line_break
*set status "awake"
*return```
And here is the Dorm file that preceded it:
```*label sleep
What do you want to do?
*choice
#Sleep on the bed
You sleep on the bed and regain your health.
*set sanity + 10
*set hp 100
*set status "asleep"
[i]You start to dream…[/i]
*page_break
*gosub_scene random_voices
*selectable_if (status = "asleep") #Awaken from the dream
You awaken from the dream!
*set status "awake"
*selectable_if (species = "Dragonoid") #Guard your gold hoard!
You guard your gold hoard and count your gold... "[b]Mine![/b]" you ${sound} at the other students.
*set feral + 50
*set health 100
*goto dorms
#Resume your duties
You go back to the dorms
*goto dorms```
I feel like I'm a constant Groundhog's Day Loop.
In the snippet you posted, I see that you’re using indentation level inconsistently. Some are 2 spaces, others are 4, and the *gosub themselves are 8.
Perhaps that’s not the case, but it’s always useful if you also posted the error message that comes out in things like this so we can pinpoint what’s exactly happened.
Sometimes your tabs are 2, sometimes they are 4, and sometimes they are 8. This is kinda sorta like RANDomLY SWITCHing the volume of your vooooOOOOOOOOOOICE and exPECTing TO commuNIcate
EFFECTIVELY
It doesn’t really work. Make sure your tabs are consistent.
The error I’m having is that it goes through the dream sequence but then automatically goes to the lycan quiz, even if your MC is not a lycan… It didn’t do that until I added the *return function above the pleasant_dreams code. All I want after the dream ends is for it to return to the sleep menu.
Considering your whole set up, I think it’s wise to add *goto sleep just below the #Resume your duties, at the most primary indent level. Since you used *gosub instead of *goto, nothing will catch the code that flows after the sleep choice.
Otherwise, you can replace most of your gosubs into gotos.
Edit: There’s your edited version of the code on my next comment.
Did you fixed it? Have you tried one of my suggestions?
ICF is irrelevant, here.
What do you want to do?
*choice
#Sleep on the bed
You sleep on the bed and regain your health.
*set sanity + 10
*set hp 100
*set status "asleep"
[i]You start to dream…[/i]
*page_break
*gosub_scene random_voices
*selectable_if (status = "asleep") #Awaken from the dream
You awaken from the dream!
*set status "awake"
*selectable_if (species = "Dragonoid") #Guard your gold hoard!
You guard your gold hoard and count your gold... "[b]Mine![/b]" you ${sound} at the other students.
*set feral + 50
*set health 100
*goto dorms
#Resume your duties
You go back to the dorms
*goto dorms
*goto sleep <<<
Otherwise, swap all of the *return in your individual dream sequences with relevant *goto sleep.
I made a mistake by mentioning “swap gosub to goto.”
*if (status = "asleep")
*rand selector 1 12
*if (selector = 1)
*goto pleasant_dream
*elseif (selector = 2)
*goto scary_dream
*elseif (selector = 3)
*goto good_nightmare
*elseif (selector = 4)
*goto werewolf_nightmare
*elseif (selector = 5)
*goto voices1
*elseif (selector = 6)
*goto random_dream
*elseif (selector = 7)
*goto olapen_visit
*elseif (selector = 8)
*goto misako_visit
*elseif (selector = 9)
*goto candy_heaven
*elseif (selector = 10)
*goto voices2
*elseif (selector = 11)
*goto gabriel_visit
*elseif (selector = 12)
*goto voices3
*else
*bug status is not "asleep"
*label pleasant_dream
You dream of something that was very nice indeed. You are near a river which is filled to the brim with fishes of all kinds
*fake_choice
*if (hp < 50) #Drink from the river
You drink from the river and it tastes of molten silver
*set hp + 50
*set accessory "silver flask"
*if (Myano_present = true) #Watch Myano eat a mouse
You watch Myano gleefully chase a mouse through the reedy bulrushes.
*set myano_friendship + 1
*if (species = "werewolf") #Howl at the silver moon
You give a mournful howl at the light of the silvery moon. It soothes you and makes you feel at home, like an old friend of yours.
#Enjoy the moonlight river
You enjoy the moonlight
*set eccentric + 2
*page_break Leave the river
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label scary_dream
You dream of something that was very scary indeed. You are in an endless forest which is misty and long.
*fake_choice
*if (species = "bakeneko") # You watch a scary black dog approch you
Suddenly a giant Grim approaches you, its black shaggy fur mottled with grey as its jowls drip drool. It longs for cat-meat.
*set hp - 13
*set accessory &" a Grim reminder"
*if (species = "werewolf") #A giant cat hisses at you
You watch a giant version Myano morph into a giant cat.
*set myano_friendship - 10
*set accessory &"giant hairball"
*if (species = "vampire") #A vampire hunter in the night
You are pursued by a vampire huntress through the woods.
*set hp - 15
*set accessory &" garlic necklace"
#Walk through the forest
*set hp - 40
*page_break Leave the river
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label good_nightmare
You dream of something that was weird. You are being chased by a shrouded figure called Death as it glides through the air
*fake_choice
*if (species = "bakeneko") #You toss a hair-ball
Suddenly you thought of something and toss a hair-ball at Death. It shatters his hour-glass
*set hp - 13
*set accessory &" Death's shattered hourglass"
*if (species = "werewolf") #Death is a cat
You watch as Death morphs into a giant cat-lady. You bark at it
*set myano_friendship - 5
*if (species = "vampire") #Death turns into a garlic monster
You are pursued by Death who had now transformed into your worst nightmare, a garlic monster. You bite the garlic.
*set eccentric + 5
#Play chess with Death
You howl
*page_break Death departs...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label werewolf_nightmare
You dream that you are transforming into a giant dog…
*fake_choice
*if (species = "bakeneko") #You are terrified
You are terrified as you transform into a giant were-dog. You hurt yourself in confusion
*set hp - 10
*set accessory &" shattered mirror,"
*if (species = "werewolf") #You are fine with it
You shrug. Eh, you are already fine with being a werewolf
*set feral + 5
*if (species = "vampire") #Hiss!
You sulk at the mirror, not funny.
*set eccentric + 5
#Howl at the moon
You howl
*page_break You shatter the mirror...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label voices1
You hear a voice that cries out for you, "Save us from our doom…", "Who will save us from our despair?!"
*page_break You scream...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label random_dream
You dream that your teeth are falling-out…
*fake_choice
*if (species = "bakeneko") #You shrug
You are a cat? Why should you care about it?
*set hp - 10
*set accessory &" human dentures"
*if (species = "werewolf") #You are fine with it
You shrug. Eh, you are already fine with losing your fangs
*set feral + 5
*set accessory &" werewolf dentures"
*if (species = "vampire") #Hiss!
You sulk at the mirror, not funny.
*set eccentric + 5
#You panic
*set eccentric - 5
*page_break You eat a jawbreaker...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label olapen_visit
You are in a nicely furnished room with a heart-shaped bed…
*if (Olapen_present = true)
Olapen is in the bed too! "Yatta!"
*fake_choice
*if (Olapen_present = false) #Spend a lonely night by yourself
You sob uncontrollably through the entire night
*set accessory &" bottle of tears,"
*set olapen_friendship - 5
*if (Olapen_present = true) #Talk to Olapen
You talk to Olapen all through the night
*set olapen_friendship + 5
*page_break You eat a jawbreaker...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label misako_visit
You are in a nicely furnished room with a heart-shaped bed
*if (Misako_present = true)
Misako glares at you.
*fake_choice
*if (Misako_present = false) #Spend a lonely night by yourself
You sob uncontrollably through the entire night
*set accessory &" empty chair,"
*set misako_friendship - 4
*if (Misako_present = true) #Talk to Misako
You talk to Misako all through the night
*set misako_friendship + 5
*page_break You awaken...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label candy_heaven
You dream that you surrounded by candy…
*fake_choice
*if (species = "bakeneko") #You dislike candy
You yowl in confusion
*set hp - 5
*set accessory &" broken lollipop,"
*if (species = "werewolf") #You wolf down as much candy as possible
You pant happily as you gobble up all the candy, until your gut is bulging.
*set feral + 5
*if (species = "vampire") #Hiss!
You break your jaw on a jawbreaker candy that tastes of raspberry
*set eccentric + 5
#You enjoy the candy
You consume half the candy.
*set eccentric + 5
*page_break You enjoyed that dream...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label voices2
You hear a voice that cries out for you, "You are our only hope…"
*page_break You scream...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label gabriel_visit
You are in a nicely furnished room.
*if (Misako_present = true)
Misako glares at you.
*fake_choice
*if (Misako_present = false) #Spend a lonely night by yourself
You sob uncontrollably through the entire night
*set accessory &" empty chair,"
*set misako_friendship - 4
*if (Misako_present = true) #Talk to Misako
You talk to Misako all through the night
*set misako_friendship + 5
*page_break You awaken...
*line_break
*set status "awake"
*goto_scene Dorm sleep
*label voices3
You hear a voice that cries out for you, "You are the walrus…"
*page_break Goo goo...
*line_break
*set status "awake"
*goto_scene Dorm sleep
The Dorm file that preceded it:
*label sleep
What do you want to do?
*choice
#Sleep on the bed
You sleep on the bed and regain your health.
*set sanity + 10
*set hp 100
*set status "asleep"
[i]You start to dream…[/i]
*page_break
*goto_scene random_voices
*selectable_if (status = "asleep") #Awaken from the dream
You awaken from the dream!
*set status "awake"
*selectable_if (species = "Dragonoid") #Guard your gold hoard!
You guard your gold hoard and count your gold... "[b]Mine![/b]" you ${sound} at the other students.
*set feral + 50
*set health 100
*goto dorms
#Resume your duties
You go back to the dorms
*goto dorms
“Dorm” is a name of a .txt scene. “Sleep” is a name of a label in that scene. Goto_scene, unlike standard goto sends you to a label in a separate scene.