Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: artium on Sat 15/09/2018 20:48:32

Title: MODULE: Hint Highlighting
Post by: artium on Sat 15/09/2018 20:48:32
Documentation and code (https://github.com/alkhimey/HintsHighlight)

Download scm file (https://github.com/alkhimey/HintsHighlight/releases)

Latest version: 3.0.0 (released on 20/05/2025)

Did you ever play an adventure game and got frustrated by not being able to find the next clue of a puzzle?

You try every item and click on every location, but there is no success...

So you open the walk-through and what is written there disappoints you.

It turns out that it was not something clever that you missed, but you did not notice that little pixel sized, not so outstanding, brick at the corner of the screen.

No more frustration for you players!

As part of learning to work with AGS, I developed a module that allows displaying hints.

After the easy integration (simply download and add it into your game), pressing an "SPACE" key (actually this is configurable) will highlight all the enabled hotspots/characters/objects on the screen.

(https://raw.githubusercontent.com/alkhimey/HintsHighlight/master/screenshots/demo.gif)

It has several other configurable options that are explained in the "asc" file. Of course you can modify it as you wish, for example making the highlight visual style fit you game's theme.

If you find bugs or have suggestions or improvement requests, feel free to write me :)
Title: Re: MODULE: Hint Highlighting
Post by: Danvzare on Sun 16/09/2018 15:20:25
I remember something like this called "ShowInteractiveAreas" by Billbis.
I wonder how yours differs though, and which is better. :-D
Title: Re: MODULE: Hint Highlighting
Post by: VampireWombat on Sun 16/09/2018 15:26:05
I just checked and confirmed that something similar is part of the Extended ALARCOST template. But that makes green dots over the hotspots.
Dunno if I'd say any of them is better. Just slightly different.
Title: Re: MODULE: Hint Highlighting
Post by: Danvzare on Sun 16/09/2018 17:48:08
I've been messing about with your new module, and I've improved it a tiny bit. Firstly by drastically increasing the speed in which it calculates everything, although now a hotspot has to be at least 2x2 to be detected. Secondly, by making the various rectangles more identifiable from each other.

Here's my version of your module, incase you want to incorporate any of those changes: LINK (https://sta.sh/0sqy0dj6f4i).
I don't know how to use GitHub, hence why I'm putting it here.

A few things to note though, that you need to improve on your module yourself.
Firstly, it only points out hotspots. What about objects and characters?
Secondly, you really need to make it pause the game when it's being used, because if you hold in the H key while walking in a scrolling room, the drawn rectangles follow the screen.
Thirdly, consider changing the default key to the spacebar, since that's usually what most games set this kind of hint thing to.
Title: Re: MODULE: Hint Highlighting
Post by: artium on Mon 17/09/2018 21:45:50
I was not aware that there is already a module doing this. We have mostly the same functionality but there small differences I can see. It is not really important because this is a project for helping me learn AGS.

Quote from: Danvzare on Sun 16/09/2018 17:48:08
Firstly by drastically increasing the speed in which it calculates everything, although now a hotspot has to be at least 2x2 to be detected.

Great idea. Requiring the hotspots to be at least 2x2 is reasonable.
Nevertheless, currently, the overlay is calculated only when a button is pressed, not every cycle and even not while it is held. Therefore there is little requirement for speedup.

Quote from: Danvzare on Sun 16/09/2018 17:48:08
Secondly, by making the various rectangles more identifiable from each other.

This is a great addition as well!

Quote
I don't know how to use GitHub, hence why I'm putting it here.

I really loved your changes and want to incorporate them. But maybe this is an opportunity for you to learn git, and to make a name for yourself in somebody's else repository. I can send you a link to an interactive git tutorial and to guide how to work with github. PM me if you are interested.

Quote
Firstly, it only points out hotspots. What about objects and characters?

That is on my TODO list.

Quote
Secondly, you really need to make it pause the game when it's being used, because if you hold in the H key while walking in a scrolling room, the drawn rectangles follow the screen.

Agree, I will add it.

Quote
Thirdly, consider changing the default key to the spacebar, since that's usually what most games set this kind of hint thing to.

Agree a well.
Title: Re: MODULE: Hint Highlighting
Post by: Monsieur OUXX on Wed 19/09/2018 10:54:38
did you host your source code online, on github or similar? It would be nice to always adopt that practice nowadays.
Title: Re: MODULE: Hint Highlighting
Post by: artium on Wed 19/09/2018 19:02:25
Quote from: Monsieur OUXX on Wed 19/09/2018 10:54:38
did you host your source code online, on github or similar? It would be nice to always adopt that practice nowadays.

Yes I did. It is hosted on Github: https://github.com/alkhimey/HintsHighlight
Title: Re: MODULE: Hint Highlighting
Post by: Monsieur OUXX on Thu 20/09/2018 09:24:12
Quote from: artium on Wed 19/09/2018 19:02:25
It is hosted on Github: https://github.com/alkhimey/HintsHighlight

EXCELLENT!
(https://cdn.tinybuddha.com/wp-content/uploads/2010/02/Jumping-for-Joy.jpg)

EDIT : Was- Was the github address at the top of the first post the whole time? :X
Title: Re: MODULE: Hint Highlighting
Post by: Crimson Wizard on Thu 20/09/2018 10:13:44
Quote from: Monsieur OUXX on Thu 20/09/2018 09:24:12
EDIT : Was- Was the github address at the top of the first post the whole time? :X

Yes...
Title: Re: MODULE: Hint Highlighting
Post by: artium on Fri 23/11/2018 21:33:22
Updates to the module are available:

Additionaly, it is possible now to download (https://github.com/alkhimey/HintsHighlight/releases) an scm file.
Title: Re: MODULE: Hint Highlighting
Post by: CaptainD on Sun 19/11/2023 20:48:15
Apologies for digging up such an old thread, but I've given it a try and I'm getting an error, not sure if it's something I've done (or not done), or possibly related to the game's resolution (1280x720)?

Error running function "repeatedly_execute": Error (line 331): Script appears to be hung (a while loop ran 150001 times). The problem may be in a calling function; check the call stack.

The line number corresponds to the middle of static function HintsHighlighter::CalculateHintsForRoom().

I haven't changed any of the imported script (I realise this may be the problem).
Title: Re: MODULE: Hint Highlighting
Post by: Crimson Wizard on Sun 19/11/2023 21:16:55
Quote from: CaptainD on Sun 19/11/2023 20:48:15Error running function "repeatedly_execute": Error (line 331): Script appears to be hung (a while loop ran 150001 times). The problem may be in a calling function; check the call stack.

The line number corresponds to the middle of static function HintsHighlighter::CalculateHintsForRoom().

This is fixed by adding a "noloopcheck" to the function's definition:

Code (ags) Select
static function noloopcheck HintsHighlighter::CalculateHintsForRoom()
Title: Re: MODULE: Hint Highlighting
Post by: CaptainD on Sun 19/11/2023 21:27:07
CW, you are a hero!!
Title: Re: MODULE: Hint Highlighting
Post by: artium on Thu 20/03/2025 23:57:20
A new version 3.0.0 was released based on feedback I saw here and there.

You are welcome to see the changlog here: https://github.com/alkhimey/HintsHighlight/releases/tag/v3.0.0
Title: Re: MODULE: Hint Highlighting
Post by: Eon_Star on Sun 11/05/2025 23:16:58
Hi,

I think I will give it a try. I might make a tutorial for this module.

Question: @artium Can you show me how you used a custom sprite to highlight the hotspots. Can you provide the script?

I will let you know.

Until then...

Happy coding.

Thanks.
Title: Re: MODULE: Hint Highlighting
Post by: artium on Wed 25/06/2025 21:21:16
Quote from: Eon_Star on Sun 11/05/2025 23:16:58Hi,

I think I will give it a try. I might make a tutorial for this module.

Question: @artium Can you show me how you used a custom sprite to highlight the hotspots. Can you provide the script?

I will let you know.

Until then...

Happy coding.

Thanks.


Just saw your comment.

To use sprite mode, open HintsHighlight-3.0.0.asc and set the following configuration constants:

#define HINT_SHAPE_TO_USE eHintSprite
...
#define SPRITE_SLOT <the slot of the sprite you want to use>
Title: Re: MODULE: Hint Highlighting
Post by: Eon_Star on Mon 30/06/2025 21:01:33
It worked !


Thank you for your hard work. I will make another tutorial on this topic.

I have another question @artium: Is there a way to animate the sprite graphics or some way to use views with the module to animate the hotspot marker?

I wrote a script myself to show animated hotspots inside a room, which was bound to room script.

This is something global and would like to animate the hotspot markers.

Thanks in advance.
Title: Re: MODULE: Hint Highlighting
Post by: artium on Mon 07/07/2025 22:43:51
Currently, only sprites are supported, but I guess it is not impossible to add this feature.
Can you share the script you wrote?
Title: Re: MODULE: Hint Highlighting
Post by: Eon_Star on Fri 11/07/2025 21:08:26
Hi,

here is the code:

It is triggered when a button on the inventory bar is clicked. For every room the marker has a separated code:

function ShowHspot_OnClick(GUIControl *control, MouseButton button) // second click on button to reset the script !
{
  if  ((BobIsInRoom1==true)&&(BobInRoom3==false)&&(MarkerClicked==false)&&(BobInRoom6==false))
{

object[6].Visible = true;
object[7].Visible = true;
object[8].Visible = true;

MarkerClicked = true;      // to reset the script / returns the action to 0 (zero)
}
 
  else if ((BobInRoom3==true)&&(BobInRoom6==false)&&(BobIsInRoom1==false)&&(MarkerClicked==false))
  {
 
  object
  • .Visible = true;
  object[1].Visible = true;
 object[2].Visible = true;
 object[3].Visible = true;
MarkerClicked = true;
 
}
  else if ((BobInRoom6==true)&&(BobInRoom3==false)&&(BobIsInRoom1==false)&&(MarkerClicked==false))
  {
 object[6].Visible = true;
 object[7].Visible = true;
 object[8].Visible = true;
 MarkerClicked = true;
 }
 
  else if (BobIsInRoom1==true)
  {
  object[6].Visible = false;
  object[7].Visible = false;
  object[8].Visible = false;
  MarkerClicked = false;
  }
 
  else if  (BobInRoom3==true)
  {
 
  object
  • .Visible = false;
  object[1].Visible = false;
 object[2].Visible = false;
 object[3].Visible = false;
  MarkerClicked = false;

  }
 else if (BobInRoom6==true)
{
object[6].Visible = false;
object[7].Visible = false;
object[8].Visible = false;
 MarkerClicked = false;

            // This is the main action / first click on button

}

}



I made tutroials on the topic:

Player enters a room for example Room 6 then the global var "BobInRoom6" is true and it is set to false after player leaves the room (room functions).

Hotspot marker:

https://www.youtube.com/watch?v=3VRqpNKytts

Separated Hotspot Marker (Final Code):

https://www.youtube.com/watch?v=a2rf5ryxwpY

Animated hotspot marker:

https://youtu.be/cmf9v_ykyO8

Thanks.  :)