I have this section of code to control the mouse clicks on inventory items whilst in the inventory:
...
else if (button == eMouseLeftInv)
{
if (player.ActiveInventory == null)
{
player.ActiveInventory = inventory[ game.inv_activated ];
}
else if (player.ActiveInventory != null)
{
inventory[ game.inv_activated ].RunInteraction( eModeUseinv );
}
}
else if (button == eMouseRightInv)
{
if (player.ActiveInventory == null)
{
inventory[ game.inv_activated ].RunInteraction( eModeLookat );
}
}
Problem is, it doesn't allow me to combine inventory items. As far as I can see, it should... :S
Can anyone spot why??
Thanks.
if (button == eMouseLeftInv) {
if (player.ActiveInventory == null) {
player.ActiveInventory = inventory[ game.inv_activated ];
return;
}
else if (player.ActiveInventory != null) {
inventory[ game.inv_activated ].RunInteraction( eModeUseinv );
return;
}
}
if (button == eMouseRightInv) {
if (player.ActiveInventory == null) {
inventory[ game.inv_activated ].RunInteraction( eModeLookat );
return;
}
}
//Wondering do you have the general settings option concerning mouse clicks on inventory enabled?, this probably doesn;t affect the thing, but I'm not really sure if it does.
It's called handle clicks something.
Otherwise the return lines I've added will do the trick.
Example why it doesn;t work..
This code below will "give the player an active inventory" then check if player does have an inventory and run the interaction. That's why I've put return. Return stops the script at this point.
if (player.ActiveInventory == null) {
player.ActiveInventory = inventory[ game.inv_activated ];
}
else if (player.ActiveInventory != null) {
inventory[ game.inv_activated ].RunInteraction( eModeUseinv );
}
I really never use game.inv_activated... but I could rework this into a different way. Anyway, try the return additions i've had at your code and probably it will score.
I tried that, no result... :(
It may have something to do with the script I have for the normal mouse clicks??
Here is that too:
else if (button == eMouseLeft) {
if (player.ActiveInventory == null) {
ProcessClick(mouse.x, mouse.y, eModeWalkto);
ProcessClick(mouse.x, mouse.y, eModeLookat);
}
else {
ProcessClick(mouse.x, mouse.y, eModeUseinv);
}
}
else if (button == eMouseRight) {
if (player.ActiveInventory == null) {
ProcessClick(mouse.x, mouse.y, eModeInteract);
ProcessClick(mouse.x, mouse.y, eModeTalkto);
}
else
{
player.ActiveInventory = null;
}
}
Sorry, my code is always a horrid mess.
Just use:
else if (button == eMouseLeftInv)
{
if (player.ActiveInventory == null) player.ActiveInventory = inventory[ game.inv_activated ];
else inventory[ game.inv_activated ].RunInteraction( eModeUseinv );
}
Still exactly the same. No luck at all.
I've re-read every bit of code, and it should work! Grrr.