Hi Guys,
I'm trying to make an inventory bar which should work like the one in Broken Sword.
I used the following commands:
function on_mouse_click (MouseButton button)
{
if (IsGamePaused())
{
return;
}
//LEFT MOUSE BUTTON
else if (button==eMouseLeft)
{
if (GetLocationType (mouse.x, mouse.y) != eLocationNothing)
{
if (player.ActiveInventory ==null)
{
ProcessClick(mouse.x, mouse.y, eModeInteract);
}
else
{
ProcessClick (mouse.x, mouse.y, eModeUseinv);
}
}
else
{
if (player.ActiveInventory ==null)
{
ProcessClick(mouse.x, mouse.y, eModeWalkto);
}
else
{
player.ActiveInventory=null;
}
}
}
//RIGHT MOUSE BUTTON
else if (button == eMouseRight)
{
if (player.ActiveInventory != null)
{
player.ActiveInventory = null;
}
else if (GetLocationType (mouse.x, mouse.y)!= eLocationNothing)
{
ProcessClick(mouse.x, mouse.y, eModeLookat);
}
}
//LEFT MOUSE BUTTON INVENTORY
else if (button == eMouseLeftInv)
{
InventoryItem*item = InventoryItem.GetAtScreenXY (mouse.x, mouse.y);
if (item != null)
{
if (player.ActiveInventory == null)
{
player.ActiveInventory = item;
}
else
{
if (item.ID != player.ActiveInventory.ID)
{
item.RunInteraction (eModeUseinv);
}
}
}
}
//RIGHT MOUSE BUTTON INVENTORY
else if (button==eMouseRightInv)
{
if (player.ActiveInventory !=null)
{
player.ActiveInventory=null;
return;
}
InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (item != null)
{
item.RunInteraction(eModeLookat);
}
}
}
The problem is i still cannot handle items in the inventory "drag'n'drop-style", and it doesn' matter if the if the built-in inventory click handle is activated or not because whenever i click on my inventory bar it just disappears again until I hover with the cursor to the top edge.
Alsos since I was using this script all the objects I placed in my rooms weren't responding to the commands I scripted. This used to work when I used the default function for mouse clicks.
I read a lot already about the problems with the selection of items in the inventory bar but no thread got me any further.
I hope anyone can help me with this or give me a detailed explanation how to make it work.
Thanks in advance
I'm trying to make an inventory bar which should work like the one in Broken Sword.
I used the following commands:
function on_mouse_click (MouseButton button)
{
if (IsGamePaused())
{
return;
}
//LEFT MOUSE BUTTON
else if (button==eMouseLeft)
{
if (GetLocationType (mouse.x, mouse.y) != eLocationNothing)
{
if (player.ActiveInventory ==null)
{
ProcessClick(mouse.x, mouse.y, eModeInteract);
}
else
{
ProcessClick (mouse.x, mouse.y, eModeUseinv);
}
}
else
{
if (player.ActiveInventory ==null)
{
ProcessClick(mouse.x, mouse.y, eModeWalkto);
}
else
{
player.ActiveInventory=null;
}
}
}
//RIGHT MOUSE BUTTON
else if (button == eMouseRight)
{
if (player.ActiveInventory != null)
{
player.ActiveInventory = null;
}
else if (GetLocationType (mouse.x, mouse.y)!= eLocationNothing)
{
ProcessClick(mouse.x, mouse.y, eModeLookat);
}
}
//LEFT MOUSE BUTTON INVENTORY
else if (button == eMouseLeftInv)
{
InventoryItem*item = InventoryItem.GetAtScreenXY (mouse.x, mouse.y);
if (item != null)
{
if (player.ActiveInventory == null)
{
player.ActiveInventory = item;
}
else
{
if (item.ID != player.ActiveInventory.ID)
{
item.RunInteraction (eModeUseinv);
}
}
}
}
//RIGHT MOUSE BUTTON INVENTORY
else if (button==eMouseRightInv)
{
if (player.ActiveInventory !=null)
{
player.ActiveInventory=null;
return;
}
InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (item != null)
{
item.RunInteraction(eModeLookat);
}
}
}
The problem is i still cannot handle items in the inventory "drag'n'drop-style", and it doesn' matter if the if the built-in inventory click handle is activated or not because whenever i click on my inventory bar it just disappears again until I hover with the cursor to the top edge.
Alsos since I was using this script all the objects I placed in my rooms weren't responding to the commands I scripted. This used to work when I used the default function for mouse clicks.
I read a lot already about the problems with the selection of items in the inventory bar but no thread got me any further.
I hope anyone can help me with this or give me a detailed explanation how to make it work.
Thanks in advance