Sorry for my delay for answer but I had a hard day.
I've used an empty template and I did all from zero.
The purpose of my unhandled-event function is to prepare some variables like name of the object or hotspot or character in wich we interact, the content of some properties like genre and number of these objects and the mouse coordinates. All these parameters are send to some special functions like randomUse, randomSay, randomLook, and so on . My unhandled_event function is this one:
Code: ags
I've used an empty template and I did all from zero.
The purpose of my unhandled-event function is to prepare some variables like name of the object or hotspot or character in wich we interact, the content of some properties like genre and number of these objects and the mouse coordinates. All these parameters are send to some special functions like randomUse, randomSay, randomLook, and so on . My unhandled_event function is this one:
function unhandled_event(int what, int type)
{
String locname;
String invname;
int generoNumero;
int theHotSpotID;
int theObjectID;
int theCharacterID;
int theInventoryItemID;
locname = Game.GetLocationName(mouse.x,mouse.y);
String hotSpotProperty;
if (what==1) //HOTSPOT
{
Hotspot *theHotSpot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (theHotSpot!=null)
{
theHotSpotID=theHotSpot.ID;
generoNumero=hotspot[theHotSpotID].GetProperty("generoNumero");
}else
{
Display("No hay un HOTSPOT");
generoNumero=0;
}
}
else if(what==2) //OBJECT
{
Object *theObject = Object.GetAtScreenXY(mouse.x, mouse.y);
//Display("WHAT 2== %s ", theObject);
if (theObject!=null)
{
theObjectID=theObject.ID;
generoNumero=object[theObjectID].GetProperty("generoNumero");
}else
{
Display("No hay un OBJETO");
generoNumero=0;
}
}
else if(what==3) //CHARACTER
{
Character *theCharacter = Character.GetAtScreenXY(mouse.x, mouse.y);
if (theCharacter!=null && theCharacter!=cPerxeo)
{
theCharacterID=theCharacter.ID;
generoNumero=character[theCharacterID].GetProperty("generoNumero");
}else
{
generoNumero=0;
}
}
else if (what==5)//objeto de inventario
{
InventoryItem *theInventoryItem= InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (theInventoryItem!=null)
{
theInventoryItemID=theInventoryItem.ID;
generoNumero=inventory[theInventoryItemID].GetProperty("generoNumero");
}else
{
Display("No hay un objeto de inventario");
generoNumero=0;
}
}
RandomLook(locname, generoNumero, mouse.x, mouse.y);
}
else if ((what==1)&&(type==2)) {
//si se interactua con algun hotspot
RandomUse(locname, generoNumero, mouse.x, mouse.y);
}else if ((what==1)&&(type==3)) {
//usar inventario en HOTSPOT OPCION 2 PARA HACER UNHANLED EVENTS ENTRE UN INVENTARIO Y UN HOTSPOT
String cosa=player.ActiveInventory.Name;
int idInv=player.ActiveInventory.ID;
int generoInv=inventory[idInv].GetProperty("generoNumero");
RandomInvUse(locname, generoNumero, cosa, generoInv, mouse.x, mouse.y);
}
else if ((what==1)&&(type==7)) {
//COGER UN HOTSPOT
RandomPickUp(locname, generoNumero, mouse.x, mouse.y);
}else if ((what==2)&&(type==5)) {
//COGER UN OBJETO
RandomPickUp(locname, generoNumero, mouse.x, mouse.y);
}
else if ((what==5)&&(type==0))
{
RandomLook(locname, generoNumero, mouse.x, mouse.y);
// mirar inventario
}
else if ((what==5)&&(type==3))
{
//usar objeto de inventario en otro
player.Say("Usar eso asi, no tiene ningun sentido");
RandomUse(locname, generoNumero, mouse.x, mouse.y);
} else if ((what==1)&&(type==4))
{
RandomSay(locname, generoNumero, mouse.x, mouse.y);
} else if ((what==2)&&(type==2))
{
RandomSay(locname, generoNumero, mouse.x, mouse.y);
} else if ((what==5)&&(type==2))
{
RandomSay(locname, generoNumero, mouse.x, mouse.y);
}
}