Nike622000

Tastatur

Jun 4th, 2016
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.84 KB | None | 0 0
  1. while true do
  2. rednet.open("back")
  3. print("Nachrichten werden empfangen!")
  4. id,message = rednet.receive()
  5. print(id)
  6. print(message)
  7. if id == 8955 and message == "Tastatur start" then
  8.  
  9. function start()
  10. term.clear()
  11. term.setTextColor(colors.cyan)
  12. term.setCursorPos(1,1)
  13. print("Word Programm")
  14. term.setTextColor(colors.white)
  15. term.setCursorPos(15,1)
  16. print("by")
  17. term.setCursorPos(18,1)
  18. term.setTextColor(colors.blue)
  19. print("Nike622000")
  20. term.setCursorPos(1,2)
  21. term.setTextColor(colors.white)
  22. print("Einfach mit der Tastatur schreiben: ")
  23. term.setCursorPos(1,3)
  24. term.setTextColor(colors.red)
  25. print("Entf")
  26. term.setCursorPos(6,3)
  27. term.setTextColor(colors.white)
  28. print("druecken um alles zu loeschen!")
  29. xPos = 4
  30. yPos = 7
  31. xMax,yMax = term.getSize()
  32. end
  33.  
  34. i = 0
  35.  
  36.  
  37. start()
  38. g=1
  39. for l = 7,yMax-3 do
  40.     term.setTextColor(colors.white)
  41.     term.setCursorPos(1,l)
  42.         if g < 10 then
  43.         print("0"..g..":")
  44.         else
  45.         print(g..":")
  46.         end
  47.     g=g+1
  48. end
  49. senden = true
  50. Beschreibungkomplett = ""
  51. while senden do
  52. Eingabe = ""
  53. Eingabe2 = ""
  54. if yPos == 2 then
  55. term.setCursorPos(1,yMax-1)
  56. term.setTextColor(colors.red)
  57. print("Maximale Textlaenge erreicht!")
  58. sleep(2)
  59. term.setCursorPos(1,yMax-1)
  60. print("                             ")
  61. term.setCursorPos(1,yMax-1)
  62. term.setTextColor(colors.red)
  63. print("Datei wird gesendet!")
  64. rednet.send(8955,"Tastatur stopp")
  65. senden = false
  66. sleep(2)
  67. rednet.send(8955,"Nachricht wird übermittelt")
  68. sleep(1)
  69. rednet.send(8955,Beschreibungkomplett)
  70. sleep(1)
  71. rednet.send(8955,"Nachricht wurde übermittelt")
  72. start()
  73. os.reboot()
  74. end
  75.  
  76. if xPos == xMax-1 then
  77. yPos = yPos+1
  78. xPos = 4
  79. Eingabe2 = "<E>"
  80. end
  81.  
  82. if i == 15 then
  83. i = 0
  84. end
  85. if i == -1 then
  86. i = 14
  87. end
  88.  
  89. farbe = 2^i
  90. term.setCursorPos(1,4)
  91. term.setTextColor(colors.white)
  92. print("Farbe mit den Pfeiltasten aendern (hoch/runter): ")
  93. term.setTextColor(farbe)
  94. print("momentane Farbe")
  95. event,key,x,y = os.pullEvent("key")
  96.  
  97. if farbechange == 1 then
  98. Beschreibungkomplett = Beschreibungkomplett.."<"..farbe..">"
  99. farbechange = 0
  100. end
  101.  
  102. g=1
  103. for l = 7,yMax-3 do
  104.     term.setTextColor(colors.white)
  105.     term.setCursorPos(1,l)
  106.     if l == yPos then
  107.         term.setTextColor(colors.red)
  108.         if g < 10 then
  109.         print("0"..g..":")
  110.         else
  111.         print(g..":")
  112.         end
  113.     else
  114.         term.setTextColor(colors.white)
  115.         if g < 10 then
  116.         print("0"..g..":")
  117.         else
  118.         print(g..":")
  119.         end
  120.     end
  121. g=g+1
  122. end
  123.  
  124. term.setCursorPos(xPos,yPos)
  125. term.setTextColor(farbe)
  126.  
  127. if key == 211 then
  128. start()
  129. g=1
  130. for l = 7,yMax-3 do
  131.     term.setTextColor(colors.white)
  132.     term.setCursorPos(1,l)
  133.         if g < 10 then
  134.         print("0"..g..":")
  135.         else
  136.         print(g..":")
  137.         end
  138.     g=g+1
  139. end
  140. Beschreibungkomplett = ""
  141. end
  142.  
  143. if key == 2 or key == 79 then
  144. print("1")
  145. xPos=xPos+1
  146. Eingabe = "1"
  147. end
  148.  
  149. if key == 3 or key == 80 then
  150. print("2")
  151. xPos=xPos+1
  152. Eingabe = "2"
  153. end
  154.  
  155. if key == 4 or key == 81 then
  156. print("3")
  157. xPos=xPos+1
  158. Eingabe = "3"
  159. end
  160.  
  161. if key == 5 or key == 75 then
  162. print("4")
  163. xPos=xPos+1
  164. Eingabe = "4"
  165. end
  166.  
  167. if key == 6 or key == 76 then
  168. print("5")
  169. xPos=xPos+1
  170. Eingabe = "5"
  171. end
  172.  
  173. if key == 7 or key == 77 then
  174. print("6")
  175. xPos=xPos+1
  176. Eingabe = "6"
  177. end
  178.  
  179. if key == 8 or key == 71 then
  180. print("7")
  181. xPos=xPos+1
  182. Eingabe = "7"
  183. end
  184.  
  185. if key == 9 or key == 72 then
  186. print("8")
  187. xPos=xPos+1
  188. Eingabe = "8"
  189. end
  190.  
  191. if key == 10 or key == 73 then
  192. print("9")
  193. xPos=xPos+1
  194. Eingabe = "9"
  195. end
  196.  
  197. if key == 11 or key == 82 then
  198. print("0")
  199. xPos=xPos+1
  200. Eingabe = "0"
  201. end
  202.  
  203. if key == 16 then
  204. print("Q")
  205. xPos=xPos+1
  206. Eingabe = "Q"
  207. end
  208.  
  209. if key == 17 then
  210. print("W")
  211. xPos=xPos+1
  212. Eingabe = "W"
  213. end
  214.  
  215. if key == 18 then
  216. print("E")
  217. xPos=xPos+1
  218. Eingabe = "E"
  219. end
  220.  
  221. if key == 19 then
  222. print("R")
  223. xPos=xPos+1
  224. Eingabe = "R"
  225. end
  226.  
  227. if key == 20 then
  228. print("T")
  229. xPos=xPos+1
  230. Eingabe = "T"
  231. end
  232.  
  233. if key == 44 then
  234. print("Z")
  235. xPos=xPos+1
  236. Eingabe = "Z"
  237. end
  238.  
  239. if key == 22 then
  240. print("U")
  241. xPos=xPos+1
  242. Eingabe = "U"
  243. end
  244.  
  245. if key == 23 then
  246. print("I")
  247. xPos=xPos+1
  248. Eingabe = "I"
  249. end
  250.  
  251. if key == 24 then
  252. print("O")
  253. xPos=xPos+1
  254. Eingabe = "O"
  255. end
  256.  
  257. if key == 25 then
  258. print("P")
  259. xPos=xPos+1
  260. Eingabe = "P"
  261. end
  262.  
  263. if key == 28 then
  264. xPos = 4
  265. yPos = yPos+1
  266. Eingabe = "<E>"
  267. end
  268.  
  269. if key == 30 then
  270. print("A")
  271. xPos=xPos+1
  272. Eingabe = "A"
  273. end
  274.  
  275. if key == 31 then
  276. print("S")
  277. xPos=xPos+1
  278. Eingabe = "S"
  279. end
  280.  
  281. if key == 32 then
  282. print("D")
  283. xPos=xPos+1
  284. Eingabe = "D"
  285. end
  286.  
  287. if key == 33 then
  288. print("F")
  289. xPos=xPos+1
  290. Eingabe = "F"
  291. end
  292.  
  293. if key == 34 then
  294. print("G")
  295. xPos=xPos+1
  296. Eingabe = "G"
  297. end
  298.  
  299. if key == 35 then
  300. print("H")
  301. xPos=xPos+1
  302. Eingabe = "H"
  303. end
  304.  
  305. if key == 36 then
  306. print("J")
  307. xPos=xPos+1
  308. Eingabe = "J"
  309. end
  310.  
  311. if key == 37 then
  312. print("K")
  313. xPos=xPos+1
  314. Eingabe = "K"
  315. end
  316.  
  317. if key == 38 then
  318. print("L")
  319. xPos=xPos+1
  320. Eingabe = "L"
  321. end
  322.  
  323. if key == 21 then
  324. print("Y")
  325. xPos=xPos+1
  326. Eingabe = "Y"
  327. end
  328.  
  329. if key == 45 then
  330. print("X")
  331. xPos=xPos+1
  332. Eingabe = "X"
  333. end
  334.  
  335. if key == 46 then
  336. print("C")
  337. xPos=xPos+1
  338. Eingabe = "C"
  339. end
  340.  
  341. if key == 47 then
  342. print("V")
  343. xPos=xPos+1
  344. Eingabe = "V"
  345. end
  346.  
  347. if key == 48 then
  348. print("B")
  349. xPos=xPos+1
  350. Eingabe = "B"
  351. end
  352.  
  353. if key == 49 then
  354. print("N")
  355. xPos=xPos+1
  356. Eingabe = "N"
  357. end
  358.  
  359. if key == 50 then
  360. print("M")
  361. xPos=xPos+1
  362. Eingabe = "M"
  363. end
  364.  
  365. if key == 57 then
  366. print(" ")
  367. xPos=xPos+1
  368. Eingabe = " "
  369. end
  370.  
  371. if key == 52 then
  372. print(".")
  373. xPos=xPos+1
  374. Eingabe = "."
  375. end
  376.  
  377. if key == 200 then
  378. i = i+1
  379. farbechange = 1
  380. end
  381.  
  382. if key == 208 then
  383. i = i-1
  384. farbechange = 1
  385. end
  386.  
  387. if key == 29 then
  388. term.setCursorPos(1,yMax-1)
  389. term.setTextColor(colors.red)
  390. print("Datei wird gesendet!")
  391. rednet.send(8955,"Tastatur stopp")
  392. senden = false
  393. sleep(2)
  394. rednet.send(8955,"Nachricht wird übermittelt")
  395. sleep(1)
  396. rednet.send(8955,Beschreibungkomplett)
  397. sleep(1)
  398. rednet.send(8955,"Nachricht wurde übermittelt")
  399. start()
  400. os.reboot()
  401. end
  402.  
  403.  
  404. Beschreibungfarbe = tostring(farbe)
  405. Beschreibungkomplett = Beschreibungkomplett..Eingabe2..Eingabe
  406.  
  407.  
  408. end
  409. end
  410. end
Add Comment
Please, Sign In to add comment