ID:266383
 
I am using the following code to, visually at least, place a link marker over a complete fox hole:
obj/FoxHole
name = "Uncomplete Fox Hole"
icon = 'Holes.dmi'
icon_state = "blank"
var/obj/FoxHole/Complete/link
New()
..()
link = src
Complete
density = 1
proc/Link()
world << "link called"
if(usr.images["Link-Marker"] == null)
world << "no pending link"
usr.images["Link-Marker"] = image('Markers.dmi',src,"Link-Marker",6)
src << usr.images["Link-Marker"]
world << "link marker added"
usr.link_ref = src
src << "link_ref = [src]."
else
world << "pending link found"
del usr.images["Link-Marker"]
usr.images["Link-Marker"] = null
world << "link marker set to null"
src.link = usr.link_ref
usr.link_ref = null
src << "usr.link_ref is now null, and src.link = [src.link]."


Now, here is the problem: sometimes, the link marker pops up right on top of the hole. This is wanted. However, sometimes it appears to the side of the hole. How is this possible? Also, when the debugging message "link_ref = [src]" comes out in DS as "link_ref = Lord of Water". It seems to me that the src variable is getting messed up somewhere! Am I not correct in my understanding that src should be the hole, and not me?

-Lord of Water
I added the following debugging line to the proc:

world << "usr: [usr]. src: [src]."

And, upon running the program, it output the following:

usr: Lord of Water. src: Lord of Water.

Aah!
How/Where is Link() being called?
In response to Cinnom
The user calls it. It's added to their verbs.
In response to Lord of Water
If the user calls it from his own verbs list, wouldn't he be the src?
In response to Cinnom
I see... then, how do I make sure that src is the hole?
In response to Lord of Water
Make Link() a verb, and have it set src in whatever.
obj/FoxHole/Complete/verb/Link()
set src in world
In response to Cinnom
I eventually figured it out. If I could delete this entire thread, I would. Thanks anyway, Cinnom.

-Lord of Water, who learned something new today!
Lord of Water wrote:
I am using the following code to, visually at least, place a link marker over a complete fox hole:
> obj/FoxHole
> name = "Uncomplete Fox Hole"
> icon = 'Holes.dmi'
....

Incomplete

FIREking of Gen3dDev
In response to Lord of Water
Delete one of these! :P

-Rcet