• 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.

 Small Feature Request

G

gloomytoad

Guest
Hello,

I have been doing some pretty complex stuff in GameMaker recently and one thing that would really help is having script local macros. For instance in networking my scripts receive an array for an argument. My scripts are specific to each different packet identifier, and the data in the provided array will be different every time.

So instead of having (trivial example)

Code:
_receivedData[0];
_receivedData[1];
I could instead do.

Code:
#lmacro X 0
#lmacro Y 1

_receivedData[X];
_receivedData[Y];
And this would not auto populate in the auto complete from other scripts, as well as not being accessible. Basically on compile an "lmacro" would only work in that script that it was defined in. This would help keep things much cleaner for a lot of stuff I do.
 

FrostyCat

Redemption Seeker
Local variables are the closest thing to what you're looking for. They also show up on AutoComplete in the same piece of code only.
Code:
var X = 0,
    Y = 1;
show_debug_message(_receivedData[X]);
show_debug_message(_receivedData[Y]);
 
G

gloomytoad

Guest
Local variables are the closest thing to what you're looking for. They also show up on AutoComplete in the same piece of code only.
Code:
var X = 0,
    Y = 1;
show_debug_message(_receivedData[X]);
show_debug_message(_receivedData[Y]);
I know, was just thinking local macros would avoid the computational hit. (Thought I know it is very minor). Just had a lot of instances where they would be useful lately!
 
Top