Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SpacePaw on Tue 29/06/2010 14:10:03

Title: unhandled_event problem?
Post by: SpacePaw on Tue 29/06/2010 14:10:03
Hello,
My unhandled_event function doesn't seem to work (I don't have Any Click event defined - so this is not the case). When I try to pick up hotspot character goes with default "I can't do that" message instead of "Can't pick that up" one...I tried to leave only 'type' 7 or 5 and omit 'what' completely but it didnt help at all...Help?
Code:

function unhandled_event ( int what, int type )
{
  if((type==5 && what==2) || (type==7 && what==1))//Pick up object or hotspot - Doesnt work????
  {
    player.Say("Can't pick that up_really_");
  }
  else
  {
    player.Say("I can't do that_");
  }
}
Title: Re: unhandled_event problem?
Post by: SpacePaw on Tue 29/06/2010 14:32:20
Ok it seems mouse_modes are messed up somehow...(no idea why though! they call the functions respectively but they have different "what" and "type" values...it affects automatic function naming when creating events. Any idea why is that?
Title: Re: unhandled_event problem?
Post by: Khris on Tue 29/06/2010 18:13:17
The numbering of the events is really old, from a time when stuff didn't have nice script names. You had to reference everything by numbers then.

But yes, even then type wasn't consistent with the cursor mode IDs. Not sure why, but that's the way it is.

However, you can always ignore what and type and use GetLocationType and mouse.Mode instead.