Scripting not working after 3rd chapter

Hello! I’ve been delving into this engine and ran into a somewhat unexpected bug (that doesn’t seem to be a caught error). Basically, the scene files after the first one are not accessing their scripts, and this happens both in Firefox and on a web host.

‘Not accessing their scripts’ includes paragraph breaks, and the finish command itself according to randomtest, but italicizing works fine. They work fine when I plug the code into the second scene file (the one immediately after startup).

The results look like this:
Instinctively you scan the sky for clouds, finding only a few wisps of smoke, and not the heavy masses of waiting rain that tend to produce such sounds. Glancing around you, some in the street pause in confusion while others take their cue to race towards—or away from somewhere. A second crack shakes the buildings and rattles dust, and part of the wooden walls of the city splinters, falling pieces swiftly driving you into the ‘away from somewhere’ group. Your heart pounds rapidly as the situation pieces itself together in your mind, conclusions feeling deliberate and slow against the backdrop of the adrenaline surge. Not thunder, but cannons, firing on the city walls. From a direction you associate with the smell of salt and dead fish, when the wind blows from it. Pirates are raiding your home. *choice #Hide. …You hide within the city. (under development) *finish #Join those defending the city by land. …You defend the city by land. (under development) *finish #Join those firing cannons back at the pirates. … You join those firing cannons at the pirates. (under development) *finish

My startup code looks like this:

Summary
*title My First ChoiceScript Game
*author Anonymous
*scene_list
  startup
  bloodmagic
  pirates
  aftermath
  neighbors

*create blood "unknown"
*create gender "unknown"
*create profession "unknown"
*create name "unknown"

*create valor 50
*create generosity 50

And the second scene’s code is as follows:

A faint, metallic scent imposes itself on your nostrils a bare moment after the prick of pain.
Carefully - ever so careful with extracting precisely the amount he needs, not so careful to be kind on your skin - the alchemist draws forth your blood, letting it drip into a translucent glass vial, showing bright colors with the exposure to air. Within the glass, your blood settles and swirls with each drop, hue an intense ...

*choice
  #yellow.
    *set blood "yellow"
    
    The vivid yellow hue of your peoples' blood is an enigma to alchemists.
    Reduced down to its component metal, it is silvery, dense, and melts over even a candle-flame.
    This blood is highly poisonous, and those who bear it have brightly colored markings to indicate it.
    In the tropics, this takes the form of highly pigmented skin in bold swathes of bright hue.
    In darker climates, light shines off the blood itself through fairer skin:
    bearing a glowing chartreuse blush where it flows healthfully, dark gray bruises where not.
    
    Those with this blood resist disease and parasites, and thrive in dangerous but food-rich areas such as swamps.
    Your people grow to adulthood extremely swiftly, but favor conditions toxic to others and slightly uncommon.
    
    You are a boglin, a small humanoid with webbed feet and hands, the pads of which grip surfaces at your willing. Your body is built for climbing and swimming more than running. You have large, bright and expressive eyes. Your small, pointed ears demonstrate the flexibility to close entirely underwater, or when you'd rather not listen to something.
    
    There are many normal, innocuous ways in which an alchemist could use your poisonous blood.
    The other possibilities are unpleasant to consider, but he paid you well against the market rate, and coin is coin. Something you are in need of at the moment ...
    *goto savings
  #black.
    *set blood "black"
    
    Silver blood is well known to alchemists, predicted before the blood itself could be analyzed.
    There is a distinct bluish-grey tint to the skin of those peoples who bear the black blood of silver,
    resembling strongly the symptoms of long-term silver exposure in those not as naturally adapted to it.
    
    Your people thrive best in sunny regions.
    Their cheeks darken black with blush, and unhealthy blood tends to blanch the area a pale blue.
    They grow to adulthood swiftly, but regions with the nutrients for them to thrive are rare.
    
    You are a shade, a slender humanoid, with broad, batlike ears that swivel with your emotions and help to keep you cool. Though frail and easily winded, your species holds the greatest skill with and reliance on their innate magic.
    
    It is difficult to extract a usable amount of your blood without harming you, but the magic affinity it displays is highly valued by alchemists. It is a truly paltry amount in the vial, and even so you find yourself shivering ... the coin is good, though. Not quite market rate, but few alchemists are willing to pay that on an unknown, and you needed some currency more immediately ...
    *goto savings
  #blue.
    *set blood "blue"
    
    Appearing in some animals even without the influence of magic, copper blood is the second most common in
    the mana-altered peoples of this land. Skin color influenced by it ranges from soft lavenders to a vivid, dark violet; blushing colors these with a soft blue glow.
    
    Your people have relative ease breathing in colder or higher-altitude climates.
    They grow to adulthood swiftly, but require modestly uncommon nutrients to thrive.
    
    You are a dvergar, a stocky humanoid blessed with a fair amount of luxurious hair and body hair alike. While your species is the second most adept with magic, they do not rely on magic alone, but demonstrate both raw strength and talent for focus. It takes hearty meals to fuel you, but once you set your mind to a task, you are difficult to stop.
    
    Your blood holds a magical affinity and you have plenty of it to spare, if fed well. Second best to black blood for the purpose, but you can produce far more than any shade, and the alchemist provides a complimentary meal for the trouble - a hearty stew, not the richest fare but far from the worst. You admire the filled vial and pocket a decent number of coins for your troubles, mentally adding them to your savings ...
    *goto savings
  #red.
    *set blood "red"
    
    Iron-based blood is well known to alchemists for its unique properties and workable nature.
    It is the most common in people and animals alike, and perhaps the most familiar, being the ancestral hue of human blood.
    Iron blood provides general benefits to respiration, which aids stamina anywhere.
    
    Your people thrive in open spaces.
    They grow to adulthood at a human speed, and can find the nutrients they need most anywhere.
    
    You are a human, though altered by mana from your ancestral roots. Your highly tuned sense of navigation compliments an innate magic resistance, and very little of your mana reserve 'leaks' over time, conserving energy and a degree of stealth in the psychic landscape. You are not always able to win a sprint against other species - but you will, without fail, win a marathon.
    
    Though your blood is common, it has many unique applications. The alchemist draws what he can fairly greedily, and your desire for coin is such that you hesitate to discourage it. Feeling faint afterwards, you spend a small part of your earnings on beef to wolf down, inwardly lamenting the loss from what you earned ... 
    *goto savings
  #white.
    *set blood "white"
    
    Exactly what metal oxides render this blood white are beyond the capabilities of most alchemists to determine.
    Reflective layers in your skin and eyes guard against sun and catch moonlight, but lend a wraithlike gleam at night.
    Your species' skin tones range from a gleaming, bluish-white pallor in the coldest climes to raw umber in the tropics,
    climbing through varied cool tones of brown.
    
    Your folk have a quickness of reflex and light-sensitive eyes. They are largely nocturnal, and thrive in arboreal regions.
    They grow to adulthood quite slowly, but the minerals they depend on are extremely common.
    
    You are a star elf, a tall and lithe humanoid with traces of feline, hands and feet equipped with short, sharp claws. Long, tapered ears catch the sounds of the night, and a slender, prehensile tail aids you in climbing. It is covered in soft, short hair, pleasant to the touch. Though not built for prolonged exertion, you are acrobatic and highly resilient.
    
    Alchemical uses for your blood are rarer than other parts of you, and you decline a scratching post a few times over the course of your visit. It would be extra money, yes, but you have no desire to sell your claws (or their dust) right now; and you are patient - something which elves, more than other species, can afford. This is merely the most recent alchemist, and though white blood does not fetch the best price, over time the benefits add up.
    *goto savings
    
*label savings
*page_break
Over the past few months ... or years ... you've been saving your coin towards a particular goal. 
What you plan to spend it on will shape your life dramatically for the better, or so you hope. 
You've been looking forward to this a long time, and you plan to ... 

*choice
  #Study at the university.
    *set profession "Scholar"
    You intend to become a scholar. Alchemists, apothecaries, priests, doctors, herbalists and others spend years in intense study, building the knowledge necessary to engage with their domain. Skilled teachers are rare, supplies cost money, and the art can be difficult to feed yourself with in the early stages of training.
    *goto gender
  #Apprentice with a craftsman's guild.
    *set profession "Craftsman"
    The trades appeal to you, artisanry or physical labor. To make your living you'll need guild support, and taking on an apprentice is an investment, one you can help offset by bringing tithes to the table.
    *goto gender
  #Lease the land for a farm, or acquire the animals to take up hunting.
    *set profession "Agricultural"
    Land is, at its root, the source of all wealth. To gain some control of it, and draw your living from the very skin of the earth is a common profession, but a bold ambition from a city dweller born and raised.
    *goto gender
  #Become a merchant.
    *set profession "Merchant"
    Engaging in the creation of goods is not as much to your taste as helping others distribute theirs effectively. While not all artisans make use of merchants, you see the sheer potential offered by trade and partnerships, business ventures and salesmanship.
    *goto gender
  #Equip myself as a mercenary.
    *set profession "Mercenary"
    Anyone can be a soldier, but a mercenary need pay for their own equipment. Once done, however, the options are lucrative, with banditry as a fallback option should a land fail to keep you gainfully employed despite all you've invested.
    *goto gender
  *selectable_if(blood != "red") #Find training as a sorcerer.
    *set profession "Sorcerer"
    *goto mastery
    *goto gender
  *selectable_if(blood = "red") #Find training as a mage hunter.
    *set profession "Mage Hunter"
    *label mastery
    Training the innate capabilities granted by mana-altered blood leaves a person a force to be reckoned with, and tends to have broad applications to a variety of fields. Tame your gifts to your will, and new worlds will open.
    *goto gender
    
    
*label gender
*page_break
Coming back from your dreams to the present reality, you return to filling out paperwork for the alchemist.
If most of this becomes magically relevant, he will question you in more detail, but this part seems merely for census and etiquette purposes.

What is your gender?

*choice
  #Male.
    *set gender "male"
    You tick the box next to 'male'.
    *goto name
  #Female.
    *set gender "female"
    You tick the box next to 'female'.
    *goto name
  #Other.
    *set gender "other"
    You tick the box next to 'other'.
    *goto name
  #Unknown.
    *set gender "unknown"
    To be frank, the whole notion is something of a mystery to you at this point. Your lack of knowledge makes your blood slightly less usable, but you'll get paid the same either way: alchemists prefer not to give their providers incentive to invent something.
    *goto name
  #I prefer not to answer.
    *set gender "secret"
    Not providing information on your gender (or lack thereof) is allowed for privacy, though the lack of knowledge makes your blood slightly less usable for alchemy—to other people. You lose out on a small bonus offered for providing the information, but you'll make do.
    *goto name
  

*label name
*page_break
What name do you go by?
*input_text name
You scribble in the name you introduced yourself to the alchemist by. 
He doesn't seem to be making much use of it in conversation, but blood vials need a label.
*goto situation

*label situation
*page_break

Though ambitions stir within your blood, watered drop by painstaking drop with the sale of the same, 
at the moment you would be considered rather ordinary. Adult but young, you rent a ramshackle apartment 
in a small port city, scraping your means from the meager income available to the untrained servant—for—hire.

Compared to what you are used to growing up, this situation is ...

*choice
  #A step up.
    You were born in abject poverty, what family you had often cursing Fate for runs of ill luck. It was a struggle simply to reach adulthood and establish yourself as ordinary, and you've had better luck: but you know how swiftly that can turn, and drive yourself forward in the fear your luck will give out.
    *goto conclude
  #Par for the course.
    Your parents had simple occupations themselves, and though they struggled at times, did not find this cause to reach for more. They lack the understanding to support your ambitions, and certainly lack the means to pay for it.
    *goto conclude
  #A fall from grace.
    Your family might have given you a better life than this, but some differences of opinion set you on your own path quite firmly. Prosperity proves the price of freedom, and without it, you struggle to eke any use from the boon supposedly paid for.
    *goto conclude

*label conclude
*page_break

You accept the coins from the alchemist, a young, pale human with sunken eyes. He mutters what words he has to, seeming rushed to get any absolutely required pleasantries out of the way.

*if blood = "blue"
  His words are unclear enough that you have to ask for clarification repeatedly, and the fellow grows frustrated over time. He stops attempting to use words with you entirely, instead relying on gestures and pointing at written instructions to communicate his meaning.
  *goto end
*elseif blood = "white"
  You find yourself distracted by his refusal to make eye contact and constant tugging of his lab coat. Perhaps he is nervous around you? Something in you thrills at the thought, steadfastly resistant to any reprimands from your more conscious mind.
  *goto end
*else
  The fellow seems likewise uninterested in eye contact, though he grasps your hand firmly enough when all's done—a bit too firmly for comfort by your reckoning, but no one's grading and it's over swift enough.
  *goto end
  
*label end

Whatever else the alchemist thinks of you, he follows through on the offered pay, and your pockets sink with the pleasant weight of coin. Once your business is concluded, you slip out of the laboratory, blinking as your eyes adjust to the sunny streets of the city. The day is mild and pleasant indeed.

And due to that, the sudden crack of thunder rather catches you off guard.

*finish What was that?

I feel like whatever’s doing this should be something simple, but I haven’t been able to pin down any indentation issues (using notepad++ with 2 space tab). Why would my game be going to scenes but ignoring their code?

Are all of your text files saved using UTF-8 encoding?
If it’s saved in ANSI or another type you may run into errors.

1 Like

Thanks for mentioning that so I could double check! My startup file and my choicescript_stats file are encoded in ANSI, I didn’t think to check them since I modified the default files, but the text editor likely changed them when I saved. Everything else is in UTF-8.

Changing the encoding and clearing the browser cache doesn’t appear to have solved the issue, unfortunately.

Can you place this first section (the one starting with: Instinctively you scan the sky for clouds) into preformatted text like you did with the second scene so that we can check for spacing issues?

When I copied and pasted your second section (the one starting with: A faint, metallic scent) into a startup.txt, added the appropriate variables, and ran it, it seemed to work fine.

The second section is working fine, but everything after it isn’t. The first thing I posted wasn’t the code, but the output for the next scene … on the screen of the game when I played it when it got to the following scene code:

Instinctively you scan the sky for clouds, finding only a few wisps of smoke, and not the heavy masses of waiting rain that tend to produce such sounds. Glancing around you, some in the street pause in confusion while others take their cue to race towards—or away from somewhere. A second crack shakes the buildings and rattles dust, and part of the wooden walls of the city splinters, falling pieces swiftly driving you into the 'away from somewhere' group.

Your heart pounds rapidly as the situation pieces itself together in your mind, conclusions feeling deliberate and slow against the backdrop of the adrenaline surge. Not thunder, but cannons, firing on the city walls. From a direction you associate with the smell of salt and dead fish, when the wind blows from it.

Pirates are raiding your home.

*choice
  #Hide.
    ...You hide within the city. (under development)
    *finish
  #Join those defending the city by land.
    ...You defend the city by land. (under development)
    *finish
  #Join those firing cannons back at the pirates.
    ... You join those firing cannons at the pirates. (under development)
    *finish

Just my wild, educated guess, but does your pirate scene file named as
pirates.txt
or
Pirates.txt?

The capital letter.

This code seems to display fine, as far as the *choice working (see screenshot).

Screenshot

When you use the *finish command, the game will try to go to the next scene in the scene list. I’m assuming this is working as intended?

Just to make sure, you can always try using a *goto_scene command

Examples:
*goto_scene bloodmagic
*goto_scene pirates
*goto_scene aftermath
*goto_scene neighbors

Everything’s lowercase, including the file name.

Hmm… this is just getting intriguing, tickling my feet. xD
Ah, can you post us the screenshot of the bug that you meant?

It should help us to clear up the problem

The code also works fine for me … if I put it in the second scene rather than the third.

Here’s the screenshot of what I’m looking at in the context of my game:

From the screenshot, it doesn’t seem there are any spaces between “raiding your home.” and *choice

In your code, are you sure that there is a hard return after “raiding your home.”?

You can turn on paragraph marks in Notepad++ or Microsoft Word (for example) to check.

2 Likes

Huh … there’s a block carriage return everywhere relevant…but indeed no linefeed character on the problematic files.

Well, that looks rather likely to be the cause, but I’ve no clue why it was different in the first place.

Edit: Yep, that fixed it. Thanks!

1 Like