Script error when using FOA_temp_v20c.agt template

Started by Deax Strife, Mon 26/12/2005 18:26:02

Previous topic - Next topic

Deax Strife

I downloaded the FOA_temp_v20c.agt because it had a SCUMM GUI, which was excactly what i was looking for.

I started a new game using the template and everything seemed to work just fine until i tried to save the project. Then this error came:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 223): 'gui' is a global var; cannot use as name for local

Do you want to fix the script now? (Your game has not been saved).

I changed the script and called it 'gue' instead just to test it, but then it said:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 223): 'object' is a global var; cannot use as name for local

Do you want to fix the script now? (Your game has not been saved).

Any suggestions as to what is wrong? Help will be appreciatedÃ,  :)

The script from line 223 to 233 is:

function GetLucasSavegameListBox(int gui,int object) {
Ã,  // Fills a listbox with the savegames in the lucas format: '1. description'
Ã,  string buffer, sgdesc;
Ã,  int counter=0;
Ã,  ListBoxClear(gui,object);
Ã,  while (counter<MAX_SAVEGAMES) {
Ã,  Ã,  StrFormat(buffer,"%d. ",counter+1);
Ã,  Ã,  if (GetSaveSlotDescription(counter+100,sgdesc)!=1) StrCopy(sgdesc,"");
Ã,  Ã,  StrCat(buffer,sgdesc);
Ã,  Ã,  ListBoxAdd(gui,object,buffer);
Ã,  Ã,  counter++;Ã,  Ã, 

Elliott Hird


Deax Strife

I have done as you said, and it works, until i come to line 293. Then this error comes:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 293): Local variable cannot have the same name as an import

Do you want to fix the script now? (Your game has not been saved).

Any suggestions to this one?

Line 293 to 299

int hotspot=GetHotspotAt(mouse.x,mouse.y);
  if (room==1 && hotspot==4){// if hotspot 4 of room 1
    if (GetGlobalInt(1)==0){ //if its closed
      return OPEN; //set 'OPEN' as default action
    }
    else{ //if its open
      return CLOSE; //set 'CLOSE' as default action

Deax Strife

This is the script:

  // ** CUSTOM INVENTORY WINDOW
  gInventory.Visible = true;
  // switch to the Use cursor (to select items with)
  mouse.Mode = eModeInteract;
  // But, override the appearance to look like the arrow
  mouse.UseModeGraphic(eModePointer);

When i try to save the project this error comes:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 26): Undefined token 'gInventory'

Do you want to fix the script now? (Your game has not been saved).

Any suggestions?

What i did was that i exported the gui from FOA_temp_v20c.agt and imported it into my own project, so that i could have the GUI. Please help  :'(

SSH

Just delete that line, as the FOA GUI has the inventory built in
12

Deax Strife

#5
Thanks, but when i do that i am taken to these lines of script:

//   Setting cursor modes:
//-----------------------------------------------------
Ã,  Ã,  if (button == 0)Ã,  SetMode(GIVE);
Ã,  Ã,  if (button == 1)Ã,  SetMode(PICKUP);
Ã,  Ã,  if (button == 2)Ã,  SetMode(USE);
Ã,  Ã,  if (button == 3)Ã,  SetMode(OPEN);
Ã,  Ã,  if (button == 4)Ã,  SetMode(TALK);
Ã,  Ã,  if (button == 5)Ã,  SetMode(PUSH);
Ã,  Ã,  if (button == 6)Ã,  SetMode(CLOSE);
Ã,  Ã,  if (button == 7)Ã,  SetMode(LOOK);
Ã,  Ã,  if (button == 8)Ã,  SetMode(PULL);

And this message comes out:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 75): Undefined token 'SetMode'

Do you want to fix the script now? (Your game has not been saved).

And if i delete the first line it will say the same thing until thay all are gone, and i think they are necessary. Are they? ???

If not what should i do?

Thanks


strazer

Just as you did with "gui" and "object", rename the "hotspot" variable to "myhotspot", for example.

From the manual:

Quote from: Manual
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.

Deax Strife

All right i've renamed all of the gui, object and hotspot lines in the script, but now a new error message has come:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 449): Function decleration has wrong number of arguments to prototype

Do you want to fix the script now? (Your game has not been saved).

Heres the script:

function GoToCharacterEx(int charidwhogoes, int charidtogo, int direction, int xoffset, int yoffset, int NPCfacesplayer, int blocking){
  //Goes to a character staying at the side defined by 'direction': 1 up, 2 right, 3 down, 4 left
  //and it stays at xoffset or yofsset from the character. NPCfacesplayer self-explained. ;)
  // blocking: 0=non-blocking; 1=blocking; 2=semi-blocking.
  // returns 1 if player arrived.

Please help  :'(

monkey0506

That means that somewhere in your script (probably the script header) there is a line such as "import function GoToCharacterEx(...)" that has a different number of parameters than the function declaration you posted.

Try going to your script header, pressing Ctrl+F, then type in "import function GoToCharacterEx" and press Enter.  It should take you to the line where the function is imported.  Then you can post that here for further help.

monkey0506

Is it possible that it should read as "SetCursorMode"?

Deax Strife

Sorry. It says:

Search string not found

What should i do now?

Deax Strife

Thanks, but when i do that this message appears:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 75): Undefined token 'SetCursorMode'

Do you want to fix the script now? (Your game has not been saved).

Suggestions?

strazer

#12
Quote from: Deax Strife on Mon 26/12/2005 22:42:53Error (line 449): Function decleration has wrong number of arguments to prototype

Quote from: strazer on Wed 21/12/2005 21:24:40
The error means that the function header in the global script, e.g.
  function GoToCharacterEx(int a, int b, int c) {
does not match the import statement in the script header, e.g.
  import function GoToCharacterEx(); // causes error because parameters are missing
instead of
  import function GoToCharacterEx(int a, int b, int c); // correct

The templates have been written with older versions of AGS and they are not updated regularly so such errors are to be expected.

Deax Strife

Thank you very much. That solved everything  ;D :D ;)

Deax Strife


SMF spam blocked by CleanTalk