Mouse cursor vanishes (Solved)

Started by bustee, Thu 06/09/2012 15:50:33

Previous topic - Next topic

bustee

Hi,

I'm just beginning to use AGS and wanted to make a starting screen and a one room adventure. In the start up screen I used the command

mouse.Visible = false;

when the screen fades to the normal game screen. I then set the variable to

mouse.Visible = true;

At first it worked, but then, all of a sudden, the cursor didn't appear anymore. It happened after I set an object to invisible; after setting it back to visible, the cursor still was not there. I also reloaded without using the start up screen, but the curcor was still gone. Is there some reason for that (maybe some option I accidently checked?). It cannot be in the scripting, as that is still very basic. (Here it is, to make sure. As you can see I spammed the functions with visible mouse cursors... If anyone would be able to help I would be very happy :D )

Code: AGS
// room script file

function room_FirstLoad()
{                                                                 // Lock door on startup when entering the room
  set_door_state(20, 2);
  mouse.Visible = true;
  oHamsOMatic.SetView(22);                                        //set the view of the treadmill
  oHamsOMatic.Animate(1, 5, 1);                                   //animate the treadmill
}

function room_AfterFadeIn()
{
  mouse.Visible = true;
 
 }

function room_Load()
{
  mouse.Visible = true;

}
 
function hDoor_Look()
{if (get_door_state(20)==2) {
    player.FaceDirection(eDir_Down);                          //player looks at Player :)
    player.Say("I welded this door shut.");
    player.Walk(270, 133,  eBlock);                           //player walks to window
    player.FaceDirection(eDir_Right);                         //player faces window
    player.Say("The weather report announced a storm for today.");
    set_door_state(20, 3);                                    //remember that the player already looked at the door
  }
 else if (get_door_state(20)==3) {
  player.Say("Tightly locked. All is well prepared for the coming storm");
 }
}



Andail

A few things that strike me as odd:
Why have the mouse.Visible on three occasions? You only need to set it once. I'm not even sure why you have a "first time enters" at all; should the treadmill not move the second time you enter the room?
Also, you don't have to declare a variable like that, it's enough with just
int door_state = 1;
and then another number when you want to change it.

But when it comes to your cursor disappearing, I can't spot anything that would cause it in your script.

Khris

If mouse.Visible is set to true and there's still no visible cursor, the only reason I can think of is that there's a blank sprite assigned to the current mode.
Check the cursor modes in the project tree and make sure they all have a proper sprite assigned to them.
If you used mouse.ChangeModeGraphic() or a similar command at one point, that could also have caused the invisibility.

bustee

Thanks for the quick replies.

@Andail:
"Why have the mouse.Visible on three occasions? You only need to set it once."
I actually didn't have it at all at the beginning, but instead in the start window:


// room script file

function room_Load()
{
//player.LockViewFrame(100, 1, 0);
gMaingui.Visible = false;
gAction.Visible = false;
}

function room_FirstLoad() {

}

function hHotspot2_AnyClick()
{
Game.StopAudio(eAudioTypeMusic);
mouse.Visible = false;
player.ChangeRoom(1);
//player.UnlockView();
gMaingui.Visible = true;
gAction.Visible = true;
mouse.Visible = true;
}

I then added these mouse.visible functions, because I didn't know why the cursor disappeared and thought it cannot harm (I do not fully understand how this script language works, it's the first time I'm using it)

"I'm not even sure why you have a "first time enters" at all; should the treadmill not move the second time you enter the room?"
Well, I planned it as a one room adventure :) But I'm curious, what would be the proper function to use? room_Load()? Does it read this in every case?

"Also, you don't have to declare a variable like that, it's enough with just
int door_state = 1;"
How does the program know which door is meant? (I only have one in this room, but I just wonder).

@Khris:
The cursors are all assigned to the proper view and I didn't use mouse.ChangeModeGraphic() at all.

--------------------------------------------------------------------------------------------------------

So, I just built an .exe and discovered that the cursor is visible for the fraction of a second and then disappears. Also, it is not simply invisible, but doesn't trigger anything. I also cannot use the F keys to get into the menue and quit. It looks as if the whole game freezes.
So, I tried out the "When player interface is disabled, GUIs should....Be hidden". and it was displayed for a fraction  of a second and then disappeared. So, apparently my interface is disabled after the room is loaded. I just do not understand why :(

Khris

I do:
Code: ags
  oHamsOMatic.Animate(1, 5, 1);                                   //animate the treadmill

That tells AGS to animate the treadmill a) repeatedly, b) blocking (you've omitted the blocking parameter and eBlock is the default).

You'll want:
Code: ags
  oHamsOMatic.Animate(1, 5, eRepeat, eNoBlock);

bustee

YAY!!! It works.. I'm stupid and

Thank you, thank you, thank you :D :D

SMF spam blocked by CleanTalk