Blank and incorrect passages showing

You make your way to school.
*page_break
*gosub event
*stat_chart
 text event

*if ((event = 1) and (event1 = false))
 You notice a commotion across the street, it seems like a girl is running away from the bakery with... a key? A quick scan of her clothes reveals to you that she wasn't poor, matter of fact she was well off. Maybe you'll see her at school.
 *set aime true
 *set event1 true
 *goto schoolhouse
*else
 *gosub event

*if ((event = 2) and (event2 = false))
 You hear yelling across the street and you look up to see a androgynous figure yelling at what appears to be their boyfriend, you walk closer to listen."How do you expect me to pay for anything with only 1000 measly dollars". How spoilt are they? You wish you had 1000 dollars. Maybe you'll see them at school.
 *set tiffany true
 *set event2 true
 *goto schoolhouse
*else
 *gosub event

*if ((event = 3) and (event3 = false))
 "Hey sexy lady, what can a fine man like myself do to get a beautiful woman like you in my apartment". You turn around to see a boy not even in his 20's flirting with a woman twice his senior. A quick scan tells you that he's just as broke as you are. Maybe you'll see him around.
 *set matt true
 *set event3 true
 *goto schoolhouse
*else
 *gosub event

*if ((event = 4) and (event4 = false))
 Oooh a 20 dollar bill that might come in handy
 *set money +20
 *set event4 true
 *goto schoolhouse
*else
 *gosub event

*if ((event = 5) and (event5 = false))
 You look up and notice a flyer, it says: [i]Looking for a job? Johnny John's is the place to be 2/hr.[/i] Maybe you should check it out.[b] You can now work at JJ's [/b]
 *set job true
 *set event5 true
 *goto schoolhouse
*else
 *gosub event

*if ((event = 6) and (event6 = false))
 Hmm... what this, a prescription, I should go to 24-mart to [b]exchange this for something[/b]
 *set bill true
 *set event6 true
 *goto schoolhouse
*else
 *gosub event

*if ((event = 7) and (event7 = false))
 Nothing interesting happens
 *set event7 true
 *goto schoolhouse
*else
 *gosub event

The text above are different events happening as you walked to school and if an event happens 1 time it shouldn’t happen again hence it going back to gosub event if the requirements aren’t met. The problem is that when it rolls a event twice the passage shows up blank and sometimes the event it rolls doesn’t match the number it rolled. (I tracked it by putting the *stat_chart text event)

*label event
*rand event 1 7
*return

I recommend using *elseif and *else instead of several *if's. This will allow only one passage to display at any given time.

*if ((event = 1) and (event1 = false))
 You notice a commotion across the street, it seems like a girl is running away from the bakery with... a key? A quick scan of her clothes reveals to you that she wasn't poor, matter of fact she was well off. Maybe you'll see her at school.
 *set aime true
 *set event1 true
 *goto schoolhouse
*elseif ((event = 2) and (event2 = false))
 You hear yelling across the street and you look up to see a androgynous figure yelling at what appears to be their boyfriend, you walk closer to listen."How do you expect me to pay for anything with only 1000 measly dollars". How spoilt are they? You wish you had 1000 dollars. Maybe you'll see them at school.
 *set tiffany true
 *set event2 true
 *goto schoolhouse
*elseif ((event = 3) and (event3 = false))
 "Hey sexy lady, what can a fine man like myself do to get a beautiful woman like you in my apartment". You turn around to see a boy not even in his 20's flirting with a woman twice his senior. A quick scan tells you that he's just as broke as you are. Maybe you'll see him around.
 *set matt true
 *set event3 true
 *goto schoolhouse
*elseif ((event = 4) and (event4 = false))
 Oooh a 20 dollar bill that might come in handy
 *set money +20
 *set event4 true
 *goto schoolhouse
*elseif ((event = 5) and (event5 = false))
 You look up and notice a flyer, it says: [i]Looking for a job? Johnny John's is the place to be 2/hr.[/i] Maybe you should check it out.[b] You can now work at JJ's [/b]
 *set job true
 *set event5 true
 *goto schoolhouse
*elseif ((event = 6) and (event6 = false))
 Hmm... what this, a prescription, I should go to 24-mart to [b]exchange this for something[/b]
 *set bill true
 *set event6 true
 *goto schoolhouse
*elseif ((event = 7) and (event7 = false))
 Nothing interesting happens
 *set event7 true
 *goto schoolhouse
*else
 *gosub event

The way your code was written, it was gosubbing to the event label every time it loaded a passage, and the event label was rolling the event again and then returning to the previous position, which meant passages would get loaded every single time it hit that gosub, which was every single time it checked for an event.

1 Like

I did what you said and it works aside from event 4 which never shows up

It never shows up? Or the random roll didn’t roll a 4 when you tested it? You’re dealing with random number generation - there’s no guarantee any specific number will ever occur. It may also be an issue with code outside of what you’ve shown here.

Ok I put the stat_chart text event back in and like last time every time it rolls the same number twice it shows up blank. The only problem fixed is that it shows the correct event when it’s supposed to the first time it’s rolled.

How is it rolling the same number twice? Are you modifying the event variable in other locations?

No events only happen as you walk to school.

I see what the issue is. You have a gosub to the event label twice in the code snippet you provided, once at the beginning and once at the end if none of the events occur. The reason you might be running into issues is because the second gosub is returning to the same page that has your event commands on it. The way your code is working now, it runs the event gosub, sets an event, tries to load an event, finds out that none of them are available, reloads the event gosub, and then returns and loads an event again. Long story short, you need to get rid of one of those gosubs.

1 Like

Also if *else is hit, game will march on forward. You need a goto after that gosub.

1 Like

What it’s supposed to do is roll an event and if that event already happened re-roll and if the requirements are met go to school house there are only 7 days in game so there should be a chance for all events to happen which why the else is only supposed to happen if the requirements aren’t met.

So it seems like instead you need to either wrap a gosub in another *if check:

*if event != 0
  *gosub event

or use different variables. But I’m not really sure how to acheive that with what’s been given - that’s something you’ll have to figure out.

I think what I’m gonna do is put all the events under different labels and see if that works. If not I’m just gonna give up on that idea and just put them on separate days

1 Like

Hey putting it under different labels worked and what you said sorta gave me the idea so thankyou.

Edit: I realised I didn’t really explain how I got this basically it was something like this.

*label qwerty

*rand event 1 7
*if (event = 1)
 *goto e1
*if (event = 2)
 *goto e2
*if (event = 3)
 *goto e3
*if (event = 4)
 *goto e4
*if (event = 5)
 *goto e5
*if (event = 6)
 *goto e6
*if (event = 7)
 *goto e7
*return

*if (event = 7)
 [...Text]
*else
 *gosub qwerty

*label e1
*if (event = 1)
 [...Text]
*else
 *gosub qwerty

*label e2
*if (event = 2)
 [...Text]
*else
 *gosub qwerty

*label e3
*if (event = 3)
 [...Text]
*else
 *gosub qwerty

*label e4
*if (event = 4)
 [...Text]
*else
 *gosub qwerty

*label e5
*if (event = 5)
 [...Text]
*else
 *gosub qwerty

*label e6
*if (event = 6)
 [...Text]
*else
 *gosub qwerty

*label e7
*if (event = 7)
 [...Text]
*else
 *gosub qwerty

And since there was only seven days in the game the whole thing played out perfectly and showed the correct passages.

Before was sort of like this but without the labels while I still don’t know how the former didn’t work adding labels seemed to fix the issue.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.