Forum overview > object cursor change if i flying a object area
  • object cursor change if i flying a object area

    by wimf · Tuesday, 29. September 2015, 13:53 h ~ 5 years ago

    I created the following interface:

    When I fly over an object with the mouse, the cursor changes to an action (eg 'look').

    Once the player has looked, the cursor changes (eg take). I use the functions "cursor Enters object area" and "cursor leaves object area". , everything is going well smile

    But when I take an object in the inventory and I fly over an object on the room, the cursor loose object (because it is a defined area).

    Someone should there a script for the area cursor is not active when an object I have in hand?

    Thank you
  • by afrlme · Tuesday, 29. September 2015, 14:04 h ~ 5 years ago
    I ended up writing a small script function for that. It involves having to create some called by other actions too that contain an action part for setting the cursor.

    1. create the script below in script section of editor (definition script)

    function setCursor(c)
    if game.UsedItem:isEmpty() then


    2. Next you need to create a called by other action (anywhere you like in your ved - somewhere where you can easily remember is preferable). You need to create 1 per cursor & you should name them set_cursorname. Example: "set_use". Each called by other action should contain a single action part which sets the cursor.

    3a. Inside of your on mouse over actions you should include a execute a script part containing something like...



    3b. & in your on mouse out actions you would include the same execute a script except it should refer back to whatever your default cursor is.

    The reason you have to create these called by other actions is because there is currently no Lua method for setting the cursor through scripting. I hope the devs will add it to a future build of VS.
  • by wimf · Tuesday, 29. September 2015, 16:33 h ~ 5 years ago
    Thank you. It works very well.

    I hope that the new VS version improved this.

    thank smile
  • by wimf · Thursday, 15. February 2018, 15:23 h ~ 2 years ago

    Hi have more a problem with my cursor.

    2 years ago, you gave me this script that works very well.

    function setCursor(c)

    if game.UsedItem:isEmpty() then




    and for each objet, in execution type : Cursor enters object area, i have  for example :

    Execute script 'SetCursor["bas"]

    and for Cursor leaves object area

    set command 'vide'

    When I go from one room to another, the cursor is either invisible and keeps the name of the action and I have to move my mouse over an area for it to appear, but it keeps the name of the command displayed.

    I tried to put in the next room in "At beginning of scene", the following commands:

    Set command'vide'


    Set cursor '[vide]'

    But the problem is the same, the cursor is invisible and the name of the old command is displayed as long as I do not fly over an object area.

    Could you help me ?
  • by afrlme · Thursday, 15. February 2018, 15:34 h ~ 2 years ago
    No idea mate, sorry. The script/method shouldn't cause anything like that as you are only setting the command/cursor. Nothing in the log?

    Hopefully at some point - if he hasn't already - Simon will make it so that we can also set the active cursor with Lua script & allow us to bypass having to create called by other action parts.
  • by wimf · Thursday, 15. February 2018, 16:23 h ~ 2 years ago
    No, there is nothing in the log.

    It would be nice if this problem is corrected, because I am soon ready to release my game and it is not very "professional" to release it with this bug smile

  • by constantin · Thursday, 15. February 2018, 17:08 h ~ 2 years ago
    i use a condition for this case like "commands locked". so when "cursor enters area" i put "if condition "commands locked" = false then set command look. 

  • by esmeralda · Thursday, 15. February 2018, 17:11 h ~ 2 years ago
    What happens if you change back the cursor or command right after clicking the area for changing the scene? I mean in the action block that changes the scene but before the actual change. Is it the same?

    Like this:
    execute the command
            set the cursor/command or execute a script or whatever your procedure is to change the cursor
           pause of a few ms
           switch scene

  • by wimf · Thursday, 15. February 2018, 18:18 h ~ 2 years ago
    Thank you both.

    The solution of esmaralda working smile

    Without pause, not working, and with 5ms pause, the cursor is ok in second room.

    Thank you very much.

    If I can help you with other things, do not hesitate.

    Have a nice day smile
  • by wimf · Friday, 16. February 2018, 00:23 h ~ 2 years ago
    It is very strange with this script....

    As explained, it worked very well.

    Then I saved my project, and I left to eat.

    When I came back, I restarted my project, it does not work anymore, and yet I have the same script with the 5ms

    Is there no way to have the cursor that changes to the object hover without going through this kind of script?
  • by wimf · Saturday, 03. March 2018, 09:45 h ~ 2 years ago

    Despite having worked a week on this problem, I have not been able to solve it. Do you have help?

    Thank you
  • New post