Well, your functions are in the wrong order for AGS (you're calling them before they're defined) - that doesn't really matter here, but it'll cause proplems in the game. character[EGO] could be shortened to cEgo, or player if they're the player character, but otherwise it doesn't look too bad.
One thing: In your description it sounds like you want to say either the Custom Property text (lookSay, useSay, etc) or the common_hotspots_(whatever) text, but the current script would display both. What about something like:
Code: ags
I removed the maySay function, because I wasn't quite sure what it did, and merged the name-checking bit into the common_hotspots_(whatever) functions. Hopefully, this should still work as you want, if not just put maySay back.
And SSH beat me to linking his MultiResponse module, so I'll just agree with him...
One thing: In your description it sounds like you want to say either the Custom Property text (lookSay, useSay, etc) or the common_hotspots_(whatever) text, but the current script would display both. What about something like:
Hotspot* myHotspot;
function common_hotspots_lookSay(String name) { // long list
if (name =="house") player.Say("this looks like a house");
if (name =="tree") player.Say("this looks like a tree"); // etc., etc.
}
function common_hotspots_useSay(String name) { // like 'lookSay' but many objects never get used
if (name =="house") player.Say("I don't think I'll disturb the people who live there.");
if (name =="tree") player.Say("I don't feel like climbing trees right now.");
}
function generic_hotspots_click() { // called from the global script mouse click
myHotspot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
String Temp;
if(mouse.Mode ==eModeLookat) {
Temp = myHotspot.GetTextProperty("lookSay");
if (Temp != "") player.Say(Temp); // If there IS a custom lookSay response, use it.
else common_hotspots_lookSay(myHotspot.Name); // Otherwise, get the generic response.
}
else if(mouse.Mode ==eModeInteract) {
Temp = myHotspot.GetTextProperty("useSay");
if (Temp != "") player.Say(Temp);
else common_hotspots_useSay(myHotspot.Name);
}
}
I removed the maySay function, because I wasn't quite sure what it did, and merged the name-checking bit into the common_hotspots_(whatever) functions. Hopefully, this should still work as you want, if not just put maySay back.
And SSH beat me to linking his MultiResponse module, so I'll just agree with him...