As with all coding problems you start with a flow diagram of sorts.
First of all you create the verbcoin GUI. Then you get it to pop up at the mouse position when the left mouse button is held down over an active location.
Then you store the coordinates of the original click and whether the mouse is currently held down.
If the mouse button is released or the mouse is moved outside the verbcoin, remove it. In the former case, check the button under the mouse, if there is one, execute the action.
[code]bool mouse_down;
int mx, my;
function repeatedly_execute() {
// verbcoin button down?
bool mbd = mouse.IsButtonDown(eMouseLeft);
// open verbcoin
if (mbd && !mouse_down && Game.GetLocationType(mouse.x, mouse.y) != eLocationNothing) {
mouse_down = true;
// store coordinates of original click
mx = mouse.x;
my = mouse.y;
gVerbCoin.SetPosition(mx - 20, my - 20);
gVerbCoin.Visible = true;
}
// reset variable if mouse key not down any longer
if (!mbd && mouse_down) mouse_down = false;
// handle verbcoin
GUI*g = GUI.GetAtScreenXY(mouse.x, mouse.y);
GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (gVerbCoin.Visible) {
// turn off
if (!mbd || g != gVerbCoin) {
gVerbCoin.Visible = false;
// released over verbcoin button?
if (gc != null && gc.OwningGUI = gVerbCoin) {
if (gc == bLook) ProcessClick(mx, my, eModeLookat);
if (gc == bInteract) ProcessClick(mx, my, eModeInteract);
if (gc == bTalk) ProcessClick(mx, my, eModeTalkto);
}
}
}
}[/code]
(Not tested, there's probably some bugs in there, but should get you started.)