Pages: 1 2
Author Topic: Turning On A Variable Disables Character Movement  (68,254 Views)
Offline (Unknown gender) Hoohee

Member
Joined: Aug 2017
Posts: 40
View profile
Reply #15 Posted on: February 06, 2018, 08:50:42 AM
I'm bumping this to say that I've never gotten this error before, so far as I know.  Why declaring some global variables would cause it, I also don't know.

I also converted everything involving global variables (I think) to code.  Granted, it was GML, so that might not work completely.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #16 Posted on: February 06, 2018, 05:02:42 PM
As you have probably noticed, [snip=edl]var<Vacuum> object_Mouth[/snip] is not valid syntax (well, it technically resembles valid syntax, but as the compiler pointed out, var is not a template).

The error you posted is actually a warning; it will not prevent your game from building nor harm its function. Interesting to note, though—I'm not sure why that function is being generated if ENIGMA is not using it. Probably a sloppy refactor.

How are you assigning to this global variable? How are you reading from it? This sounds as though there may be disparity, there. Are you declaring it global explicitly? If so, how?
Offline (Unknown gender) Hoohee

Member
Joined: Aug 2017
Posts: 40
View profile
Reply #17 Posted on: February 16, 2018, 04:04:37 AM
In the title screen of the game, I have an object containing this code in its "Create" event.

globalvar Vacuum;
Vacuum = 1;
globalvar Fuel;
Fuel = 1;;


Then in the level, following, there is another object made specifically for declaring these global variables again; except as 0.  I was told that it's better to declare global variables as 1 initially, but the way I made my game in GM, they were supposed to start at 0.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #18 Posted on: February 19, 2018, 06:55:47 PM
I can't think of any reason to favor declaring globals as one instead of zero. But "globalvar" is a GameMaker: Studio construct; ENIGMA just has you say "global var" instead. I can't tell if the compiler recognizes that you are trying to declare a global, or if it just assumes you left our two semicolons and wanted to say a bunch of variable names for no reason. The point is, it's possible globalvar just isn't working (although it seems to be declared in actions.h. Try printing the value in another object to make sure it's being persisted.

Otherwise, it could be an event ordering issue. Try setting it to what you mean instead of to one and then the correct value later.
Pages: 1 2