This is what not working on BYOND for a year or so does to one.
I feel stupid asking this question, but I need to create turfs at a specific location, how would I do it?
I tried
new /turf/floor (rx,ry,rz) but it doesn't work because I get a bad loc runtime.
It's been a while since I've done any major BYOND stuff, so I feel like the answer is sitting in my brain and I just don't know what it is. Any help would be great.
~Polantaris
ID:160891
Jul 13 2008, 8:38 am
|
|
In response to Kaioken
|
|
Two things about that though:
1) Theres technically no turf already there (besides the base turf of just /turf) 2) I'm replacing every single turf on the map (I'm creating a random dungeon generator). How would I refer to that specific spot in the most efficient way? |
In response to Polantaris
|
|
Polantaris wrote:
1) Theres technically no turf already there (besides the base turf of just /turf) Which is a turf, so how can you say there is technically no turf? Really. =P Anyway, it makes no difference. 2) I'm replacing every single turf on the map (I'm creating a random dungeon generator). This is kind of a problem, because I don't think there is a way to create a turf at a specific point other than "replacing" a turf that is already there*. <small>*: Technically speaking there is one more way - increasing the world.maxX,Y,Z vars, which if you increase by 1, will create 1 turf of the type of world/turf at that specific spot, with the exception of Z which will create X*Y turfs, of course.</small> |
In response to Polantaris
|
|
He told you efficiently enough. Use locate() if you're using coordinates.
Also, putting a new turf there will replace the one before it, since there can only be one turf on any place on the map. |
In response to Naokohiro
|
|
Wasn't reading it correctly the first time, my bad.
I've tried that just now, but I may not be doing it correctly (I've never really used locate() in this manner) BasicFill(rz) I still get a bad loc runtime. Am I using it incorrectly? |
In response to Polantaris
|
|
Polantaris wrote:
I still get a bad loc runtime. You are now not supplying an argument for the loc at all. If you are rusty on DM, you should use the documentation even more. Look up 'new()' in the Reference (I also suggest reading the DM Guide) - the loc argument is supposed to be the first argument in the parentheses, if any. Since you've used the syntax with no parentheses, you are supplying no arguments. Also, variables' defined type has almost no purpose outside of the compiler's error checking. It does not effect the variable's value or any other function at all (except in special instructions where it can be used as a shortcut or those that specifically use it such as for()) - so both of these blocks of code are the same (and wrong): var/turf/t = whatever var/t = whatever |
In response to Polantaris
|
|
No need for your var/turf/t. Turfs must have their loc set in their new proc, which is what is giving you that error.
e.g.
new/turf/permawall(locate(rx,ry,rz))
|
In response to Kaioken
|
|
Ah now it's working for me. Thanks, I can't believe I'm this rusty, but thanks again.
|
Remember: a location == an atom. Numbers/coordinates are not a location, but you can call the locate() proc to get an atom (turf) at those coordinates.