Default message for actions

Started by AdamM, Sun 12/02/2006 19:26:21

Previous topic - Next topic

AdamM

Hi guys. Here's an easy one. How do you set hotspots etc. to display a default message when the player clicks on them (e.g. if the player has their cursor set to Talk To, and clicks on an inanimate object, the game displays 'You can't talk to that' or similar)? I can't seem to find an contextual answer in the manual or by searching. Thanks in advance.

Ashen

You'll be wanting the unhandled_event function (near the bottom of this bit of the manual).

It IS a little obscure in the manual, but I'm surprised searching the forums didn't turn up anything usefull.
I know what you're thinking ... Don't think that.

AdamM

I obviously wasn't searching for the right thing.  :-\

Cheers!

Zoolander

Is it possible in the unhandled_event function to script it so that the hotspots or objects are named in the default message?
For example: "I can't pick up that @OVERHOTSPOT@!"

strazer

#4
You could do, for example (AGS v2.71 code):

Code: ags

  String thetext = String.Format("I can't pick up that %s!", Game.GetLocationName(mouse.x, mouse.y);
  player.Say(thetext);


Edit:

I think putting everything in one line would work as well:

Code: ags

  player.Say(String.Format("I can't pick up that %s!", Game.GetLocationName(mouse.x, mouse.y));


And thanks for the v2.70 code, Ashen.

Zoolander

Any idea how it could be done in version 2.70?

Ashen

#6
More or less the same way (at least, GetLocationName(..) is still in there). You'll need to use the 2.7 string commands (obviously), and I think you'll need two of them:
Code: ags

string thetext;
string temp;
GetLocationName(mouse.x, mouse.y, temp);
StrFormat (thetext, "I can't pick up that %s!", temp);
player.Say(thetext);
I know what you're thinking ... Don't think that.

Scummbuddy

I strongly suggest that you do not use default messages. The game will be much more well received if you take the time to explain why for each object in a room, as to why the character can not pick up such item; why they can not combine one item with another; why they can not put their lips on that; and so on.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

SMF spam blocked by CleanTalk