ID:138693
 
I'm not too sure whether this is a problem with my code or with BYOND, so I'll just bring it here.



for(M in world)
var/xloc
var/yloc
if(src.x < 5)
xloc = 5
if(src.x > 17)
xloc = 17
if(src.y < 5)
yloc = 5
if(src.y > 17)
yloc = 17
M.loc = locate(xloc,yloc,1)




Does this look all right? Well, if it does, then locate is broken because it locates me to 0,0,0.



(Whoa, this forum spaces out code a lot... btw, merci beaucoup for the preview function =)
On 3/22/00 1:11 am Spuzzum wrote:
I'm not too sure whether this is a problem with my code or with BYOND, so I'll just bring it here.

Are you sure you want to do src.x, src.y, etc? Just looking at your code, I would assume it would be M.x, M.y, etc:
<code><pre>for(M in world)
...
if(src.x < 5) // don't you want M.x ?
...
</pre></code>
(Whoa, this forum spaces out code a lot... btw, merci beaucoup for the preview function =)

Spacing is now fixed. Boy, it didn't take long to find a forum bug did it :)
In response to Tom H. (#1)
On 3/22/00 1:29 am Tom H. wrote:
Are you sure you want to do src.x, src.y, etc? Just looking at your code, I would assume it would be M.x, M.y, etc:

Matter-of-factly, I actually don't. This is a snippet that locates all of the players in my game to the location of the object clicked so that they can see the current player's move for this turn.

I simply destroyed that code and replaced it with src.loc. I had initially done this so that you would only be able to see 1 narrow strip of the outside edge, and to do that, if you were within a certain distance, you would have to locate to the nearest x (or y) value that wasn't within that distance.

Just an aesthetics issue. No big problem at all, though I'm still wondering why locate didn't work...

Btw, this game is now officially finished. I have finished my first BYOND game in less than 4 hours. It's a real accomplishment for me, considering the time required for my other games =)
In response to Spuzzum (#2)
Hmf. Have you ever gotten locate(x,y,z) to work, then, or is this just some special case that seems to fail? That would be odd. I'll try to test tommorow (I am mucho tired right now), but if you could be so kind as to send me a self-contained ditty that does the trick, that would be best.