• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code place_meeting and objects

Tapcodia

Member
Lets say i have an object "testBlock" and i put it on the screen and then for the player i have standard "if place_meeting(x,y,testBlock) etc... it works. If i duplicate testBlock and rename it testIce and use the same exact code (with changes to mimic ice) i get an error "Variable objPlayer.testICE(100861, -2147483648) not set before reading it." how do i set an object (its not a variable) and its odd that i was able to create "testBlock" and it works.
 

Mr Magnus

Viking King
Be mindful of capitalization. You said you named it testIce (capital I, lowercase ce) but the error is complaining about testICE with ICE in all capitals. GameMaker is case sensitive: upper and lower case characters matter.
 

Tapcodia

Member
That was an error in this post, in the code i copied the name of the object. Here is another test same results:
if place_meeting(x , y+1, ICEICEBABY) {
// some code
}
gives me this error
Variable objPlayer.ICEICEBABY(100861, -2147483648) not set before reading it.
at gml_Object_objPlayer_Step_0 (line 34) - if place_meeting(x , y+1, ICEICEBABY) {
############################################################################################
gml_Object_objPlayer_Step_0 (line 34)
if i change it from place_meeting to collision_line i get the same error.
Shouldn't i be able to create an object, place it in the room and then reference it by object name? Thats kinda how i see things in some other demo projects. Do i need to declare that object before referencing it?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Shouldn't i be able to create an object, place it in the room and then reference it by object name? Thats kinda how i see things in some other demo projects. Do i need to declare that object before referencing it?
This should work. If it doesn't, either the object name and the way you refer to it in code don't match up (you can easily verify this by typing the start of its name and filling the rest via auto-complete), or something is internally wrong. You may be able to resolve the latter by clearing the compiler cache (broom button next to the run button).
 
Top