ID:97903
 
Not a bug
BYOND Version:471
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 5.0.375.86
Applies to:Dream Seeker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND Developer forums.
Descriptive Problem Summary:
Click() doesn't get called for atoms if atom's location is null.

Numbered Steps to Reproduce Problem:
Download Demo, compile and run. Click on the mob on the grid - nothing happens. Remove comment from "P.loc = locate(1,1,1)" in main.dm, compile and run again, now clicking mob works.

Demo for reproduction:
http://dl.dropbox.com/u/2637453/demo_src.zip

Expected Results:
Click() to be called.

Actual Results:
Click() doesn't get called.

Does the problem occur:
Every time? Or how often?
Everytime.
In other user accounts?
Yes.
On other computers?
Most likely.

When does the problem NOT occur?
When mob (or atom) has location.

Workarounds:
Assign some location.
As you (unfortunately) did not include the actual code snippet in text form, I'll have to ask. Did you keep any reference to the object you're displaying in the grid?
What you describe sounds exactly like it is being garbage collected, due to lacking reference in the first case, and on the second case of having an actual location, would gain a reference and thus persist.
There's link to download source 0.o

There's no variable to hold reference, doesn't grid count as reference?
Ripiz wrote:
There's link to download source

I try to keep downloading random files on the internet to a minimum. And on such a case, where a few lines of code suffice to detect an issue, I prefer to simply read the code in text form on the bug report (which seems encouraged due to the actual paragraph requesting to code snippet in question on the template).


Ripiz wrote:
There's no variable to hold reference, doesn't grid count as reference?

No, a grid does not count as reference. You have to ensure this on your own.
Please try to resolve code problems on the developer forums before posting a bug report. The need to keep a reference to objects sent to a grid is documented.
Sorry about that, I rarely read documentation, only look what arguments proc needs.
Ripiz wrote:
I rarely read documentation

In which case it's not astonishing that you're running into problems. The real issue on that is less the trouble that arises for you, but the time others spend intended to help you (which could have been directed elsewhere).
I understand plowing ahead without looking too close at documentation, but it's the first place you should look when you run into problems. If you don't find anything, then you need to turn to the developer forums. You should only post a bug report when the forums have failed to net a solution.

In this case the relevant information is under the "Grids and Info" section of the skin reference.
Very important: If you send an atom to a grid like you would with a statpanel, keep that object in a list or make sure it actually exists somewhere in the world. Do not use a temporary object that will be deleted when the proc ends, or it can disappear/change in the grid when a new object is created. Statpanels don't have this problem because of the way they update, but it's a good idea even there not to use temporary atoms.
Given how frequently this comes up though, I'm open to suggestions on how to make that issue clearer.