Access to instance Id name---> inst_259xxx

E

equinox

Guest
Good morning.
I would like to access the id of uin object CAR -> inst_25159

but with
with (inst_25159) instance_destroy (); ..... I have an error.

How can I use inst_251xxx?
 
I

immortalx

Guest
Why don't you destroy it with instance_destroy(inst_25159)
 

TsukaYuriko

☄️
Forum Staff
Moderator
If an error message is thrown, please post the full error message and all relevant code.

For reference: How to Q&A


That aside, does the instance you're trying to manipulate exist in the current room and is it not deactivated?
 
E

equinox

Guest
Yes, the instance (obj_car) exists in the room at the beginning of the game.

in room editor I put obj_car with the mouse and read: id: inst_259xxx

the code is simple:

in obj_destroy -> press A key ---> with (inst_259xxx) instance_destroy ();
the error is: .... that does not destroy me obj_car !!!!

tried in all possible ways:

with ("inst_259xxx")
with (string (inst_259xxx))
with (real (inst_259xxx)
.............etc. etc
nothing works.

Any help, please?
 

samspade

Member
Yes, the instance (obj_car) exists in the room at the beginning of the game.

in room editor I put obj_car with the mouse and read: id: inst_259xxx

the code is simple:

in obj_destroy -> press A key ---> with (inst_259xxx) instance_destroy ();
the error is: .... that does not destroy me obj_car !!!!

tried in all possible ways:

with ("inst_259xxx")
with (string (inst_259xxx))
with (real (inst_259xxx)
.............etc. etc
nothing works.

Any help, please?
As TsukaYuriko said, you should post the error message and relevant code. Have you done the other things TuskaYriko said - such as verified that it still exists in the current room and is not deactivated?

You might want to run the game with the debugger on so you can check what's going on when it crashes.
 

TsukaYuriko

☄️
Forum Staff
Moderator
the error is: .... that does not destroy me obj_car !!!!
Let's be 100% clear here... is the game spawning a window with a message and crashing or is your code not doing what you want it to do?

The first is an "error".
The second is "unexpected behavior".

Make sure to use the appropriate term in the right scenario. Doing otherwise will bring any troubleshooting process to a grinding halt as we will end up chewing you out for information you don't even have to begin with while being unable to collect the information we actually need.


If your problem can be described as "error": Please post the actual error message and especially don't summarize it as "doesn't work".

If your problem can be described as "unexpected behavior":
Does the event run? Put other code which makes itself apparent when it runs in the corresponding event, such as show_message. Does this code run when you execute the action that triggers the event?
Are you destroying and re-creating this instance at run time? This will invalidate the ID. Ensure that your method of reference is valid for your usage case.

Yes, the instance (obj_car) exists in the room at the beginning of the game.
More specifically, does it exist at the point you're trying to destroy it? (This might sound like a stupid question, but keep in mind we have no idea whether the thing you're destroying may be periodically destroyed and re-created or the like...)
Another question was whether it is not deactivated at that time, as you can not destroy instances which are deactivated.

As you seem to be attempting alternative ways of doing what the destruction line included in the first post is intended to do: Don't, as your first attempt was perfectly valid. The source of the issue is something else.



@samspade gets an award for writing my user name perfectly and then misspelling both parts of it in the same paragraph. :p
 
Top