ID:261866
 
look at this code

mob
var/speed

if usr.icon = 'car.dmi'
iconstate = "ferrari"
speed = 10

if icon = 'car.dmi'
iconstate = "911turbo"
speed = 5
Move()
sleep(speed)


Carworld.dm:24:error: missing condition
Carworld.dm:28:error: missing condition

Carworld.dmb - 19 errors, 0 warnings (double-click on an error to jump to it)



what the heck is missing condition???

what the heck is missing condition???
The "condition" is the thing that goes inside the () in an if() statement, so the game knows what it's supposed to check. In your case, you've forgotten the () so the compiler doesn't think you've bothered to make a condition.

Everything that it's supposed to do when the condition is true needs to be indented below it, so the game knows what belongs to the if() and what doesn't.

For instance, it should read:

if (icon == 'car.dmi')
line 1
line 2
line 3

instead of:

if icon = 'car.dmi'
line1
line2
line3

Note you need == instead of =.

= means, "This DOES equal that, BECAUSE I SAID SO!"
== means, "Does this equal that? Please tell me."

So when you want to tell the game that the icon = 'car.dmi', you use one = sign. When you need to ask it if it already is car.dmi, use two.
In response to Hedgemistress
k thx
In response to Chibi_Gohan123
here is part of my code:


//This world was created by <Jake> on <11/29/02>

mob

icon = 'Car.dmi'
icon_state = "convertable"

Login()
..()

verb

Say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output

var/hub

world/hub = "Chibi_Gohan123.Carworld"

var/delay = 1

verb/Porche_911_Turbo()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "911turbo"
delay = 1

verb/Supra()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "supra"
delay = 1

verb/Convertable()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "convertable"
delay = 1

verb/Civic()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "civic"
delay = 1

verb/Camaro()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "camaro"
delay = 1

verb/Eclipse()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "eclipse"
delay = 1

verb/Datsun()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "datsun"
delay = 1

verb/FBI()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "fbi"
delay = 1

verb/Ferrari()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "ferrari"
delay = 1

verb/DodgeViper()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "viper"
delay = 1

verb/McLarenF1()
set category = "Pick_car"
usr.icon = 'Car.dmi'
usr.icon_state = "mclarenf1"
delay = 1
return

mob/verb/Go_To()
set category = "Go_Somewhere"
switch(input("Where do you wanna go?", "Go where?", text) in list ("City","Race","Cancel"))
if("City")
usr.loc = locate(1,1,1)
if("Race")
usr.loc = locate(41,16,1)
if("Cancel")
return

HERE IS YOUR PART!!!

mob/var/speed

if(usr.icon == 'car.dmi',
iconstate == "ferrari")
speed = 10

if(icon == 'car.dmi',
iconstate == "911turbo")
speed = 5
Move()
sleep(speed)

YOUR PART ENDS HERE!!!!!!!!!!

loading Carworld.dme
Carworld.dm:103:error:iconstate:undefined var
Carworld.dm:107:error:iconstate:undefined var
Carworld.dm:106:error:if :duplicate definition
Carworld.dm:102:error:if :previous definition
Carworld.dm:107:error:== :bad variable definition
Carworld.dm:106:error:== :bad variable definition
Carworld.dm:108:error:speed :duplicate definition
Carworld.dm:104:error:speed :previous definition
Carworld.dm:109:error:Move:missing =
Carworld.dm:110:error:speed:undefined type: speed
Carworld.dm:103:error:== :bad variable definition
Carworld.dm:102:error:== :bad variable definition
Carworld.dm:100:mob :warning: unused label
Carworld.dm:110:sleep :warning: variable defined but not used

Carworld.dmb - 12 errors, 2 warnings (double-click on an error to jump to it)
In response to Chibi_Gohan123
You're not looking at your code very carefully, and you're not looking at what the compiler's telling you very carefully, either.

Look how in some places you have:

icon_state = "blahblah"

and in others, you have:

iconstate = "blahblah"

and what does the compiler tell you? It says iconstate is not a defined var. Why? Well, 'cause it isn't! That takes care of a lot of the errors.

The others come from the fact that if (usr.icon == 'blah',icon_state == "blah") might make sense to you, it means nothing to the computer. If you want two conditions within the same ( ), you need to use && (and)

if (usr.icon == 'blah' && usr.icon_state == "blah")

Note that the things on each side of the && need to be full conditions, you do need to repeat usr. each time
In response to Hedgemistress
mob/var/speed

if(icon == 'car.dmi'&&
icon_state == "ferrari")
speed = 10

if(icon == 'car.dmi'&&
icon_state == "911turbo")
speed = 5
Move()
sleep(speed)

loading Carworld.dme
Carworld.dm:102:error: missing expression
Carworld.dm:103:error: icon_state: missing comma ',' or right-paren ')'

Carworld.dmb - 12 errors, 0 warnings (double-click on an error to jump to it)


sry, i noob coder i dont understand what that means, im fairly new to this and don't understand the basic common errors yet, sry.

if you could help me a bit more I would appreciate very much thank you
In response to Chibi_Gohan123
plz resopnd thank you coders
In response to Chibi_Gohan123
Please don't bump your post until at LEAST 24 hours have passed since the last reply.

All of the conditions have to be on the same line. So instead of this:

<code>if(icon == 'car.dmi'&& icon_state == "ferrari")</code>

You need this:

<code>if(icon == 'car.dmi' && icon_state == "ferrari")</code>

Also, you're forgetting the indentation after the if()s. Each line that "belongs" to the if() should be indented once more. (By "belongs", I mean all of the lines that the if() is meant to affect.)

And this bit makes no sense:

<code> if(icon == 'car.dmi'&& icon_state == "911turbo") speed = 5 Move() sleep(speed)</code>

Move() doesn't work like that, and you can't delay movement by sleeping in Move(). A quick search of the hub turned up this movement delay demo: http://developer.byond.com/hub/Kunark/MoveDelay
In response to Crispy
look crispy all i want my code to do is make some cars faster or slower than others, i can't seem to figure out the right code or how to fix the code that doesn't work,

if you could help with my noobish skills i would appreciate it thank you
In response to Chibi_Gohan123
He just did.

Instead of copping an attitude, try reading what people are telling you... you'll never get past the "ask the forum to fix my code every single time I want to do something" stage if you're not interested in learning or self-improvement.
In response to Hedgemistress
Hedgemistress wrote:
He just did.

Instead of copping an attitude, try reading what people are telling you... you'll never get past the "ask the forum to fix my code every single time I want to do something" stage if you're not interested in learning or self-improvement.

i have nothing more to say to you then..

my code is

mob
var/speed
Ferrari
if(icon == 'car.dmi' && icon_state = "ferrari")
speed = 50

Porche_911_Turbo
if(icon == 'car.dmi' && icon_state = "911turbo")
speed = 5

loading Carworld.dme
Carworld.dm:103:error::duplicate definition
Carworld.dm:107:error::duplicate definition
Carworld.dm:104:error::duplicate definition
Carworld.dm:108:error::duplicate definition

Carworld.dmb - 4 errors, 0 warnings (double-click on an error to jump to it)




and ur not going to change it, i accept that
In response to Chibi_Gohan123
Man, you had people falling all over themselves to help you, but apparently you're more interested in copying and pasting your bad code than actually accomplishing anything... I guess you don't really wanna make a game after all. Seems kinda silly to go through so much work, though, if you don't wanna accomplish anything.

Oh, well... it's your own time to waste. Have a nice life!
In response to Chibi_Gohan123
Chibi_Gohan123 wrote:
mob
var/speed
Ferrari
if(icon == 'car.dmi' && icon_state = "ferrari")
speed = 50

Porche_911_Turbo
if(icon == 'car.dmi' && icon_state = "911turbo")
speed = 5

that should fix it
In response to WTS_Leader
WTS_Leader wrote:
Chibi_Gohan123 wrote:
mob
var/speed
Ferrari
if(icon == 'car.dmi' && icon_state = "ferrari")
speed = 50

Porche_911_Turbo
if(icon == 'car.dmi' && icon_state = "911turbo")
speed = 5

that should fix it

Except that if()s need to be inside a proc to work. So no, that won't fix it. =P

As much as I hate handing out code on a silver platter because people are too lazy to learn:

<code>mob var/speed Ferrari icon = 'car.dmi' icon_state = "ferrari" speed = 50 Porche_911_Turbo icon == 'car.dmi' icon_state = "911turbo" speed = 5</code>

And to get the movement delay in, look at the movement delay demo I linked to earlier.

If you didn't read anything else in this post, read this: If you don't pay attention this time, you're never going to pay attention. So if you reply with another post ignoring all of my help and repeating your demands, I'll never bother to help you again; because it's obvious you don't WANT to be helped. No matter how polite your tone is.

EDIT: Arglebargle! I just read this post again and noticed the indentation was screwed up on the last line of the code I posted. Silly forum.
In response to Crispy
ok thx crisp