I'm currently working on writing a verb coin GUI and I've run into some trouble. I want the verb coin to appear for inventory items, same as for hotspots. So, if you hold down the left mouse button it should appear after a little while. The problem is, that's not what happens.
I think I've narrowed it down to this segement of code, found in repeatedly_execute:
Code: ags
If I hold down the left mouse button on a regular hotspot, this code first displays TEST and then TEST2, as would be expected since I released the button to click away the TEST message. However, when I hold down the left mouse button over an inventory item nothing happens until I release the button, at which point TEST2 is displayed.
This has me very confused. Since TEST2 is displayed, HasClicked must be true. And since TEST isn't displayed, mouse.IsButtonDown(eMouseLeft) must be false. If this is correct, why the delay until I release the button before displaying TEST2? If IsButtonDown is false, the script should have displayed TEST pretty much as soon as I had clicked on the item.
I'd be very grateful if someone could explain what's going on here and how I could fix it.
I think I've narrowed it down to this segement of code, found in repeatedly_execute:
if (HasClicked && mouse.IsButtonDown(eMouseLeft))
{
Display("TEST");
if (ClickTimer < 10)
{
ClickTimer++;
}
else
{
gVerbCoin.X = ClickedX - 47;
gVerbCoin.Y = ClickedY - 30;
gVerbCoin.Visible = true;
ClickTimer = 0;
}
}
else if (HasClicked)
{
Display("TEST2");
ProcessClick(ClickedX, ClickedY, eModeWalkto);
ClickTimer = 0;
HasClicked = false;
}
If I hold down the left mouse button on a regular hotspot, this code first displays TEST and then TEST2, as would be expected since I released the button to click away the TEST message. However, when I hold down the left mouse button over an inventory item nothing happens until I release the button, at which point TEST2 is displayed.
This has me very confused. Since TEST2 is displayed, HasClicked must be true. And since TEST isn't displayed, mouse.IsButtonDown(eMouseLeft) must be false. If this is correct, why the delay until I release the button before displaying TEST2? If IsButtonDown is false, the script should have displayed TEST pretty much as soon as I had clicked on the item.
I'd be very grateful if someone could explain what's going on here and how I could fix it.