Jump Drive управление

  1. function set_screen_draw(info_text)
  2. digiline_send("touchscreen",
  3. {
  4. {command = "clear"},
  5. {command = "set", width = 3, height = 2},
  6. {command = "addtextarea", X = 0.3, Y = 0.1,W = 10, H = 2,name = "terminal", label ="Монитор данных", default = info_text},
  7. {command = "addbutton", X = 0.2,Y = 1.3,W = 3,H = 2,name = "btn_cirhe",label = "Часовня"},
  8. {command = "addbutton", X = 0.2,Y = 2,W = 3,H = 2,name = "btn_home",label = "Дом"},
  9. {command = "addbutton_exit", X = 0.2,Y = 4,W = 3,H = 2,name = "btn_jump",label = "ПРЫЖОК"}
  10. })
  11. end
  12.  
  13. if event.type == "digiline"and event.channel == "jumpdrive" then
  14. if event.msg.powerstorage ~= nil then
  15. init_data = "Энергия: " .. tostring(event.msg.powerstorage) .. "\nТекущая позиция: Х=" .. event.msg.position.x .. ", У=" .. event.msg.position.y .. ", Z=" .. event.msg.position.z .. "\nЦель: Х=" .. event.msg.target.x .. ", У=" .. event.msg.target.y .. ", Z=" .. event.msg.target.z .. "\nРадиус поля захвата: " .. tostring(event.msg.radius) .. "\nДистанция прыжка в метрах: " .. tostring(event.msg.distance) .. "\nЭнергии требуется: " .. tostring(event.msg.power_req)
  16. elseif event.msg.success ~= nil then
  17. init_data = "Результат: " .. tostring(event.msg.success) .. "\nВремя в микросекундах: " .. tostring(event.msg.time)
  18. end
  19. set_screen_draw(init_data)
  20. end
  21.  
  22.  
  23. if event.type == "program" then --Рисуем кнопки 1 при программировании контроллера
  24. set_screen_draw("Старт///")
  25. elseif event.msg.btn_cirhe then
  26. digiline_send("jumpdrive", { command = "set", x = 320, y = 42, z = 200, r = 1, formupdate = true })
  27. digiline_send("jumpdrive", {command = "get"})
  28. elseif event.msg.btn_home then
  29. digiline_send("jumpdrive", { command = "set", x = -769, y = 65, z = 955, r = 1, formupdate = true })
  30. digiline_send("jumpdrive", {command = "get"})
  31. --set_screen_draw(event.msg.clicker)
  32. elseif event.msg.btn_jump then
  33. digiline_send("jumpdrive", {command = "jump"})
  34. end
  35.  

https://github.com/mt-mods/jumpdrive/blob/master/doc/digiline.md

00:46
Нет комментариев. Ваш будет первым!
Используя этот сайт, вы соглашаетесь с тем, что мы используем файлы cookie.