Adding Interact to Inventory

Started by , Sat 05/06/2004 05:15:20

Previous topic - Next topic

Please Help!

I have added an interact button to my inventory screen but when I use it on an object it automatically just selects that object instead of what the interaction editor tells it to do. How can I stop it from doing that? Why doesn't it do that with look mode?; there isn't anything speical in the script.
Please Help if you can.

TerranRich

Hmm, yes, this is a feature covered in the manual. You can't ineract with an inventory item. Instead, you must use the TALK interaction in order to do anything to it. Hide the button that changed cursor modes as an INTERACT button, but have it change to TALK mode instead, and use that interaction. I will add this to the BFAQ soon.
Status: Trying to come up with some ideas...

Scorpiorus

Yeah, AGS automatically selects inventory item if you clicked on it in use mode. You can override that behaviour by ticking handle inventory clicks in script option (general settings pane) but then you have to add you own code into on_mouse_click() function under if (button==LEFTINV) {...} and if (button==RIGHTINV) {...}:

function on_mouse_click(int button) {

   if (IsGamePaused() == 1)
   {
      // Game is paused, so do nothing (ie. don't allow mouse click)
   }

   else if (button==LEFTINV) // left click on inventory item:
   {
/* do not select inventory in use mode (run interact inventory interaction instead)
      if (GetCursorMode()==MODE_USE)
      {Ã,  Ã, // select inventory on MODE_USE:
         SetActiveInventory(game.inv_activated);
      }
      else
*/
      {Ã,  Ã, // run other interaction if the cursor mode isn't MODE_USE:
         RunInventoryInteraction(game.inv_activated, GetCursorMode());
      }
   }
   else if (button==RIGHTINV) // right click on inventory item:
   {Ã,  Ã, // always run look interaction on MODE_LOOK:
      RunInventoryInteraction(game.inv_activated, MODE_LOOK);
   }

......
......

}

SMF spam blocked by CleanTalk