Script for cursor position

  • #1, by marchardWednesday, 01. September, 17:30 3 weeks ago
    Hello!

    I would like to set the cursor to a specific position before each dialog. In my case to the position 640/400. I know that this can be done with setCursorPos({x=640, y=400}).

    However, I don't want to do it every time before each dialog, but write a definition script once, which sets the cursor automatically to this position before each dialog.

    How should the definition script look like? Can anyone help me?

    Any help would be great.



    Newbie

    43 Posts


  • #2, by PanSFriday, 03. September, 16:46 2 weeks ago
    As far as I know there is no dialog start event. So you have check in a main loop if there is a dialogbox. For Example:

    local dialogstarted = false

    function MainLoop()
     
      if game.Dialog:isEmpty() then --no dialog running

        if dialogstarted == true then
          dialogstarted = false
        end

      else

        if dialogstarted == false then --pretend to set cursor every frame to the position
          setCursorPos({x=640, y=400})
          dialogstarted = true
        end

      end

    end

    registerEventHandler("mainLoop", "MainLoop")
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    Newbie

    65 Posts

  • #3, by marchardSunday, 05. September, 14:14 2 weeks ago
    As far as I know there is no dialog start event. So you have check in a main loop if there is a dialogbox. For Example:



    Thank you very much. I will try it.

    Newbie

    43 Posts

Write post