Cursor disappearing for no reason (I can tell)

Started by Azora, Today at 10:41:45

Previous topic - Next topic

Azora

Hello everyone, I'm quite new to AGS and programming. I've read the manual and watched tutorials, but I still cannot figure out why the cursor becomes invisible after this function. It still works, though; it can trigger the inventory GUI, and when it hovers over anything with a description, the words appear. I've changed the eBlock in case it was that, even deleted the Wait(40) in case it was somehow blocking something.
I'll be very grateful if someone can explain what's wrong. I'm sure it's something simple, but I cannot figure it out. The game is using BASS cursor mode, left click for action and right click to look.

First of all, there's a bool in the room:
bool CameronGone = false;
//player can do other things when Mrs. Cameron leaves the room

Then this function when using the Inventory Item iRat on a Hotspot hHole:

function hHole_UseInv(Hotspot *theHotspot, CursorMode mode)
{
  if (player.ActiveInventory == iRat) {
    if (CameronGone) //in case Cameron is already gone and you interact with hHole again
      {
      cRon.Walk(120, 140, eBlock, eWalkableAreas);
      cRon.FaceDirection(eDirectionUp);
      oRat.Visible = true;
      cRon.LoseInventory(iRat);
      }
    else  //first time you use the rat on the hole, it makes Mrs. Cameron leave the room
      {
    cRon.Walk(120, 140, eBlock,  eWalkableAreas); //deleted eBlock in case it was this but wont work
    cRon.FaceDirection(eDirectionUp);
    oRat.Visible = true;
    cRon.Walk(155, 151, eBlock, eWalkableAreas);
    cRon.FaceDirection(eDirectionRight);
    cRon.Say("Mrs. Cameron, I think there's a rat over there.");
    cCameron.Say("¡Oh my God!");
    cCameron.Say("¡Kill it! ¡Kill it!");
    oOpenDoor.Visible = true;
    cCameron.ChangeRoom(0);
    oOpenDoor.Visible = false;
    Wait(40); //deleted this in case it was the problem, but wont work
    CameronGone = true;
    cRon.LoseInventory(iRat);
    Mouse.Visible = true; //added to fix this but wont work
    }
  }
}

I think maybe CameronGone should be a Global Variable, but I don't see what it has to do with making the cursor invisible.
Any clues?
Thank you!

Khris

My guess is that when you lose the inventory item, AGS switches away from eMouseUseinv to a cursor mode that doesn't have an image set.
Looking at a default BASS game, only the eModeWalkto cursor has an image set; look, interact and talkto all are standard modes without images set. However when I test losing an inv item, the game does switch back to the walkto cursor. So not sure what's causing it.

SMF spam blocked by CleanTalk