Hello again adventure folks!
I've tried to implement a "floating" GUI to display the names of objects and characters, for what I've used the following code by Khris from this thread: https://www.adventuregamestudio.co.uk/forums/index.php?topic=45730.0
The code is the following, under the function repeatedly_execute section in the Global Script:
Code: ags
For now, it has worked, but I find a little annoying problem: names display normally on the left side of the cursor, but happen to "flash" randomly on the right side, for less than a second. I'd like to know if it's possible to "block" the names on a fixed position relative to the cursor, so this flashing stops happening.
Thanks to Khris for the original code, and to everyone in advance for any tip!
I've tried to implement a "floating" GUI to display the names of objects and characters, for what I've used the following code by Khris from this thread: https://www.adventuregamestudio.co.uk/forums/index.php?topic=45730.0
The code is the following, under the function repeatedly_execute section in the Global Script:
int x = mouse.x + 3;
int y = mouse.y + 5;
InventoryItem*ii = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
Label*lbl = gLocationName.Controls[0].AsLabel;
String text;
if (ii) text = ii.Name;
else text = Game.GetLocationName(mouse.x, mouse.y);
if (x > 250) x = (x - 6) - GetTextWidth(text, lbl.Font);
gLocationName.SetPosition(x, y);
For now, it has worked, but I find a little annoying problem: names display normally on the left side of the cursor, but happen to "flash" randomly on the right side, for less than a second. I'd like to know if it's possible to "block" the names on a fixed position relative to the cursor, so this flashing stops happening.
Thanks to Khris for the original code, and to everyone in advance for any tip!
