Small coding problem


#1

so at the part in my game where your given a weapon, i have it based off your job. and the only way i knew how to code it was to type this

Unlike your armor your weapon is given to you based on your profession.

*choice
# Alright what weapon do i get?
*if (job =“mage”)
The soldier handing out weapons looks at you with fear in his eyes. He hands you a stick. You ask him what he expect you do with a stick. He says to use it as a wand. Magic come from the skin of the user forming into an element once in the air, wands are not a thing. You throw it in his face. He hands you a dagger before rushing off.
*set weapon “dagger”
*goto Day1
*if (job =“knight”)
It’s no question that you are given a longsword its of such fine steel the military really must respect your being a knight.
*set weapon “long sword”
*goto Day1
*if (job =“guard”)
Your handed a standard short sword, nothing fancy but in the right hands it kills all the same.
*set weapon “short sword”
*goto Day1
*if (job =“bookmaker”)
You can tell the don’t expect much from you fighting wise but some one who can write reports is allways needed but they want you to fight as well. They give you a sword.
*set weapon “sword”
*goto Day1
*if (job =“bishop”)
Your handed a knife and told to hope the gods bless you. They clearly think you will die. You bless your knife.
*set weapon “blessed knife”
*goto Day1
*if (job =“hunter”)
You are handed a crossbow made of great materials. Your also give a quiver full of bolts.
*set weapon “crossbow and arrows”
*goto Day1
*if (job =“merchant”)
The soldiers don’t think you would do well with a sword so they give you a mace.
*set weapon “spiked mace”
*goto Day1
*if (job =“performer”)
Being a highway-man your know for stealth and trickery, they give you throwing knives.
*set weapon “throwing knives”
*goto Day1

whats wrong with it? it doesn’t give an error it just skips it all together.
also it doesn’t change the stat value


#2

It’s probably your indentation. Other than that, it looks perfectly fine to me.


#3

Its hard to tell from my phone but it looks like your indent is off plus you are useing more then one if, you need to use only one if then elseif and finsh with else. Smaple below.

*choice
x#Alright what…
xx*if (job=“mage”)
xxxThe soldier…
xxx*set weapon…
xxx*goto Day1
xx*elseif (job=…
xxxIt’s…
xxx*set weapon…
xxx*goto…
xx*else (job=“performer”)
xxx…
xxx*set weapon
xxx*goto…

Hope this helps

*edit sorry the spacing not showing up right on my phone so added x’s to show indent.


#4

I do things only using *if, not *elsif, all of the time. It never caused me any problems before. Chances are, if a part is being skipped entirely, with no error message, that it’s a problem with the indentation.


#5

I am no coding expert by any means so I am unsure about only if’s, but I know this is how the sample shows and the few bits of code I have seen from others. If it works, by all means :wink:


#6

Alright thanks for the help every one i found the problem

the font i type in made it look like it was spaced correctly but it was off by two at the end. so its all fixed now.


#7

The advantage of using *elsif and *else with *if is that you don’t need all those redundant *goto’s sending you to the same place then. Aside from that efficiency issue, both methods will work.