Question concerning id

Sybok

Member
Last edited:

tetris_mess

Member
The error hit and it was caught...duh...duhhhhhhh

just trying to lighten the mood boys

I trust you guys. All the people on these forums. I know you are like family members that won't keep relapsing.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
@Master Cabalist... you know, you can't break GameMaker just by trying stuff!!! So test, test, test, and see for yourself what happens! It'll either work or it won't so you should simply try things and if they don't work, check your chain of logic, check the error you get, check the manual, and see if you can fix the logic and/or error yourself. This is the best possible way to learn, imho... And if you can't resolve the issue or still have questions, then post and ask for help, showing the code you've tried, and explain why you've done it that way and what you want to achieve.

Also note that making topics like this, with very little information and questions that are rather open ended and have little context, means that people will have a hard time giving you a meaningful reply (as has already been shown by the replies above... :( ).
 

TailBit

Member
As a statement, this will never be true .. as it can't collide with itself .. instance_place could return the id of another instance of SpecialBrain if there is one, but not the one running the code.
 
As a statement, this will never be true .. as it can't collide with itself .. instance_place could return the id of another instance of SpecialBrain if there is one, but not the one running the code.
Yeah that's what I thought...….
(Edit)
It's part of my program. I'm having trouble with collision. I have 4 collision functions that whose architecture are the same but only 3/4 of them works. . Should I post?
 

Sybok

Member
As a statement, this will never be true .. as it can't collide with itself .. instance_place could return the id of another instance of SpecialBrain if there is one, but not the one running the code.
It's not even a comparison, it's a malformed assignment. He is telling it to be "== id".
 

TailBit

Member
Yes, as a code it is broken, but as a statement it works..

.. with the knowledge of the discussion in the other topic I didn't see the need to treat it as anything else.
 
Last edited:

EvanSki

King of Raccoons
A syntax error
multiple even.


Edit: see new comment
I answered the question, why the sad-

okay first off == is for comparing
having instance_place(x,y,specialbrain) == this will throw an error because your using an function as a statement

so going along, your comparing that with id, so id will only ever be the id of the object running the code line so it would look something like this
instance_place(x,y, SpecialBrain) == 100004
this will always return false as instances have unique id's

lets just say for an example here this code works
instance_place(x,y, SpecialBrain) would return an id
then your asking if that id is the same as the call stack instance
10005 == 100004
again this will only ever be false

if you are comparing you need an if in front of it because your checking an value

if 10005 == 100004

so to use this code without errors go about it like this
GML:
var brain = instance_place(x,y, SpecialBrain);

if (brain == id)
{
    //do code but this will never run as the statment will always return false
}
edit: or go with @chamaeleon 's example
 

EvanSki

King of Raccoons
@EvanSki Maybe you can take on a problem I have with collision. Its related to that up there.
With out needing to be paid money for time and effort ( nothing personal I hate collision systems)
I'd say just make them solid and have an collision even with a comment in it, game maker will take care of the rest

edit: also there are most definitely 100% im sure of better members here in this topic that are way better then I at collisions
 
Last edited:

TsukaYuriko

🌠
Forum Staff
Moderator
To answer the original question...
instance_place(x,y, SpecialBrain) == id
The result of this would be true if the instance ID of the instance of SpecialBrain that is colliding with the mask of the calling instance positioned at x, y is equal to the calling instance's ID and false if this is not the case.

Because instance_place does not detect collisions with the calling instance, the result of this is therefore false.
 
Top