If/Elseif/Else Fundamentals

In my code, I have a thing where . . . I’m just gonna show you.

*label reveal
    *if Passion >=75
      You are the Fire Guardian, the "warmth in the blistering cold" from the riddle; you live in Canada. Your eyes glow, in both dragon and human form, like two dying flashlights, due to the power inside you. You can bend fire making it fly from your palms or from the soles of your feet. Flames cannot harm you and you can breathe oxygen-deprived air as easily as you are breathing now. Smoke does not sting your eyes or bother your lungs. You do not tire easily, for the flame within your marrow can fuel you for days, like a constant internal supply of coffee. You could live on an active volcano.
    
    In addition to all that, you can transform into the great, copper dragon that granted the first Fire Guardian their power. In this form, your metallic scales are nigh impenetrable, you have flowing copper fur along your spine and a thin tuft of fur at the end of your tail and you can breathe fire. Your feathery wings span two-and-a-half football fields. Your tapering, spiraling horns are as thick as a man's arm. You are as tall at the shoulder as two school busses. Your chest spans the breadth of a garbage truck, the skinniest part of your neck is like the back of a fat bull, and your back is like an elephant's. Your four legs are as the trunks of jungle trees, your talons twenty times the size of an eagle's. You are truly formdible, and those who lay eyes apon you tremble and quake.

*goto_personality

    *if Passion <=25
      You are the Wind Guardian, the "strorms in the Land of Gold" from the riddle; you live in Argentina. Your eyes glow, in dragon and human form, like two dying flashlights, due to the power inside you. You can push and pull the air around you with hand and foot, can leap great distances, run extremely fast without being out of breath. You can summon storms, from a light rain to a typhoon. You can bid lightning to fall out of a clear blue sky. You can even steal the breath from another's throat, suffocating them to death. Thank God you are of a peaceful nature, and would rather stop a fight than take a life.

      Your dragon form resembles that of an Asian dragon, without the tusks and strange glowing orb. Your pearlecent scales imperfectly reflect the storm clouds as you glide through the sky. You can fire bolts of lightning from your mouth. At its thickest, your long, serpentine body is as thick as the trunk of an ancient tree, and tapers down to a tufted tail. The fur along your spine is long and milk-white. Your talons are so sharp, they sing through the air as you fly. None who meet you will ever forget it.

*goto_personality

    *if Agility >=75
      You are the Water Guardian, the "drink in the island of deserts" from the riddle; you live in Australia. Your eyes glow, in both human and dragon form, like two dying flashlights, due to the power inside you. You can bend the water from streams, oceans, and rivers, in plants . . . and in living creatures. You can turn water into ice, snow, fog, or steam. You can breathe underwater and withstand water pressure that would kill a normal human being. You have mild night vision, and can see clearly underwater.
    
      Your dragon form is the biggest and strongest of all. In your dragon form, your scales are irridecent blue, intricately detaled with all the hues the ocean can provide. A pale blue crest graces your spine. Your wings, though not made for flying extremely long distances, are perfect, however, for whisking through the sea. You spray scalding, steaming water from your mouth. Your body, nose to tail-tip, is fully three hundred and fifty feet long. Your wingspan is nearly one-and-a-half times that. Your four legs are as thick at the ankles as a tree, and your enourmous, serrated claws are ideal for tearing the meat off whale carcasses. Bioluminecent stripes accent your body, giving you an eerie glow at night. You are the thing that sailors tell tales about, the dread sea monster on the ancient treasure maps left by pirates.

*goto_personality
    
    *if Agility <=25
      You are the Earth Guardian, the "power of earth where the cherry trees bloom" from the riddle; you live in Japan. Your eyes glow, in both human and dragon form, like two dying flashlights, due to the power inside you. You are sturdy as a rock, and are not easily knocked over in a fight. You control the earth beneath your feet, can make it bend to your will, which requires strength and a will of iron. You love being outside with the plants and trees, and spend most your time barefoot. You can see in the darkest of nights as if it were day, and have infrared vision that requires some focus to use.
    
    Your dragon form is like that of a wyvern. You spit clear, deadly acid that can melt through nearly anything organic. Only you can touch it safely. Your tail ends in a vicious stinger with a venom potent enough to kill three bull elephants and sharp enough and strong enough to pierce a cast-iron pan. Your scales glitter metallically in the sun, and are delicately accented with all the greens of the Amazon rainforest. Your bat-like wings span a football field, and your two legs are thick as smaller-sized tree trunks. Your serrated talons are twelve times the size of an eagle's. You are most formidible in a fight, being the smallest of all the dragons, you are able to manuever and strike quickly. Those who've angered you are lucky to have lived to tell the tale.

*goto_personality 

So, I want to know what the coding would be if they end up with their levels in between those numbers, and I wanted to send them back to the start of the little quiz I have set up.

1 Like
*if (Passion > 25) and (Passion < 75)
    *goto beginning_of_quiz

Something like this for a conditional?

Probably not exactly what you are asking, but in general with percentage stats (which assumes 0-100 in potential value) you could structure similar code like this:

*if (Passion >= 75)
    // for situation from 75 to 100
*elseif (Passion > 25)
    // for situation from 26 to 74
*else
    // for situation from 0 to 25

Do you think that would work?

I’m not 100% sure what you’re trying to achieve, but if you want them to be sent back to the beginning if they don’t have the neccesary stats, add an *else statement that takes them back.
*if agility <=25
blah blah blah
*else
*goto reveal

Wait, wouldn’t that confuse the thing? I mean, if I say

*if Agility <=25
*else goto_test

Wouldn’t that send a Earth Guardian back to the start because it’s greater than 25

You would need to create the if/else for each choice. Otherwise it would loop

Hm. So . . .

*if Passion >=75
*else goto_test
blah blah Fire Guardian!

*if Passion <=25
*else goto_test
blah blah Wind Guardian!

*if Agility >=75
*else goto_test
blah blah Water Guardian!

*if Agility <=25
*else goto_test
blah blah Earth Guardian!

Like that?

The text would be below the *if statement, but otherwise yes

*if Passion >=75
    blah blah Fire Guardian!
*elseif Passion <= 25
    blah blah Wind Guardian!
*else
    goto test

*if Agility >=75
    blah blah Water Guardian!
*elseif Agility <= 25
    blah blah Earth Guardian!
*else
    goto test

Although I wonder if this might be what would work (because otherwise player who wants to be Water Guardian might get a passion value that decides they are either fire or wind, or they keep getting send back to test…)

*if Passion >=75
    blah blah Fire Guardian!
*elseif Passion <= 25
    blah blah Wind Guardian!
*elseif Agility >=75
    blah blah Water Guardian!
*elseif Agility <= 25
    blah blah Earth Guardian!
*else
    goto test

Ah! I got it now. Thank you both very much!

3 Likes

In case you have any more questions, these are good links:

2 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.