BIGTIME Inventory Problem.

Started by Secret Fawful, Tue 15/05/2007 19:38:06

Previous topic - Next topic

Secret Fawful

All right. I need help with three problems. Problem one. I can't get the Inventory to pop up using a right click like MI 3, Number 2, as of now the inventory is visible, just for testing, but I can't select an inventory item, as in clicking it, it turns into the mouse cursor, I use it with an object. And three, I can't get any of my buttons to work, aka, look, use, ok, and the up and down arrows. In other words, no code I've tried has worked, and yes I've scoured the rest of these forums for codes, but none of them work. Plus whenever I add in a code using the line if, it says I've had a parse error. So, what do I do?

Maverick

It would help if we had some idea what the code was so we could figure out which parts are not working as planned.



Secret Fawful

Actually, I meant the Global script for the inventory that was already in the game isn't working right. I don't know how to code this actually.

Khris

Are you using some template? Or AGS's default game?

1.
Code: ags
function on_mouse_click(...
  ...
  else if (button==eMouseRight) {
    if (!gInv.Visible && player.ActiveInventory==null) gInv.Visible=true;
    ...
  }
  ..
}


2+3 work in the default game. So again, what are you using?

Secret Fawful

AGS's default engine. As far as the mouse right code, I almost had it right except for this line, which I hadn't entered

(!gInv.Visible && player.ActiveInventory==null)
It works now, thank you so much.  ;D

But now my only other problem is getting the inventory items to become active so that I can select them and use them with hotspots.

Khris

In General settings, uncheck "Handle inventory clicks in script".

Secret Fawful

I can look at them, but I still can't select them I'm afraid.  :-[

SupSuper

Make sure you're using the Interact cursor mode to select them.
Programmer looking for work

Secret Fawful

Thanks, that worked. :D But now the inventory won't open again once I've selected an inventory item. (I'm helpless O_O)
(Someone smack me upside the head, sorry)

Ashen

If you insist ... *SMACK*

Anyway, that'll be the && player.ActiveInventory==null bit of Khris' code doing what it's supposed to. Just remove it, or change the code to something like:
Code: ags

else if (button==eMouseRight) {
    if (!gInv.Visible) {
      player.ActiveInventory = null;
      gInv.Visible=true;
    }
    ...
  }

Depending on how you want it to work.
I know what you're thinking ... Don't think that.

Secret Fawful

Thanks, now it's working perfectly. I don't see any more problems with it. Thank you so much. :D

SMF spam blocked by CleanTalk