GML crazy way to tincker with variables??

M

mst3kdavid

Guest
I didn't know what to put in the title for this so I apologize for the click bate ish title

My question is can there be two separate objects both programed with the same global.variable but that variable changes it's name based off of some state or position in the room?
 

Smarty

Member
GMC Elder
Whatever you're trying to accomplish, trying to change variable names isn't going to work because that's just not possible.
 
M

mst3kdavid

Guest
just wondering for the sake of automation
I just realized I could just use an array or grid to do the same thing. I'll delete the entry to the array that an object last entered when it wants to enter a new one.
 

Blaize

Member
I just realized I could just use an array or grid to do the same thing. I'll delete the entry to the array that an object last entered when it wants to enter a new one.
You can replace array entries, but you can't delete them.
 

TheouAegis

Member
Or you could append an identifier if some sort to the value.

myID = n/256;


global.variable = myID + value;


if global.variable mod 1 == myID {
var v = global.variable div 1;
F(v);
}
 

Smarty

Member
GMC Elder
For lookups like these with arbitrary names, I think a map is the easier solution for this.
 
Top