ID:263311
 
Code:
client/Move(newloc, direc)
if(istype(mob.loc, /obj/car))
if(mob.loc.contents.Find(mob) == 1)
mob.loc.Move(newloc, direc)//line 4
return 0
return ..()


Problem description:
CAr.dm:4:error:mob.loc.Move:undefined proc
I dont know what im getting this probelm what can i do to fix it?


National Guardsmen wrote:
Code:
> client/Move(newloc, direc)
> if(istype(mob.loc, /obj/car))
> if(mob.loc.contents.Find(mob) == 1)
> mob.loc.Move(newloc, direc)//line 4
> return 0
> return ..()
>

Problem description:
CAr.dm:4:error:mob.loc.Move:undefined proc
I dont know what im getting this probelm what can i do to fix it?

If you can learn to read your error codes, you'll be able to advance in programming much more quickly. It says that mob.loc.Move() is an undefined proc. Think to yourself just what mob.loc is. Now, examine this short sketch of some hierarchies:
datum
        atom
                area
                movable
                        mob
                        obj
                turf

Types descendant of /datum/atom/movable are those which are capable of movement.

Hiead
In response to Hiead
honestly i dont understand what your saying i know all about datums and atoms but i cant seem to figure out what the error is.
In response to National Guardsmen
National Guardsmen wrote:
honestly i dont understand what your saying i know all about datums and atoms but i cant seem to figure out what the error is.

Okay....try this. Think about what mob.loc is. What is it? Is it a mob? Most likely not. Is it an obj? Again, probably not! Is it a turf? That's usually what it is! The variable itself is defined as an /atom, which isn't descendant of /atom/movable!

datumatomareamovablemobobjturf

Types descendant of /datum/atom/movable are those which are capable of movement.

Okay so, now knowing what we know, that the mob's loc is probably a turf, find turf on the above diagram. Then read the sentence. Think to yourself: "Is turf descendent of /datum/atom/movable? No. It isn't indented behind /datum/atom/movable, like /obj and /mob are. It isn't descendant of /datum/atom/movable, so it can't move."

Now look again at line 4, the line that BYOND pointed you to, and read what it says:
mob.loc.Move(newloc, direc)//line 4

You are calling the Move() proc. What are you trying to call it from? The mob? No. You are trying to call mob.loc's Move() proc. As I've clearly pointed out, mob.loc, being an /atom, has no Move() proc to call.

Let us then turn to your error message:
CAr.dm:4:error:mob.loc.Move:undefined proc

mob.loc.Move() is an undefined proc. There has been no Move() proc defined for mob.loc, because mob.loc is an /atom type, probably a /turf. You can't call something that hasn't been defined. Thus, error.

Hiead
In response to Hiead
so what your saying that i cant call Move()
in mob.loc because it isnt a moveable atom?
In response to National Guardsmen
He is saying you need to typecast loc as the car.
In response to DivineO'peanut
i would recomend rewriting this code, instead of setting the player's loc inside the car simply define a car variable for the player and when the player moves move their car variable with them <.<

PS: Hiead, quoting dictionary descrptions of things usualy confuzes more then it helps lol
In response to DivineO'peanut
Thank you DivineO'peanut i understand that.