Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: subspark on Wed 09/09/2009 03:08:20

Title: static bool Game.LockSave help needed
Post by: subspark on Wed 09/09/2009 03:08:20
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:

// 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.
Title: Re: static bool Game.LockSave help needed
Post by: Gilbert on Wed 09/09/2009 05:14:03
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:
int Blah.haha;

You need to write something like:

struct Blah {
  int haha;
  String hoho;
};


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