How to make a "global answering system"?

Started by , Sun 13/07/2003 20:41:14

Previous topic - Next topic

tyrox

Hi! I'm not really new to AGS, but this is the point I've started to make my first little game and to finish it.
In many point & click adventure games the main character always says something when looking at, interacting with or picking up an object. ALWAYS: Even when the action cannot be performed. IN THIS CASE the character says something like the famous line:"That won't work." or "It won't budge.".
Here's my question: What do i need to do to make my character answer when there is no action to be performed in the Room->Hotspots->Interaction window. In other words: Is it possible to make a global answering system for interactions with hotspots and objects which have no action selected in the hotspots/objects menu (so that char says:"I don't need to do that." or "I can't pick that up.")?
The point is that I don't want to select actions for all hotspots and all the interactions someone could think of to be performed on them. I was thinking about a function like "NoAtionForHotspotSelected()" that could be useful in this case, but couldn't find such.
To make it a little bit harder (maby) I'd also like to use this system with custom interactions (Push, Pull...).
Please, help me!

scotch

#1
Yes it's possible ;) They're called unhandled events, and you can make a function for them in the global script.
Look in the help file page called 'Text script event reference' for help.

So for a default message for looking at things to be a display message saying 'That's not important' you'd make the unhandled event function on the global script:

function unhandled_event(int what, int type) {
}

and put in it:

if(what==1 &&  type==1) { //What 1 is hotspot, type one is look
Display("That's not important.");
}

and then when you look at any hotspot in the game that doesn't have a look interaction it will diplay that message.

That function in full again:

function unhandled_event(int what, int type) {
 if(what==1 && type==1) { //What 1 is hotspot, type one is look
Display("That's not important.");
}
}

The numbers you use for different events are in that help file page. (As for your custom actions things I guess you'd have to do something with global ints..)

tyrox

Yeah, that's it. I was looking for it in the manual but I didn't know what it's called so I didn't find it.
Thanks a lot.

SMF spam blocked by CleanTalk