Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rainbow Guy on Thu 12/08/2004 17:35:20

Title: Can't Deselect Active Inventory Item : Solved
Post by: Rainbow Guy on Thu 12/08/2004 17:35:20
I'm having trouble deseleting an inventory item, i have this in my GUI


if (button==6) {Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, // My Use Button
Ã,  SetCursorMode(MODE_USE);
Ã,  SetMouseCursor (4);
Ã,  SetLabelText (0, 11, "Use @OVERHOTSPOT@");
Ã,  display ("222");
Ã,  SetActiveInventory(-1);
Ã,  }

It displays "222" but the last item selected still comes upÃ,  Ã, :o What's going onÃ,  ???

======================================
Solution !

put the line :-

Ã,  SetActiveInventory(-1);

before you set the mode :-

Ã,  SetCursorMode(MODE_USE);
Ã, 

I don't know why but it worksÃ,  ;D
Title: Re: Can't Deselect Active Inventory Item
Post by: Proskrito on Thu 12/08/2004 17:53:23
Selected or displayed as cursor pic?
Title: Re: Can't Deselect Active Inventory Item
Post by: Mr Jake on Thu 12/08/2004 18:06:42
change -1 to 0

-1 calls Last Inventory.
Title: Re: Can't Deselect Active Inventory Item
Post by: Proskrito on Thu 12/08/2004 19:02:00
no, -1 should deselect the active inventory.
Why do you have that 'SetMouseCursor(4)' in your script? do you really need it?
if so, maybe you could try to put SetMouseCursor(4) after SetActiveInventory(-1) and see if that helps
Title: Re: Can't Deselect Active Inventory Item
Post by: Rainbow Guy on Thu 12/08/2004 19:09:38
Your right i don't need "'SetMouseCursor(4)" but i still can't get the thing to workÃ,  >:(

i have "SetActiveInventory (-1);" all over the script now, and still no
Title: Re: Can't Deselect Active Inventory Item
Post by: Proskrito on Thu 12/08/2004 19:37:05
if (button==6) {                       // My Use Button
  SetCursorMode(MODE_USE);
  SetActiveInventory(-1);
  SetLabelText (0, 11, "Use @OVERHOTSPOT@");
  Display ("Active inventory: %d", character[GetPlayerCharacter()].activeinv);

  }

Try this and tell us what does it display
Title: Re: Can't Deselect Active Inventory Item : Solved
Post by: Rainbow Guy on Fri 13/08/2004 11:10:50
Yep that works fine, thanxÃ,  ;DÃ,  ;D ;D

but i still don't see why mine didn't  ???
Title: Re: Can't Deselect Active Inventory Item : Solved
Post by: Proskrito on Fri 13/08/2004 12:40:00
you did this:
- SetCursorMode(MODE_USE);
Changed the cursor mode to mode 2
- SetMouseCursor (4);
Changed cursor mode 2 appearance to look like mode 4 (which had a item as cursor pic, because you hadnt deselected the active inv. item yet)
- SetLabelText (0, 11, "Use @OVERHOTSPOT@");
....
- display ("222");
....
- SetActiveInventory(-1);
Now the active item isnt selected, but the cursor mode 2 (in wich you are currently) still have the item as cursor pic, as you told it to have before

This is what _i think_ was happening, the item wasnt really selected, but you had its pic as the cursor.
Maybe you mistaken the purpose of SetMouseCursor, because i think it has no use in what you wanted to do, and that might be causing the problem
Title: Re: Can't Deselect Active Inventory Item : Solved
Post by: Rainbow Guy on Fri 13/08/2004 16:46:29
I thought SetMouseCursor only effected the picture, not the mode  :-\
and the reason for me wanting to change the cursor, is eventurely i want the game to use just one Cursor

Thanx again for your help  ;)
Title: Re: Can't Deselect Active Inventory Item : Solved
Post by: edmundito on Fri 13/08/2004 17:18:36
Quote from: Rainbow Guy on Fri 13/08/2004 16:46:29
I thought SetMouseCursor only effected the picture, not the modeÃ,  :-\
and the reason for me wanting to change the cursor, is eventurely i want the game to use just one Cursor

Thanx again for your helpÃ,  ;)

The easiest way to make your game use one cursor is to change the cursor graphic in every action (in the Cursor editor) to be the exact same cursor sprite. That way it will be invisible to the player, but not to you.