Cursor won't change to inventory item

Started by strangechicken, Thu 02/12/2010 12:29:40

Previous topic - Next topic

strangechicken

Hey guys,

I'm having an issue with my inventory... I can click on an object... which in turn gives me an inventory item... thats all grand....

But I can't use my inventory at all... I have the "when mouse moves to the top of screen"  Visibility setting... Which comes down showing my inventory as it should when i get to the the top... all good.. but when I try to click an Item, where the function should be for the cursor should be to change to the selected item... it just does nothing, so I can't use my inventory at all... because I can't take items out of it for use...

I am using Khris's Broken sword style script which can be found here:  http://www.adventuregamestudio.co.uk/yabb/index.php?topic=35247.0...

and it all works fine... except this blasted inventory which is practically unclickable

Here is my script on the issue:

Quote
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight){
    // right-click
    if (mouse.Mode == eModeUseinv) mouse.Mode = eModeWalkto;   // loose inv item
    else ProcessClick(mouse.x, mouse.y, eModeLookat);             // or look at ...
  }
  else if (button == eMouseMiddle) {
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
    // leave our options open - what if you have a special script triggered
    // on "walking" mode?
    ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  else if (button == eMouseLeftInv) {
    if (mouse.Mode == eModeUseinv) inventory[game.inv_activated].RunInteraction(eModeUseinv);
    else {
      player.ActiveInventory = inventory[game.inv_activated];
      // mouse.Mode = eModeUseinv;
    }
  }
  else if (button == eMouseRightInv) {
    if (mouse.Mode == eModeUseinv) mouse.Mode = eModePointer;
    else inventory[game.inv_activated].RunInteraction(eModeLookat);
  }
}

Please be gentle... I don't have much experience with this, any feedback would be appreciated

Aaron.

Dualnames

Find something called Override built in sth on general settings pane under inventory section and set it to true. That should do it.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

strangechicken

Quote from: Dualnames on Thu 02/12/2010 12:57:58
Find something called Override built in sth on general settings pane under inventory section and set it to true. That should do it.

I looked but cannot find the thing you described.. theres only four things under inventory "Display Multiple Icons for multiple items" (which is on false), Handle inventory clicks in script (which is on true), "inventory item hotspot marker" (which is on none) and "use selected inventory graphic for cursor "(which is on true).... I am using ags 3.1.2 if that helps any.

Aaron.

Dualnames

#3
I think it's handle inventory script. Set it to false.

What Khris said.

EDIT: Oh, man why did Chris changed this to 3.2.0 and confuse me?!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Khris

No, it's supposed to be set to true. We WANT to handle inv clicks in script.

My script disables mouse clicks if the game is paused. It might be that the "when mouse moves to the top of screen" setting pauses the game, not sure.
Try this version of on_mouse_click:

Code: ags
function on_mouse_click(MouseButton button) {

  if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight){
    // right-click
    if (mouse.Mode == eModeUseinv) mouse.Mode = eModeWalkto;   // loose inv item
    else ProcessClick(mouse.x, mouse.y, eModeLookat);             // or look at ...
  }
  else if (button == eMouseMiddle) { 
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
    // leave our options open - what if you have a special script triggered
    // on "walking" mode?
    ProcessClick(mouse.x, mouse.y, eModeWalkto); 
  }
  else if (button == eMouseLeftInv) {
    if (mouse.Mode == eModeUseinv) inventory[game.inv_activated].RunInteraction(eModeUseinv);
    else {
      player.ActiveInventory = inventory[game.inv_activated];
      // mouse.Mode = eModeUseinv;
    }
  }
  else if (button == eMouseRightInv) {
    if (mouse.Mode == eModeUseinv) mouse.Mode = eModePointer;
    else inventory[game.inv_activated].RunInteraction(eModeLookat);
  }
}

strangechicken

Tried that.. still nothing... this is turnin out to be such a hasle :(

Khris

How big are your inv items? If you open the inv GUI and select the InventoryWindow, what does it say for ItemWidth/Height? Is the GUI clickable?

strangechicken

20 x 30 it says...

and GUI is clickable

Khris

Hmm, I guess the easiest way is if you uploaded the game somewhere. I promise I won't do anything bad with your resources. At this point, looking at the source will make finding a solution much quicker and easier for me.

strangechicken

Hey, I got it working for now.. thankyou all for your patience...

*is excited*

Alright... now one small step for noob... on giant leap for noobkind...

Lets get this game on the road

Khris

So, for future reference, was did you do to fix it?

strangechicken

I think it was that my Images... were too big for the set items in the inventory... so after changing the sizes to fit my inventory images... and fiddling around with things.. I have handle inventory clicks in script turned on for instance... it just worked for some reason...

strangechicken

I'll clarify... my thing was set tto 30 x 20 i believe.. so i changed it to 64 x 83 (my image size), and that got it going

SMF spam blocked by CleanTalk