ID:148062
 
Im trying to make a statpanel that has different icons of different turfs. My code is:
mob
Stat()
statpanel("Turfs")
var/turf/normal/T = new
stat(T)

but I keep getting run-time errors say "bad loc"
What is wrong?
It should be new(), and not just new, big difference.
In response to Nadrew
mob
Stat()
statpanel("Turfs")
var/turf/normal/T = new()
stat(T)

Didn't work. Same error:
Setting network delay to 0.
runtime error: bad loc
proc name: Stat (/mob/Stat)
usr: Airjoe (/mob)
src: Airjoe (/mob)
call stack:
Airjoe (/mob): Stat()
In response to Nadrew
Maybe this is a bug:
It works if I try to do it with an obj, but not with a turf. Is it just that turfs can't go in statpanels?
In response to Airjoe
I think you need to create some object thing...I remember reading about it a while back...
In response to Airjoe
i havent used dm in a while i always did it something like this
var/T = new /turf/normal
In response to Airjoe
i know tht turfs CAN show up in the stat panel, i did ity by accident once, but it only showed what you were standing on... i put this: statpanel("location","location",loc) under mob and it pops up with a turf icon in the stat panel.
im sure with some tweeking this might help you... maybe change loc to /turf/grass or what ever. i dunno, hope this help tho!
In response to Nadrew
Bzzzt! Sorry Nadz, thanks for playing. new() and new are exactly the same thing. =)

The problem is that you can't just create a turf at null; it has to have a location when you create it, like this:

<code>var/turf/normal/T=new(locate(3,2,1))</code>
In response to Hendrix
If any of you had heads on your shoulders, this would not be a problem. THINK an obj and mob are derived types of atom/movable MOVABLE atoms can change locs, and can have no loc (loc = null), BUT This is the upgrade movable atoms obtain over their derived type, ATOMS, ATOMS are stationary objects, which means they can not move from their initial location once created, unfortunately, I see no reason why it can not have a null loc. BUT one thing is for sure, you can't do it. YOu have to find a new way to do this, and I see no purpose for what you are trying to do.
In response to Redslash
this is true, because the turf already has a loc, it is not an issue whether that turfs can be put into panels, it is how he is going to do this with a turf a null loc, it won't work, an atom (NOT MOVABLES) must have a loc. Plain and simple.
In response to Crispy
So, if I gave all mobs a list var called turfs, and then I put new(locate(usr.turfs), and then put
Stat()
statpanel("Blah")
stat(usr.turfs)

would that show the turf? Thanks

Airjoe
In response to Ter13
Ter13 wrote:
and I see no purpose for what you are trying to do.

Im trying to make a statpanel with turfs,objs, and mobs to place on a map. I am making a map maker. If you are subscribed to proelium, check out the map builder, and you'll see what I mean.
In response to Airjoe
not quite....

make a statpanel.

statpanel("Turfs",usr.turfs)

it's just like making a stat panel for inventory!
In response to Airjoe
I am subscribed, and I see what you are doing now. Okay, good. The best way to do it is with a global list of turfs, objs, and mobs, that can be placed on the map. That is, if they never change. If they change by user, you want it in the client's variables. Why do you need a mob without a game? Okay, just make a statpanel for the global variable of... build_turfs, or whatever.