Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Kinoko on Thu 15/04/2004 14:31:13

Title: Error during unhandled event
Post by: Kinoko on Thu 15/04/2004 14:31:13
Actually, that subject may be misleading. Basically, an error has been reported in my game. Apparently, when a certain object was given to a certain person (an action that was supposed to give an unhandled event response) the game crashed and he got an error message pointing to line 656

/**/       if (GScaninteractinv==1 && IsInventoryInteractionAvailable(GSlocid,MODE_USE)==1){

... of the global script.

I realised that I hadn't written in the line "else Unhandled();" at the end of that script, and I've now done it. Since I wasn't the one getting the problem in the first place (doing this action just had no effect but there was no error or anything), I can't tell if it's been fixed or not. It seemed to be something that only happened some of the time... that sort of thing makes me think it must be an engine bug or something but I really don't know.

If anyone needs it, here's some of the surrounding script:

////////Mode Look at if walk or pick up modes selected when mouse on inventory
/**/    if (GlobalCondition(1)){
/**/       SetMode("look at");
/**/       StrCopy(GSusedmode,GSmode);
/**/       GSagsusedmode=GetCursorMode();
/**/       SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/       RunInventoryInteraction(GSlocid, MODE_LOOK);
/**/       SetMode("default");
/**/    }
////////////////////////////////////////////////
/**/    else if(GlobalCondition(2)==1){}
/**/    else{
/**/       StrCopy(GSusedmode,GSmode);
/**/     if (GetCursorMode()==2){
/**/       if (GScaninteractinv==1 && IsInventoryInteractionAvailable(GSlocid,MODE_USE)==1){
/**/         SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/         RunInventoryInteraction(GSlocid, MODE_USE);
/**/         SetMode("default");
/**/       }
/**/       else SetActiveInventory(GSlocid);
/**/     }
/**/     else {
/**/       GSagsusedmode=GetCursorMode();
/**/       SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/       RunInventoryInteraction(GSlocid, GetCursorMode());
/**/       SetMode("default");
/**/     }
/**/    }
/**/  }


This is a bit beyond my understanding, so I don't know what the problem was in the first place and whether it should now be fixed.
Title: Re:Error during unhandled event
Post by: Kweepa on Thu 15/04/2004 15:38:46
In the error message (see the Completed Games thread) it said
Error: RunInventoryInteraction: invalid inventory number
so I think the script has changed slightly since the release.

Rats. I should have known it was going to be in MI2 template code.
Seems to me GSlocid is not referring to the inventory when the line is called.
But I'm not an MI2 template expert...
Who, oh who, can possibly help?
Title: Re:Error during unhandled event
Post by: Pumaman on Thu 15/04/2004 22:08:13
Yeah, that means that GSlocid is not a valid inventory number being passed into IsInventoryInteractionAvaialble.
Title: Re:Error during unhandled event
Post by: Kinoko on Fri 16/04/2004 02:05:00
So would me adding the "else Unhandled();" code to the end of scripts have fixed that?
Title: Re:Error during unhandled event
Post by: Pumaman on Fri 16/04/2004 19:02:19
I really couldn't say, we'd have to see the entire script to work it out. When does GSlocid's value get changed?
Title: Re:Error during unhandled event
Post by: SSH on Fri 16/04/2004 19:07:50
I think that this and another of  Kinoko's threads here are all the same problem we sorted here:
http://www.adventuregamestudio.co.uk/yabb/index.php?board=2;action=display;threadid=13211