AGS 2.7_gui is a global var; cannot use name for local_MI2 Template!!!

Started by manny.p, Wed 15/06/2005 12:42:25

Previous topic - Next topic

manny.p

I am using the MI2 template in ags v 2.7 and i already get and error when i haven't changed anything.

The error: (line 221) "gui" is a global var; cannot use name for local

function GetLucasSavegameListBox(int gui,int object){  // line 221


My guess here as a n00b, is that in ags 2.7 they've made gui a built in variable or something, so you can't have the same name as it.

But i'm not sure how to correct this, plus that means the MI2 Template is incompatible with the new ags until you edit the script.

Any help would be great. :)

strazer

I've just noticed you posted the same in the main tech forum. No crossposting please!

I have deleted your message and my reply. Here it is again:

Correct. As stated in the AGS v2.7 upgrading guide:

Quote
Is there anything else I should watch out for?

Because of the new additions, the script language has more reserved words than before. For example, words like "gui", "object" and "hotspot" are now reserved (since they are used to access the global arrays). If your script uses any variables with these names, it will no longer work. You'll need to change the variable name in order to compile.

So you'll have to rename the affected variables everywhere in the script, for example:

Code: ags

function SomeFunction(int gui, int hotspot) {
  Display("GUI is ", gui);
  GuiOff(gui);
  int a = hotspot + 3;
}


becomes for example

Code: ags

function SomeFunction(int gui_id, int hotspot_id) {
  Display("GUI is ", gui_id);
  GuiOff(gui_id);
  int a = hotspot_id + 3;
}

manny.p

I'm not quite sure how i do this.

function GetLucasSavegameListBox(int gui,int object){  // line 221

i'm guessing i change "gui" to "gui_7", because thats what the savegamelistbox is under the gui editor.

but what do i change "object" to?

strazer

It doesn't matter what you call the variable. You can rename "object" to "flubby" if you like, you just have to replace every occurance of "object" in the GetLucasSavegameListBox function with the same word. I would use "object_id", for example.

manny.p

Ahhh i understand now.

In the new ags you can have "object_1" "object_2" and so on in that certain function.

or just call them the names like "banana" or "pillow" but they are only used in that function, well thnx for the help!

SMF spam blocked by CleanTalk