Cursor disappears whenever I remove an item from the inventory

Started by DiggingUpGraves, Fri 26/07/2024 12:37:05

Previous topic - Next topic

DiggingUpGraves

Hi there, I've got something strange going on. Every time I start a script where a character needs to use an inventory item, and then lose it after the one use, the cursor vanishes. It still works, but you cannot see it. I already tried some lines about changing the cursor but nothing really works.
What's strangest is that I didn't have this problem with my previous game. I made that one in 3.6.0., this one in 3.6.1. Could this be the problem?


I'll add the code that I used too, just in case
Code: ags
function hDrawer_UseInv(Hotspot *theHotspot, CursorMode mode)
{
  if (player.ActiveInventory == iDrawerkey)
  {
    player.Say("Hi");
    SetBackgroundFrame(1);
    player.LoseInventory(iDrawerkey);
  }
}

Crimson Wizard

When the ActiveInventory is reset (in your case that's because item is removed from inventory), cursor switches to the first enabled cursor mode in the list. By default that's Walk cursor, but may be a different one if you disabled Walk.

Normally you should disable cursors that you don't use. This may be done either by disabling "StandardMode" property in the editor (if I remember correctly), or by setting Mouse.DisableMode in game_start function in script.

DiggingUpGraves

Thank you! It's somewhat working right now. I'm going to look through my old game and see what the mouse/cursor stuff looks like now that I know.

DiggingUpGraves


Crimson Wizard

Quote from: DiggingUpGraves on Fri 26/07/2024 13:01:45I wholly fixed it by just giving 'Walk to' a cursor

This means that you are using random cursors in your game, instead of configuring a logical behavior.

DiggingUpGraves

But I've got a default cursor, and disabled all the ones I don't need.

DiegoHolt

Hi, I'm having the same problem here... how did you solve it?  ???

Crimson Wizard

Quote from: DiegoHolt on Wed 04/09/2024 00:59:31Hi, I'm having the same problem here... how did you solve it?  ???

Clearly decide which cursors do you want to use in your game.
Disable all the other cursors, either by disabling "StandardMode" property in the editor, or using Mouse.DisableMode in game_start script function.
https://adventuregamestudio.github.io/ags-manual/Mouse.html#mousedisablemode

This will prevent AGS from switching to unused cursor after active inventory is removed.

SMF spam blocked by CleanTalk