Setting mouse mode after combining inventory items

Started by TheVolumeRemote, Tue 16/03/2021 21:33:27

Previous topic - Next topic

TheVolumeRemote

Hey mates, sorry to ask a second question in a week but I’ve spent a couple of hours searching and trying things I’ve found with no luck.

Long short, after combining inventory items the cursor returns to Walk To. I have a puzzle where you must combine many items so this becomes frustrating for the player. How can I set it so after combining inventory items, the mouse mode returns to
Code: ags
mouse.Mode = eModePointer;
instead of Walk To (while gInventory is still open)?

Thank you! :)

TheVolumeRemote

And I’m just gonna put this here instead of making a topic (I already feel annoying enough lol)

Is there a way to disable skipping text/dialog with the arrow keys? Some testers are telling me they use the arrows to walk and sometimes that causes them to accidentally skip dialog. :)

TheVolumeRemote

#2
While I’m tempted to delete this in cowardice, in case it helps anyone else, just change the mouse mode in the same line you add/lose the inventory items you’re combining.

Once again I keep looking for overly specific solutions and missing the obvious. Getting there though! Maybe!

Cheers :)

Code: ags
 function iClothes_UseInv()
{
    if (player.ActiveInventory == iHat)
  {
    player.LoseInventory(iHat);
    player.LoseInventory(iClothes);
    player.AddInventory(iBoth);
    mouse.Mode = eModeInteract;
  }

Crimson Wizard

Above is of course the most straightforward, but at the same time tedious solution because you have to put it there everytime.

If this is absolutely necessary, an improvement may be to write a custom function that manages items and then sets cursor:

Code: ags

void MergeItems(InventoryItem* i1, InventoryItem* i2, InventoryItem* result)
{
    player.LoseInventory(i1);
    player.LoseInventory(i2);
    player.AddInventory(result);
    mouse.Mode = eModeInteract;
}


And then you just call it like
Code: ags

if (player.ActiveInventory == iHat)
{
    MergeItems(iHat, iClothes, iBoth);
}


(If there's more than one character who can merge items it's possible to expand it further into Character's extender function, but that's another topic)



However, I'd also question, why does it return to some irrelevant cursor at all. Probably this happens because all cursors are enabled at a time. As you mentioned there's gInventory open, does it mean it covers a screen and pauses the rest of the game? If so another possible solution could be to disable certain cursor modes when player opens gInventory and re-enable them when gInventory  is closed. This will prevent from any similar situations in screen-like GUI.

There are Mouse.EnableMode(mode) and Mouse.DisableMode(mode) for this.

Khris

Quote from: TheVolumeRemote on Tue 16/03/2021 22:00:12Is there a way to disable skipping text/dialog with the arrow keys? Some testers are telling me they use the arrows to walk and sometimes that causes them to accidentally skip dialog. :)
You can set  Speech.SkipStyle  and  Speech.SkipKey  to fine-tune how speech can be skipped.

Crimson Wizard

Quote from: Khris on Wed 17/03/2021 13:42:35
Quote from: TheVolumeRemote on Tue 16/03/2021 22:00:12Is there a way to disable skipping text/dialog with the arrow keys? Some testers are telling me they use the arrows to walk and sometimes that causes them to accidentally skip dialog. :)
You can set  Speech.SkipStyle  and  Speech.SkipKey  to fine-tune how speech can be skipped.

Also there's a corresponding option in General Settings, if you want to set it once for all game.

SMF spam blocked by CleanTalk