Inventory item not being selected. (SOLVED)

Started by Vinnicius, Fri 03/02/2006 04:49:03

Previous topic - Next topic

Vinnicius

I did not find this question in the forum, then I go to ask. 
I created my proper inventory, but when I click in the item of inventory the cursor not change (the item is not selected).  Why this happens?

Grapefruitologist

Go to "general settings" and under "Inventory" it should say, "Don't use inventory items as cursors". Uncheck that.
(\ _ /)
(o.o )
(>< )
This is Bunny
Copy Bunny into your signature to help him on his way to world domination!
http://youtube.com/watch?v=IIO2qpSsUTA
http://youtube.com/watch?v=Rg-p7xaeYes

Ashen

Also, what cursor mode are you using? Unless you've scripted something different, it has to be 'Use' to select the active inventory item. (Sorry, an obvious question, but you didn't give us much detail to work with.)
I know what you're thinking ... Don't think that.

Vinnicius

The problem is the following one:

The problem is that inventory does not work.  Items appears in it, but it is not possible to select them.


Ishmael

What cursor mode are you using to select them? You should use the Interact mode if you haven't scripted anything for the event yourself.

In case you have not scripted anything, have you checked the "Handle inventory clicks in script" option in the general settings? If so, uncheck it and see what happens.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Ashen

#5
Vinnicius:
That doesn't really add anything, we already knew that.

1) What mode are you trying to use (see my last post, and Ishmael's, who posted as I was typing). I guess you are using eModeInteract or you'd have said, but no harm in making sure.
2) Is 'Handle inventory clicks in script' checked? If so, what have you got in on_mouse_click. (Again, Ishmael posted as I was typing.)
3) Is there anything else that you've changed from the default (e.g. are you using a template)?
I know what you're thinking ... Don't think that.

Vinnicius

#6
Well...
I m not using a template.  The "'Handle inventory clicks in script" is not checked. Im tryng to use "eModeUse (cursor 4).  The inventory screen(); code work nicely, but my custom inventory dont work. I do not understand. The changes of version 2.71 me left a little confused.

What it can be wrong?

How I make this?


--------
I need to add a code in "interactions" on the inventory itens to select them?


Ashen

#7
No, unless you've changed something somewhere (and it doesn't seem like you have) eModeUse should automatically select the item. Try it, definitely, and see if it has any effect.
Also, do ANY interactions run for inventory items (e.g. 'Look at item')? Do clicks elsewhere on the Inventory GUI work (buttons, etc)? Is it possible there's something (like a transparent GUI) blocking the mouse click?

The changes to 2.71 shouldn't affect this behaviour.

How big is your game so far? Could you upload it for us to have a look at? Unless you've made changes somewhere, there doesn't seem to be a reason for it not to work - which makes it all the more frustraiting that it isn't - but maybe another set of eys looking at the code would show something you've missed.
I know what you're thinking ... Don't think that.

Vinnicius


Ashen

#9
Actually I meant upload the source, not the compiled game but I see what you mean now.

For some reason, if I press tab before opening the Inventory, it changes the cursor and allows me to select items. I'd guess that you've changed the show_inventory_window function to not actually show the GUI, but left it and the change cursor mode/graphic commands intact. (If nothing else, you'll probably want to fix that before you release the game.)
So, can you show the code you use to display your inventory window, and the code for the buttons on the Inventory GUI? It seems like there's a problem there, with the mode not actually being set to 'Use' for some reason.

Obviously, there's no need to upload the source just yet, just post those bits here for now.

EDIT: OK, checked the Console, since you left debugging on, and it looks like I'm right. When you open the Inventory GUI, if there's already an active inventory item, the mode is set to 'UseInv', otherwise it''s left as is. When you close the GUI it's set to 'Walk to'. The buttons (which I'd expect to be Look and Use/Select) don't seem to do anything.

FURTHER EDIT;
Should've spotted this sooner:
QuoteIm tryng to use "eModeUse (cursor 4)

Mode 4 is the UseInv mode, which only works when there's an active inventory item. You need to use mode 2 which is eModeInteract even though I've been calling it 'Use' or eModeUse because that's how I think of it and I didn't bother to check what it's actually called. Sorry.
I know what you're thinking ... Don't think that.

Vinnicius

#10
Hehe I send to you the compiled game, sorry. on the other hand you it understood.


You it asked for some codes. Here is the code to open intentory and to leave.
Some codes:
Right Click (show the custom inventory window)

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 {Ã,  Ã, // right-click, so cycle cursor (opening the inventory)
Ã,  Ã, gGui3.Visible = true;
Ã,  Ã, PlaySound(1);
Ã,  Ã, character[LEO].StopMoving();
mouse.Mode = (eModeUse);


Ã,  }
}

note: gui3 is the inventory
Button "Sair" (close in portoguese)
function sair_Click(GUIControl *control, MouseButton button) {

gGui3.Visible = false;
Mouse.Mode = eModeWalkto;
}



Ashen

#11
Do the other two buttons have anything assigned to them? They could be set to 'Change cursor mode' (no scripting required), but like I said they don't seem to do anything in-game.

And it looks like it should work OK, once we cleared up the 'Use/Interact/UseInv' problem (my FURTHER EDIT, above).
I know what you're thinking ... Don't think that.

Vinnicius


SMF spam blocked by CleanTalk