Help with *elseif


#1

Hi gang, just a quick question about the if and elseif commands. I’ve got an elseif command that takes the action to another scene, but instead it just seems to end the game.

Ser Farah is struggling to remain conscious, awkwardly trying to manoeuvre herself 

to a standing position.

"It's a King Toise! Stay away my Lord/Lady, it won't think twice before biting you 

clean in half!"

*if Build = "Tough"
 *goto_scene toisetough

*elseif (Gender = "Male") and (Build = "Pretty")
 *goto_scene toiseprettym

*elseif (Gender = "Female") and (Build = "Pretty")
 *goto_scene toiseprettyf

*elseif Build = "Smart"
 *goto_scene toisesmart

Am I missing an easier way here? Or misunderstanding what this function is for? Instead of going to the apportioned scene, it just finishes the game. Thanks in advance.


#2

Replace the last *elseif with *else for one thing. Just else, no conditions needed.
Alternatively, use *if for all of them.


#3

Neither of those ideas seemed to do it… CURSES!


#4

Gonna need more info in that case. Exactly what happens and when? Does it just say play again and that stuff?


#5

It does indeed just go to the play again buttons, right after the words ‘biting in half’. There are a couple of pages of dialogue before that but nothing that would seem to throw the baby out with the bath-water.

In theory it should then jump to the next document in the scenes folder, where the fight between the battleship-sized tortoise and the scruffy android continues on.

I’ll post a larger fragment of the scene.


#6
*page_break

He steps back and is bodily dragged onto the back of a horse, ridden by the human 

giant who he called with the flare.

*if Gender = "Male"
 "C'mon, man! Time to go! He's made his choice!"

*if Gender = "Female"
 "C'mon, man! Time to go! She's made her choice!"

As they leap the flames and crash through the guards, the Burned Man never takes 

his eyes off you.

The look in his eyes is haunting.

*page_break

You are jolted back to life by a gloved hand on your shoulder, and you turn to 

look at the cold, proud face of Ser Farah. The beginnings of a bad bruise mark the 

left side of her face and her left eye is reflexively closed.

*if Gender = "Male"
 "On your feet, my Lord."

*if Gender = "Female"
 "On your feet, my Lady."

You rise up as you are told, but suddenly you are aware of something. A sound you 

had been growing accustomed to has ceased. The clockwork tick of the little sphere 

has ceased. Both you and Sir Farah turn around just in time to see the top half of 

the sphere fire itself straight up, blasting up through the shattered skylight and 

into the storm.

*page_break

Sir Farah roughly manhandles you away from the egg and drags you back into the 

dining hall. The two of you are scrambling down the staircase when the room behind 

you explodes, flinging you roughly to the marble floor below.

The walls burst like a ruined abscess and start to bulge with horrid grey flesh. A 

titanic creature seems to buck and roar and toss the walls of the house to and fro 

as if they were made out of wet paper.

The upper storey collapses entirely and a colossal impact tosses you both back 

into the air momentarily.

Your artificial mind protects you from unconsciousness and you raise yourself up 

to your feet to behold your new opponent.

*page_break

A reptile the size of a battleship shakes brickdust from its scales. A terrible 

battle-scarred shell sits on its back like a mountain range and its beak looks 

hard enough to carve through steel. The beast fixes you with its great black eye 

and roars, a hollow scream that seems to cause even greater damage to the ruined 

manor.

Two of the Lady's guard are half-consciously trying to pick themselves up out of 

the wreckage, and a horse crippled by falling masonry weakly kicks away trying to 

escape.

The soldiers see the monster a moment too late. They raise their muskets and 

manage to get two clean shots away, but they might as well have used feather-

dusters for all the musket-balls do to the creature's rocky hide.

It utterly crushes the first man with a colossal front limb and its great beak 

envelops the second before he can get away. A sickening crunch is the only clue as 

to his fate, and you reflexively turn away for a moment.

*page_break

Ser Farah is struggling to remain conscious, awkwardly trying to manoeuvre herself 

to a standing position.

"It's a King Toise! Stay away my Lord/Lady, it won't think twice before biting you 

clean in half!"

*if Build = "Tough"
 *goto_scene toisetough

*if (Gender = "Male") and (Build = "Pretty")
 *goto_scene toiseprettym

*if (Gender = "Female") and (Build = "Pretty")
 *goto_scene toiseprettyf

*if Build = "Smart"
  *goto_scene toisesmart

As you can see, not a huge amount of code to get into the way.


#7

This is probably a silly question, but have you got any text in the scenes the *goto_scene’s refer to? If not it’d just skip ahead and eventually end up at the ending scene.

If that’s not the case the problem might still lie in those scenes, so maybe you could post some code from those? Or could the names of those scenes be the issue, that they’re not referring to the right file or something?


#8

I appreciate your covering the other angles, here is a snippet from each potential document:

You tense up, your muscles slipping into combat mode without even a thought. Your skin hardens and your reflexes kick into overdrive. Unfortunately there is no specific combat routine for tackling a being like this, so you endeavour to improvise.

You look at the monster's face and do something drastic.

The yawning mouth of the King Toise is open, an invitation to destruction. You shock even yourself when you run right into the monster's gaping maw and brace your hands against the roof of its mouth.

The beast tries lividly to snap its jaw closed but your muscles push into overdrive, screaming their dismay to your brain, which responds only with a tenacious desire to hang on. The raging Toise is even madder now, swinging its head in all directions trying to shake you out or down its throat.

That’s choice one.

You tense up, the beast is all the more dangerous for the rage you feel washing off of it. Ser Farah needs time to rally herself and you are no more capable of fighting this creature than you are of making friends with it.

You must improvise, and your skill-set does you few favours. You notice that its eyes are especially sensitive to movement, so a plan forms in your mind.

You stand directly in the path of the monstrous Toise and disrobe once more, desperately thinking about brightness and colour and the need to bring attention to yourself.

Your skin begins to wildly oscillate between a selection of blindingly bright colours, your hair flashing with bursts of coloured light. The creature cannot look away, although its jaw is held open in a menacing display of dominance that is accompanied with an awful hiss like the sound of a steam-boiler.

Choice two and a half

You tense up, the beast is all the more dangerous for the rage you feel washing off of it. Ser Farah needs time to rally herself and you are no more capable of fighting this creature than you are of making friends with it.

You must improvise, and your skill-set does you few favours. You notice that its eyes are especially sensitive to movement, so a plan forms in your mind.

You stand directly in the path of the monstrous Toise and disrobe once more, desperately thinking about brightness and colour and the need to bring attention to yourself.

Your skin begins to wildly oscillate between a selection of blindingly bright colours, your hair flashing with bursts of coloured light. The creature cannot look away, although its jaw is held open in a menacing display of dominance that is accompanied with an awful hiss like the sound of a steam-boiler.

The other half of choice two

You tense up, pushing your senses into overdrive assessing the situation.

Even if Ser Farah were at full battle-readiness, the odds of her defeating such a beast are abysmally poor, and the rapidly crumbling room would likely make things worse for you rather than better.

In order to defeat the beast you need a suitable distraction and a sufficiently powerful weapon.

You run your eyes briefly over the room to scan for these. You see several small fires, too small to be of any use as a deterrent.

You see the great chandelier barely hanging onto the decaying ceiling and you see the ruined tables, all garnished with bottles of various alcoholic beverages.

And finally choice three. All in their apportioned scene documents.


#9

As you can see, most of my documents are filled with over-the-top waffle, and are a little light on the actual coding aspect…


#10

Could you show the top of the startup scene (where you set the variables)? I’m trying to see if I can get it to work in a little test document and it occurred to me that this whole thing might be caused by the capital letters in either the variables or the values. Maybe…


#11
*title The Myrmidon
*author Anonymous
*scene_list
  startup
  forge
  skin
  hair
  android
  wake
  demonstrationm
  demonstrationf

*create Name "Prisoner"
*create Build "Unknown"
*create Skin "Unknown"
*create Hair "Unknown"
*create Focus "Unknown"
*create Gender "Unknown"
*create leadership 50
*create strength 50

#12

So you changed it to all *ifs now? Come to think of it it might be better to use else in this circumstance to have the default catchall.

Have you checked to see if build actually is assigned a value? As of right now, if Build isn’t assigned a value, it would skip all of that code. Do this ${Build} in front of the code segment, see if it’s assigned a value. But even if it wasn’t assigned a value, if you tried using else, that should have still sluiced you into the last choice.


#13

That eliminates the possibility of it being the variables at least…


#14

I think it might be the “Build” variable. Watch this space.


#15

Well, the code works for me, with all the proper variables in place, so it might just be.
(picture or it didn’t happen)


And that Lord/Lady thing doesn’t look intentional…


#16

Truthfully the Lord/Lady line was me frantically stripping out code to see whether it was something else doing it. Circumstances have dragged me away from my code so I can’t make changes until I regain control but I think that the “Build” variable is where the problem lies. I’ll let you know as soon as I test that hypothesis.


#17

Eureka! Managed to find the incorrect variable and plug it from its own scene.

Thanks for the extra eyes, guys.