Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FamousAdventurer77 on Wed 08/06/2011 02:44:28

Title: Multiple clicks on a hotspot or object?
Post by: FamousAdventurer77 on Wed 08/06/2011 02:44:28
How does one script for multiple clicks on a hotspot/object?

I mean this as in I want to implement an easter egg where you have to attempt interacting with a hotspot a few times (I'm thinking 4 or 5 times.) The first time you get a simple hint to click further, then "Are you sure?", followed by "OK, you asked for it!", the easter egg ensues, then every time after that you just get the same generic Display message whenever trying to interact with the hotspot.
Title: Re: Multiple clicks on a hotspot or object?
Post by: Khris on Wed 08/06/2011 02:49:57
Asked and answered a thousand times. Not that easy to find though.

int egg_clicks;

function hEgg_Interact() {

  egg_clicks++;

  if (egg_clicks == 1) {
    player.Say("What should I do with it?");
  }
  else if (egg_clicks < 5) {   // clicks 2, 3, 4
    player.Say("Are you sure?");
  }
  else if (egg_clicks == 5) {
    player.Say("Ok, you asked for it!");
    ...
  }
  else {
    player.Say("Nothing happens.");
  }
}
Title: Re: Multiple clicks on a hotspot or object?
Post by: FamousAdventurer77 on Wed 08/06/2011 03:16:15
Excellent. Just tweaking the easter egg execution, but otherwise got it. Thanks!

I think the reason why it's not found easily is because it's odd to word..."multiple clicks" was the best description I could come up with.