Change Hotspot Name?

Started by Ali, Wed 11/12/2013 17:49:56

Previous topic - Next topic

Ali

I can't find any recent posts about this, but - is it still not possible to change a hotspot's name?

I'm aware that I could use an object, but in this instance hotspots would be preferable.

Scavenger

I did this in my last game - you basically have to hijack the text marker while the cursor is over the hotspot (or whatever you're using) and return it to @OVERHOTSPOT@ when it's not. It depends on what interface you have - it could be as simple as putting a couple of lines of code into rep_exec or as complex as creating a proxy string for each hotspot to display instead of the name.

It is unfortunately not possible to directly change the hotspot name yet, but it is possible to fool the player into thinking you have.

Ali

Unfortunately, the reason I wanted to do this was in order to compare the hotspot name with another string in the script. So that wouldn't work, but thanks for the suggestion.

Scavenger

Ok, that should be easy enough to do. Something like this maybe:

Code: AGS

#define AGS_ROOM_COUNT 30 //Or however many rooms you have in your game.
String hotspot_name[];
bool hotspotnameinit [AGS_ROOM_COUNT];
function game_start ()
{
    hotspot_name = new String [AGS_ROOM_COUNT * AGS_MAX_HOTSPOTS];
}

function on_event (EventType event, int data)
{
    if (event == eEventEnterRoomBeforeFadein)
        {
         if (!hotspotnameinit[player.Room])
            {
                int i;
                while (i < AGS_MAX_HOTSPOTS)
                    {
                        hotspot_name [(player.Room * AGS_ROOM_COUNT) + i] = hotspot[i].Name;
                        i++;
                    }
                hotspotnameinit[player.Room] = true;
            }   
        }
}

function SetName (this Hotspot*, String name)
{
    hotspot_name [(player.Room * AGS_ROOM_COUNT) + this.ID] = name;
}

function GetName (this Hotspot*)
{
    return hotspot_name [(player.Room * AGS_ROOM_COUNT) + this.ID];
}


Whenever you need the hotspot's name, use Hotspot.GetName () instead.

Ali

Oh, thanks for that! But I'm, afraid I have already resorted to using objects instead. Good of you to come up with it, though. I will definitely turn to it if using objects doesn't work.

SMF spam blocked by CleanTalk