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

how to make the ide detect if the variable is declared?

molo32

Member
how to make the ide detect if the variable is declared?

i use game maker studio 1.4

I want to know if game maker has a way to check if a variable is declared.

imagine object 1 has the variable "life" and object 2 has

Code:
if (lif> 2) {
//
}

this will give an error when compiling because lif is misspelled and does not belong to object 2.

Code:
if (life> 2) {
//
}
this will give an error when compiling because life is not declared in object 2.

what will work is this

Code:
if (object1.life> 2) {
//
}
it would not be better if the ide shows you the error while you write,
something like "local or global variable not declared"
and avoid waiting for it to compile and show you the error.

Imagine that you misspelled a variable and these hours when you finally compile and realize that you have errors because those variables do not exist in the object. It is a waste of time.
 
Last edited:
If you are using GMS2, then yes, it does automatically tell you whether a variable is unused or not (can't remember if this is in 1.4). You can tell by checking the spacing to the left of the code. If there's a little yellow exclamation mark, that means there's some syntax error of some sort. If you mouse over that, it'll tell you "variable variable_name only referenced once" if you are using a variable that is, unsurprisingly, only referenced on that particular line.

If this is not what happens in GMS1.4 then you are very out of luck. That version of GMS has been sunsetted for many years now and there is no chance at all that they will update or add functionality to it. Upgrade to GMS2.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
GMEdit has variable name auto-completion, which makes it a little harder to shoot yourself in a foot by misspelling.
 
Top