ID:145816
 
Code:


Problem description:

I got this code from a long time coder:

"usr".loc=location(1,1,1) // allows lvl change
"usr".loc=location(1,1,2) // allows lvl change
"usr".loc=location(1,1,3) // allows lvl change
"usr".loc=location(1,1,4) // allows lvl change
"usr".loc=location(1,1,5) // allows lvl change

unfortunatly..it wont work!!!!!!
i keep getting:
bug catcher.dm:20:error: expected expression


ANY1 KNOW WATS WRONG?????
When changing someone's location, it would be usr.loc=locate(x,y,z). The quotations are screwing you up and you seem to have location. If that is your own proc, I do not know. Although, when using usr, be careful. I would advise that you use src instead if you are calling this proc outside their own mob already, such as src.loc=locate(x,y,z) or loc=locate(x,y,z).
In response to Kija
ty for your help.. but now i got a new problem.....

wat u said is a:

bug catcher.dm:25:error:= :invalid proc definition
bug catcher.dm:26:error::invalid proc definition

and i used usr because i need to teleport the user to the next lvl.... usr is user right!
In response to Devin148
Devin148 wrote:
and i used usr because i need to teleport the user to the next lvl.... usr is user right!

usr is definitly not always the user. For more info about it, read up on UsrLecture.

It would also help to see what you have done where the error is occuring.

~~> Unknown Person
Please use <dm>Code</dm> tags.
In response to Unknown Person
This is the WHOLE THING....

//This is a test world created by Anzu on 12/3/05.

mob

icon = 'people.dmi' //make it so all mobs will be created with the person icon
var
speed = 10 //define a new variable called HP, with a value of 30
bug //new prototype
icon = 'bugs.dmi' //override the parent's icon, which was 'person.dmi'

Login()
icon_state = gender //when a player logs in, get them the right icon state for
..() //the gender of their key. Then call the parent!


proc


DeathCheck() //check to see if an attack is deadly
if (speed <= 0) //if the defender's HP is low enough...
world << "[src] is caught!" //give the death messaging
del(src)

proc
.loc=location(1,1,1)// allows lvl change
.loc=location(1,1,2)// allows lvl change
.loc=location(1,1,3)// allows lvl change
.loc=location(1,1,4)// allows lvl change
.loc=location(1,1,5)// allows lvl change

verb
catch(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You try to catch [M]!" //send this message to the usr
oview() << "[usr] tryes to catch [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] speed is lowered!" //tell the damage to the world
M:speed -= damage //take away the damage from M
M:DeathCheck() //check for death with a proc

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

turf
grass //define a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //that has an icon named 'grass.dmi'. In single quotes!
water
icon = 'water.dmi'
world //set one of our world's characteristics:
turf = /turf/grass //its default turf is the grass turf.


i am havin trouble with the

proc
.loc=location(1,1,1)// allows lvl change
.loc=location(1,1,2)// allows lvl change
.loc=location(1,1,3)// allows lvl change
.loc=location(1,1,4)// allows lvl change
.loc=location(1,1,5)// allows lvl change

part!


I have also tried

usr.loc=location(1,1,1)// allows lvl change
usr.loc=location(1,1,2)// allows lvl change
usr.loc=location(1,1,3)// allows lvl change
usr.loc=location(1,1,4)// allows lvl change
usr.loc=location(1,1,5)// allows lvl change


and

usr.loc=location(1,1,1)// allows lvl change
scr.loc=location(1,1,2)// allows lvl change
scr.loc=location(1,1,3)// allows lvl change
scr.loc=location(1,1,4)// allows lvl change
scr.loc=location(1,1,5)// allows lvl change

In response to Devin148
It is loc or src.loc, not .loc, and if you are setting someone's location, it would be locate(), not location().
In response to Kija
Ugh, lots of mistakes there, really.
Try reading some tutorials. They help a lot.
Devin148 wrote:
I got this code from a long time coder:

"usr".loc=location(1,1,1) // allows lvl change
"usr".loc=location(1,1,2) // allows lvl change
"usr".loc=location(1,1,3) // allows lvl change
"usr".loc=location(1,1,4) // allows lvl change
"usr".loc=location(1,1,5) // allows lvl change

unfortunatly..it wont work!!!!!!
i keep getting:
bug catcher.dm:20:error: expected expression

ANY1 KNOW WATS WRONG?????

Yep. You trusted an idiot. If this person has been programming a long time, then they're incapable of learning.

First of all, "usr" in quotes like that is a string. You can't use "string".something in DM and expect anything but a compiler error. A string is not an object. It has no loc to set.

Second, usr has no place in a proc, especially a LevelUp() proc. It needs only one piece of information, src, which should be the mob gaining a level. (Of course if you're referring to a transition between different maps, not "levels" in the sense of RPG levels, that's a different story. But still, a proc is not a verb, and should not use usr.)

Lummox JR

In response to Lummox JR
try this out
world

mob=/mob/player // Or whatever you call it

mob

player // Necesary for the world
icon='optional.dmi' // Just for the prettyness not Necesary

proc
Procname(mob/M)
M.loc=locate(1,1,1)// allows lvl change
M.loc=locate(1,1,2)// allows lvl change
M.loc=locate(1,1,3)// allows lvl change
M.loc=locate(1,1,4)// allows lvl change
M.loc=locate(1,1,5)// allows lvl change

don't mind the spelling errors in the comments, im dutch
In response to Meganutter
The M argument in that proc is totally bogus. You have src. Need you no M.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
The M argument in that proc is totally bogus. You have src. Need you no M.

Lummox JR

my experience with src is it seeks out the nearest non-player mob and adresses that maybe that could be the problem of this code
In response to Meganutter
Meganutter wrote:
my experience with src is it seeks out the nearest non-player mob and adresses that maybe that could be the problem of this code

Dude, do you actually know anything about DM? Go read the Guide, right away.

src is the mob (or obj, turf, or what have you) that owns the current proc. If you call monster.MyProc(), then within that proc src will be the monster.

There is no simpler concept in DM than src. If this is eluding you, you need to learn a lot more. And until you do, you need to stop posting on code problem threads except when they're your own, because you can't offer advice if you don't know what you're doing.

Lummox JR
In response to Meganutter
sooooo i finaly got it to have no errors with everyones advice...TY!!!!!!

but the map switch in the "Z" variable still doesn't change.....
i dont know if this will help, but to get to the next map "z" thingy i need to "kill" everything on the small 20X20 map.