static bool Game.LockSave help needed

Started by subspark, Wed 09/09/2009 03:08:20

Previous topic - Next topic

subspark

Hey guys,

I'm creating a static bool that disables the save buttons in two GUIs but I'm having difficulty with the syntax.

Heres my code:

Code: ags
// top of global script
static bool Game.LockSave;

function repeatedly_execute_always ( )
{
  if (Game.LockSave == true) {
    bMainSave.NormalGraphic = 361;
    bMainSave.Enabled = false;
    bSave.NormalGraphic = 363;
    bSave.Enabled = false;
  }
  else {
    bMainSave.NormalGraphic = 873;
    bMainSave.Enabled = true;
    bSave.NormalGraphic = 333;
    bSave.Enabled = true;
  }
}


I keep getting the typical error: Variable 'Game' is already defined. Am I not allowed to write my own 'Game.' function or something?

Cheers,
Sparky.

Gilbert

Right, because it's already reserved by the engine, that we have functions and variables like Game.AbortGame() (which could be shortened to just AbortGame() AFAIK).
Also, to define members to a struct you cannot just write something like:
Code: ags
int Blah.haha;


You need to write something like:
Code: ags

struct Blah {
  int haha;
  String hoho;
};


Anyway, why can't you use names like "game_locksave" instead?

SMF spam blocked by CleanTalk