Mouse cursor - how do you do this thing?
Moderators: marionline, SDHawk
Mouse cursor - how do you do this thing?
I used the example script in the mouse section of plotdict.xml, put it in the new game autorun script, and it just puts the walkabout mouse cursor I drew in the top left corner and nothing happens. I think I should probably get past this somewhat crucial phase of "making a game with mouse controls" before I move onto stuff like clicking on things.
So, first of all, check that the script is actually running. If you press F10 twice you'll enter the script debugger, and should see the displaymouse script listed. Also, check there isn't any other script listed above displaymouse (with the exception of an on-keypress script which doesn't contain any wait commands). If there is another script above, then it's in control, everything below the top script is paused. Press F10 again to leave the debugger.
The only other thing that could go wrong is that your NPC doesn't have ID 0. That's what the script assumes.
I'll update that example to use a slice instead of an NPC; using an NPC as mouse cursor is a bad idea as other NPCs can't move to the tile the NPC is at, and it won't be drawn above everything else.
The only other thing that could go wrong is that your NPC doesn't have ID 0. That's what the script assumes.
I'll update that example to use a slice instead of an NPC; using an NPC as mouse cursor is a bad idea as other NPCs can't move to the tile the NPC is at, and it won't be drawn above everything else.
Last edited by TMC on Mon Jun 08, 2015 12:12 pm, edited 1 time in total.
By the way, I would suggest also adding
to the plotdict.xml example for making the mouse cursor, in the same while loop as "put slice (mousecursor)". I tried it and it works great, mouse cursor always stays on top of everything.
Code: Select all
slice to front (mousecursor)
Ah, good point. But that still results in the cursor being underneath textboxes. So instead I added
Note that some things (menus and strings) still aren't drawn using slices, they're drawn above the slice tree instead, so it's not possible to display the cursor above them.
Code: Select all
move slice above (cursor, lookup slice (sl:textbox layer))