Error while running my game in AGS 2.6SP1

Started by Bombadil, Sun 15/02/2004 16:56:22

Previous topic - Next topic

Bombadil

Hey people!

I entered the web and found out the AGS 2.6SP1 version was out. I downloaded it and opened the game I am working in. I tested it, but when I click in the screen the game it pops up the following error:
//////////
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.60.698)

Error: run_text_script1: error -1 (Runtime error: wrong number of parameters to exported function 'unhandled_event') running function 'unhandled_event'.
//////////

The function unhandled_event is:
//////////
/**/function unhandled_event(){////////////////////////////////////////////unhandled event
/**/  int type=GetLocationType(mouse.x,mouse.y);
/**/  string locationname,usedinvname;//,buffer;
/**/  MouseLocationName(locationname);
/**/  RemoveExtension(locationname);
/**/  if (type==0 && GetInvAt(mouse.x,mouse.y)>=0) type=4;
/**/  if (GSagsusedmode==4){
/**/    GetInvName(player.activeinv,usedinvname);
/**/    RemoveExtension(usedinvname);
/**/    if (type>0) type+=4;
/**/    }
/**/  if (game.used_mode==9 && type<4){}
/**/  else if (IsGUIOn(MAPS)==1 || type==0){}
/**/  else{
//Check modes with: if(UsedMode("mode")), check types by if(type==#). types:
//1   a hotspot
//2   a character
//3   an object
//4   an inventory item.
//5   inv. item on hotspot
//6   inv. item on character
//7   inv. item on object
//8   inv. item on inv. item

// You have the string "locationname" that is the name of
// what you clicked on, and the string "usedinvname" that is
// the name of the item that was used on where you clicked (only for types 5,6,7,8)
/**/////////PUT YOUR SCRIPTS HERE IF POSSIBLE///////////

// REPLACE THIS SAMPLE INTERACTIONS WITH YOURS:
string buffer;
  if (type<4)FaceLocation(GetPlayerCharacter(),mouse.x,mouse.y); //this will make the player look to what he clicked on.
  if (UsedMode("close")){
     Display("I can't close that");
  }
  else if (UsedMode("usar") && type>=5){//if inv on inv:
    Display("I aix^ com ho faig?");
  }
  else if (UsedMode("mirar")){
    if (type!=2){//if its not a character
      Display("Ostres, qu} curios!");
      }
    else{
     StrCopy(buffer,"es ");
     StrCat(buffer,locationname);
     Display(buffer);      
    }
  }
  else if (UsedMode("agafar")){
    if (type==2) Display("No em cap a la butxaca");
    else Display("No ho puc agafar");
  }
  else if (UsedMode("parlar")){
    if (type==2){
       StrCopy(buffer,"Ehm... hola ");
       StrCat(buffer,locationname);
       StrCat(buffer,"!");
       Display(buffer);
    }
    else Display("No crec que puguem tenir una conversa coherent...");
    }
  else{
      StrCopy(buffer,"No puc ");
      StrCat(buffer,GSusedmode);
      StrCat(buffer," aixo");
      Display(buffer);
  }
/**/////////////////////////////////////////////////////
/**/ }
/**/}

//////////
I think it's part of a GUI I downloaded from Monkey Island 2.

The problem is I can't open the game with a older version of AGS because it says it's made with a newer version of AGS.

What should I do to fix that?

If someone could help me with this I'll be very grateful!

Tom Bombadil

P.S.: Pardon me if there are any spelling and/or grammatical mistakes... I'm catalan, you know...

Kweepa

Hmmm...
Maybe it wasn't such a good idea to upgrade to the latest version if you're using a template from an old version.
You can probably get the latest version of the template, but then you'd have to copy over whatever you've scripted of your game already.
Alternatively, you could load up the new template as a new game and paste over the broken functions in your old game. But I wouldn't recommend this unless you don't mind a lot of hassle.

I'm sure there's a thread about this already - I tried a quick search but nothing showed up, but you might try browsing the sticky template help thread, or doing some more thorough searches.
Still waiting for Purity of the Surf II

strazer

Try changing

function unhandled_event(){

to

function unhandled_event (int what, int type) {

Bombadil

#3
Hey people!

Thanks to both of you for your replies.

I searched "unhandled_event" in the Forums (both Techincal and Begginers Technical) and founded places where to find the script for the new AGS or how to repair it [NOTE: This is for the people who has the same problem and have found this post].

What I did was what strazer said. But, with other names for the int values, because type is already defined as a variable.

And where the function was called I wrote:

unhandled_event(1, 2)
instead of
unhandled_event()

Candle

I did that and got this error ?
Compile Error
---------------------------
There was an error compiling your script. The problem was in 'Main script':



Error (line 757): PE03: Parse error at '1'



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

Scorpiorus


Candle

/**/  if (type==0 && GetInvAt(mouse.x,mouse.y)>=0) type=4;
Thats the line .

Scorpiorus

hmm, that line is ok.

Then first of all, do you have exactly the same template version, I posted (in another thread) a direct link to? Just to be sure because they seem to work fine to me:

http://galeon.com/golfa/otros/nuevos/MI2_template_v13.rar (300kb)
http://galeon.com/golfa/otros/nuevos/FOA_template_v13.rar (100kb)


Scorpiorus

#9
hmm, stange. Btw, at what point do you get this error (in regard to original unhandled_event I mean)? Is it just on start game up? Or can you see the first room? :P

Candle

When I try to start the game it gives the error and ask if I want to fix the script ..
I may try the other one later to day as I have to run to the dentist now but thanks for your help ..

Candle

#11
Well I got the new ones and tried again and the m12 works fine but the  FOA in room1 click the push and you get this .
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0040D2A6 ; program pointer is +379, ACI version 2.60.698, gtags (0,0)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.



Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.
---------------------------
OK  
---------------------------

Scorpiorus

#12
Glad that MI2 works. As about FOA I've just checked but it doesn't crash for me. I even tried to push here and there still no run-time errors.

Candle

ya not sure why it does it and it will do it everytime I click the push button .
I think some others too but don't remember now ..

Pumaman

Ouch, nasty - this is a bug in AGS the first time you run a game made from a template.

Close the editor (saving your new game), then start it up again and load the game in, and the crash should be gone.

I'll get it fixed.

Candle

#15
Ok glad I could be of some help ..
yes I just saved it and ran it and it works fine now ..

SMF spam blocked by CleanTalk