ID:261328
 
This is a snipet of code from my game but i cant seem to get the indentation right can anyone help.....

food = input ("What do you want?") in list ("Chips","Nachos")
if("Chips")
usr.Weight += 0.5 //<<-- it dont work
if("Nahos")
usr.Weight+= 1
You're not indenting what you want the if() to do,

if(blah)
usr<<"blah!"//notice the indentation.
food = input ("What do you want?") in list ("Chips","Nachos")
if("Chips")
usr.Weight += 0.5 //<<-- it dont work
if("Nahos")
usr.Weight+= 1


I have done what you said and still get the errors.
In response to Super saiyan3
You're also not using switch, look up switch() in the reference, here's a small example:

mob/verb/Eat()
var/food = input("Eat?")in list("Blah","Bleh")
switch(food)//see.
if("Blah")
usr<<"Ick, you ate blah!"
if("Bleh")
usr<<"Bleh is good for you, yum!"

In response to Nadrew
Yes, but Nadrew it is part of a login code; what i gave was an example using the exact indentation of my real code.
In response to Super saiyan3
If you're going to use if() and else for input() you MUST use switch to make it work, no matter what.
In response to Nadrew
Nadrew wrote:
If you're going to use if() and else for input() you MUST use switch to make it work, no matter what.

Well, if he's going to do if("Chips"), then yes. If he's going to check against the value of the variable with an == like a normal if() would, then no.

Lummox JR
In response to Lummox JR
Yeah, that's what I meant :).
In response to Nadrew
Nadrew wrote:
If you're going to use if() and else for input() you MUST use switch to make it work, no matter what.

But what i dont understand Nadrew is using the switch just to increase one of the vars. Can you give an example..