Hi,
I'm only working on one cylinder today.
I'm trying to use an inventory item hover over a button (Button28 is the slot for a DVD).
The inventory can be any one of 4 music DVD's.
This works but is not refined enough.
Not sure. Can you help me please?
if (cspace.ActiveInventory==iswan && mouse.x>=81 && mouse.y<=121 && Game.DoOnceOnly("Swan"))
{
if (Game.DoOnceOnly("swan_play"))
a2001_theme.Play();
cspace.LoseInventory(iswan);
cspace.ActiveInventory=null;
}
}
EDIT: This is almost there with this way:
if (cspace.ActiveInventory==iswan && mouse.x>=260 && mouse.x<=300 && mouse.y<=90 && Game.DoOnceOnly("Swan"))
Many thanks if you can offer the real way...
Where are you using this code?
Because you can put it inside the button's OnClick function, and that way you don't need any coordinate checks.
function btnDVDSlot_OnClick(GUIControl *control, MouseButton button) {
if (button != eMouseLeft) return;
if (mouse.Mode == eModeUseinv && player.ActiveInventory == iswan) {
a2001_theme.Play();
player.LoseInventory(iswan);
player.ActiveInventory = null;
}
}
Cheers Khris,
That makes sense, I really should have seen it.
Anyhow, I now have it so I can play any of 4 DVD's.
Thank you