• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • 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 [Solved] layer_get_id acting weird.

S

Symmetrik

Guest
I'm not sure if this is strange or I don't fully understand layers yet, but this keeps happening with what I've got in the create event...

Create Event:
Code:
background = layer_create(1000);
var layerID = layer_get_id(background);
I've also tried with quotation marks:
Code:
background = layer_create(1000);
var layerID = layer_get_id("background");
And this keeps appearing in my compile log:
Code:
Object: obj_control Event: Create at line 53 : cannot redeclare a builtin varable
Object: obj_control Event: Create at line 53 : Symbol ) expected
Object: obj_control Event: Create at line 53 : wrong number of arguments for function layer_get_id
Object: obj_control Event: Create at line 53 : malformed assignment statement
Is there something wrong or is it just me?
 

mMcFab

Member
layer_create returns the layer ID, so you don't need to call layer_get_id - that's more for getting layers you've created in the IDE (You pass the name as a string to get the ID).
Also, I don't know what variable you're using at line 53, but it seems it's using a built in name, so it may need changing (unless this is one of those errors that creates more errors when one thing is wrong)
 
S

Symmetrik

Guest
layer_create returns the layer ID, so you don't need to call layer_get_id - that's more for getting layers you've created in the IDE (You pass the name as a string to get the ID).
Also, I don't know what variable you're using at line 53, but it seems it's using a built in name, so it may need changing (unless this is one of those errors that creates more errors when one thing is wrong)
Okay that makes sense. A lot of the layer functions I don't quite understand yet, but I'm managing to get through with them.
 
Top