ID:2942261
 
Not a bug
BYOND Version:515
Operating System:Windows 11 Home
Web Browser:Chrome 127.0.0.0
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 forums.
Descriptive Problem Summary:
According to Lummox via discord, when a pointer is made to an atom, you should be able to access all variables and procedures like you would normally.

No matter what, however, this causes a runtime error.

I would like to note that accessing variables and procs for other objects (IE non-atoms) works as intended.

Numbered Steps to Reproduce Problem:

1) When you login, look up and you'll see a circle character. Click it and you should receive the following message confirmation: "[KEY NAME] has set the mob as their pointer_to_atom."

2) This sets your variable, "pointer_to_atom" as a pointer to the atom.

3) Use each of the following verbs and see that it causes a runtime error: PrintPointerName (2, 3, 4 all try to print the atom's name in different ways).

4) Try to use "PrintEggs" verb which attempts calls the mob proc "I_Like_Eggs". This is also a runtime error.

5) You can verify that this feature works with non-atom objects by using "Pointer to Data" and "Pointer to List" verbs that set new pointer variables to a datum and a list.

6) PrintData confirms that accessing a datum with a pointer reference works as intended. PrintPointerLen shows that accessing a list with a pointer reference works.

7) i like eggs.



LINK

https://cdn.discordapp.com/attachments/725458744711839873/ 1277819731591696395/pointer_test.zip?ex=66ce8ddc&is=66cd3c5c &hm=a01be39a83b4e5de51e64e24e59ddb0b14c255329b6b20b2f25ab2ec5 dc84e88&

Expected Results:
Pointers let me access variables and functions of an atom.

Actual Results:
Doesn't work.

Does the problem occur:
Every time.

When does the problem NOT occur?
Never.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? I don't know.
Workarounds:
None.
Lummox JR resolved issue (Not a bug)
There's no bug here. The code is broken. This is the problem:

mob
var
atom/pointer_to_atom
Click()
..()
usr.pointer_to_atom = &src
world << "[usr.name] has set [src] as their pointer_to_atom."

You're not setting pointer_to_atom to the atom, but to a pointer, and that pointer is to the src var of the running Click() proc. That pointer is only valid for the duration of the Click() proc.