Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Script for cursor position

  • #1, by markus-creative 4 years ago Zitieren
    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.



  • #2, by PanS 4 years ago Zitieren
    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")
    
  • #3, by markus-creative 4 years ago Zitieren
    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.