ID:150973
 
Hello again.. Sorry for all the problems, but I'm having trouble with If statements. They work differently for different languages.. Anyhow.. Firstly, it has this first bit of code to see what class they'll be.
//////////////////////////////////
mob
Login()
usr:class = input("What class will your character be?",
"Your class",
usr:class) in list("Barbarian")




//////////////////////////////////
So that works all good.. then I have this to choose what Icon it'll use. Keep in mind, all I have so far is barbarian. I'll have wizard later, so just imagine there to be more :P
//////////////////////////////////
if usr:class == barbarian
icon = "barbarian.dmi"
else
icon = "barbarian.dmi"
//////////////////////////////////
Why isn't this working? It's giving the following error:
//////////////////////////////////
loading DarkTalisman alpha.dme
DarkTalisman alpha.dm:27:error: missing condition
DarkTalisman alpha.dm:31:error: usr: expected end of statement

DarkTalisman alpha.dmb - 4 errors, 0 warnings
//////////////////////////////////
Any help? Also, it says I have 4 errors, but only displays two? I beleive this is because one of the errors has to do with :class.
//////////////////////////////////
On 6/18/01 9:55 pm Vortezz wrote:
Hello again.. Sorry for all the problems, but I'm having trouble with If statements. They work differently for different languages.. Anyhow.. Firstly, it has this first bit of code to see what class they'll be.

If statements in BYOND work the same as in other languages...the problems you are having are basic code issues, like not using parenthesis in some cases, and using incorrect indentation for your else statements.

If you haven't, I'd recommend clicking on the Tutorials link on the left and reading Zilal's ZBT tutorial, then downloading the Step BYOND demo code and reading through that.

You'll save yourself a lot of hassle.

if usr:class == barbarian
icon = "barbarian.dmi"
else
icon = "barbarian.dmi"


"else" should be indented to match "if"
In response to Deadron


why is this not working? it says statments like this have missing expressions..

if(usr.equip = 0) return

i have equip declaired under vars for mob..
In response to jobe
On 6/19/01 11:58 am jobe wrote:
why is this not working? it says statments like this have missing expressions..

if(usr.equip = 0) return

i have equip declaired under vars for mob..

use:
if(usr.equip == 0) return

= is an assignment
== is a comparison