Cannot see Cursor

Started by Anralore, Tue 31/08/2021 13:51:45

Previous topic - Next topic

Anralore

When I run the game and mouse over it, my cursor disappears so I cannot click anything.

How do I solve this?

eri0o

In the Editor, in mouse, do you have a cursor sprite/view specified for the modes you are using?

Anralore

Quote from: eri0o on Tue 31/08/2021 14:48:33
In the Editor, in mouse, do you have a cursor sprite/view specified for the modes you are using?

No, how do I do that? I am making an FMV game so I just need a cursor to click stuff not: "walk to" or "look at" or "Pick up" and so on.

Crimson Wizard

#3
I may forget some details, but iirc AGS begins with "walk to" cursor unless template or your script changes that.

In your case I'd suggest to disable all the cursor modes but the one you need at the very start of the game, in the function "game_start" in GlobalScript, like:
Code: ags

for (int i = 0; i <= eModeUsermode2; i++) {
   Mouse.DisableMode(i); // this disables everything first
}
Mouse.EnableMode(eModePointer); // enables one you need, use whatever mode you like to use, eModePointer, eModeInteract etc


Then make sure that in "on_mouse_click" function you do not have "Mouse.SelectNextMode()" or similar commands (this is present in "Sierra" template).

This will fix your game on one cursor mode, and you'll only have to provide graphic for it.

Anralore

Quote from: Crimson Wizard on Tue 31/08/2021 19:05:36
Code: ags
Mouse.DisableMode(); // this disables everything first


This line is causing this error: "Not enough parameters in call to function"

How do I fix that?

Crimson Wizard

It should be "Mouse.DisableMode(i);"

Anralore

Quote from: Crimson Wizard on Tue 31/08/2021 20:06:06
It should be "Mouse.DisableMode(i);"

Now the mouse will appear if I right click first?

Which mouse triggers hot spots?

Crimson Wizard

Quote from: Anralore on Tue 31/08/2021 20:14:55
Now the mouse will appear if I right click first?

Maybe you should also add
Code: ags

mouse.Mode = eModePointer;

after calling Enable.

But if it appears after right click - this could mean that you still have an unnecessary code in your script that changes cursor mode on right click.

What template did you use to create your game? If you are making a FMV game, I'd suggest "BASS" template, because it already does all this cursor setup.

Quote from: Anralore on Tue 31/08/2021 20:14:55
Which mouse triggers hot spots?

Hotspots, and everything else, have several events. For example, you could use either "interact" or "any click", which correspond to "eModeInteract" and "eModePointer" respectively.

Khris

If you started with an empty game, there are no sprites. Therefore the cursor will be invisible.
For a 1st person game you should probably use the interact mode for everything; this means you should

1. remove  mouse.SelectNextMode();  from the right button block in the global script's on_mouse_click function
2. add  mouse.Mode = eModeInteract;  inside the global script's game_start function
3. assign a sprite to the Interact cursor in the Project tree

eri0o

(or just set the same image for all cursor modes)

Crimson Wizard

#10
Quote from: eri0o on Wed 01/09/2021 03:19:08
(or just set the same image for all cursor modes)

I think this may make it harder to notice that something is wrong, for example that game or player switched to a wrong cursor mode which is not supposed to be used in the game.
Cursor will look the same, but player's clicks won't work or work differently; such situations are more difficult to diagnose.

Khris

Indeed; I'd use a dedicated image for eModeInteract and a small red X or whatever for the other modes.

SMF spam blocked by CleanTalk