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")
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: