ID:146039
 
Code:
    well
name = "Well"
density = 0
layer = MOB_LAYER+1
icon = 'building.dmi'
icon_state = "well"
Entered(O)
if (m/var/level >= 100)
usr.loc = locate(/turf/hellsflo)
else
usr << "How cheap. A well drawn on the ground."


Problem description:
I get the errors
Turfs.dm:1376:error:m:undefined var
Turfs.dm:1376:error:var/level:undefined var
Everything is defined, but in another .dm. Ive also tried using mob/players/var/level and mob/var/level var and var/level and just plain level. Please note:
obj
...
.....

turf
.....
....
//code i posted here.

Replace the dots with other turf or obj coding, thats the general layout of that file. The player vars are defined in another file, i didnt think that would make a diff though.
If you need to know anymore, just post.

Thanks,
Daman
Changing m/var/level to usr.level should work.
In response to Mecha Destroyer JD
Turfs.dm:1380:error:usr.level:undefined var
Nope.
In response to Daman3456
well
name = "Well"
density = 0
layer = MOB_LAYER+1
icon = 'building.dmi'
icon_state = "well"
Entered(O)
if (M/level >= 100)
usr.loc = locate(/turf/hellsflo)
else
usr << "How cheap. A well drawn on the ground."



i think m should me caps...
i think you cant use var in middle of if, so try to add it somewhere in other place
In response to Ripiz
No...It still counts them as two seperate things.

Turfs.dm:1380:error:M:undefined var
Turfs.dm:1380:error:var/level:undefined var

and

Turfs.dm:1380:error:M:undefined var
Turfs.dm:1380:error:level:undefined var


Edit- By the way, i tried putting (M as mob) next to well, and it got rid of those errors, but added
Turfs.dm:1380:error: proc definition not allowed inside another proc

I also tried using mob/level and mov/var/level. But that didnt work either, still counts mob and level as seperate pieces
In response to Ripiz
Please don't give bad advice, especially if you can't program your own game.

    well
name = "Well"
density = 0
layer = MOB_LAYER+1
icon = 'building.dmi'
icon_state = "well"
Entered(mob/O)
if (istype(O,/mob/Player)&&O.level >= 100) // Or what ever your player's type is.
O.loc = locate(/turf/hellsflo)
else
O << "How cheap. A well drawn on the ground."


That should work.
Mecha Destroyer, that will only bring usr abuse in Entered, so bad idea.

The problem is that you aren't accessing a mob's level variable correctly. Seeing that even usr.level wouldn't compile, I don't think you have the variable, level defined. (At least in /mob).

mob/var
level = 1


For your well problemm, you are on the right track, except the wrong way to recall variables. The argument for Entered() defaults to what attempted to come inside of the object.

turf
well/Entered(mob/A) // A is the object which attempts to enter the well
if(ismob(A) && A.client) // check if it's a real player
var/mob/M = A // type cast A to a mob so we can access its variables
if(M.level >= 100)
M.loc = locate(/turf/hellsflo)
else
M << "How cheap. A well drawn on the ground."


For your turfs and objs, you have it mistaken. /turf is a whole different pathtype. You have to un-indent everything at /turf because it would actually be an obj which is named turf.

obj
blah
turf
well
hellsflo
// etc...


~~> Dragon Lord
In response to Kalzar
Thanks kalzar, but that gives me
Turfs.dm:1380:error:/mob/Player:undefined type path
Turfs.dm:1380:error:O.level:undefined var
I figured it out right before you posted, but i thought your code might work better. The thing i needed to change it to was /mob/players.
EDIT- Nevermind. I wasnt really thinking, i didnt add level to /mob/players. Now it gives Turfs.dm:1380:error:/mob/players/level:undefined type path
In response to Unknown Person
Actually, i messed up on that example. Turf is already a diffrent pathtype. By the way, your code gives

Turfs.dm:1375:error: missing left-hand argument to &&.
Turfs.dm:1375:error: missing left-hand argument to &&.

=) Thanks for the help, anyway.
In response to Daman3456
Sorry, I added an extra parenthesis in ismob(). It should be:

turf
well/Entered(mob/A) // A is the object which attempts to enter the well
if(ismob(A) && A.client) // check if it's a real player
var/mob/M = A // type cast A to a mob so we can access its variables
if(M.level >= 100)
M.loc = locate(/turf/hellsflo)
else
M << "How cheap. A well drawn on the ground."


I edited the original post.

~~> Dragon Lord
In response to Unknown Person
Turfs.dm:1377:error:M.level:undefined var
Turfs.dm:1380:error:M:undefined var

Is what i get.
In response to Daman3456
If you read all of my original post, you had to define mob/var/level yourself.

~~> Dragon Lord
In response to Unknown Person
As ive said before, it is defined. Just in another .dm file.
Edit- if you mean change whatever you had there to this,
            var/mob/players/level = A // type cast A to a mob so we can access its variables


Then it just gives me
Turfs.dm:1377:error:M.level:undefined var
Turfs.dm:1378:error:M.loc:undefined var
Turfs.dm:1380:error:M:undefined var
Turfs.dm:1376:level :warning: variable defined but not used
In response to Daman3456
Change his M variable to var/mob/players/M=A.