Computercraft problem mit lua
  1. Hallo ich versuche ein scripts zu machen üm pumpen für ne gewisse zeit zu starten. Nur leider geht es nicht bekomme immer eine feler meldung P1:1: attempt to call nil
  2. es soll über ein menu ausgewelt werden
  3. function menue(m)
  4. n=1
  5. k=#m
  6. while true do
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print("Pumpen auswahl")
  10. term.setCursorPos(1,3)
  11. for i=1, k, 1 do
  12. if i==n then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end
  13. end
  14. print("")
  15. print("[Pfeiltaste hoch / runter]")
  16. a, b= os.pullEvent()
  17. if a == "key" then
  18. if b==200 and n>1 then n=n-1 end
  19. if b==208 and n<=k then n=n+1 end
  20. if b==28 then break end
  21. end
  22. end
  23. term.clear() term.setCursorPos(1,1)
  24. return n
  25. end
  26. function menueNeu()
  27. local l=1
  28. while true do
  29. term.setCursorPos(1,3)
  30. if l==1 then write(" [Ja] Nein ") else write (" Ja [Nein] ") end
  31. a, b=os.pullEvent()
  32. while a~="key" do a, b=os.pullEvent() end
  33. if b==203 and l==2 then l=1 end
  34. if b==205 and l==1 then l=2 end
  35. if b==28 then print("") break end
  36. end
  37. if l==1 then
  38. term.clear()
  39. term.setCursorPos(1,1)
  40. print("Auswahl bestätigt")
  41. sleep(2)
  42. elseif l==2 then
  43. term.clear()
  44. term.setCursorPos(1,1)
  45. print("Auswahl abgebrochen")
  46. sleep(2)
  47. os.reboot()
  48. end
  49. end
  50. local options={
  51. "P1",
  52. "P2",
  53. "P3",
  54. "P4",
  55. "P5",
  56. }
  57. local n=menue(options)
  58. print(n)
  59. if n == 1 then
  60. term.setCursorPos(1,1)
  61. print("Bist Du sicher ?")
  62. local auswahlNeu={}
  63. local l=menueNeu(auswahlNeu)
  64. print(l)
  65. term.clear()
  66. term.setCursorPos(1,1)
  67. shell.run("P1")
  68. elseif n == 2 then
  69. …...gleiche wie P1
  70. elseif n == 3 then
  71. …....gleiche wie P1
  72. elseif n == 4 then
  73. …..gleiche wie P1
  74. elseif n == 5 then
  75. …...gleiche wie P1
  76. elseif n == 6 then
  77. term.setCursorPos(1,1)
  78. print("Bist Du sicher ?")
  79. local auswahlNeu={}
  80. local l=menueNeu(auswahlNeu)
  81. print(l)
  82. term.clear()
  83. term.setCursorPos(1,1)
  84. rs.setOutput("left", true)
  85. sleep(0.5)
  86. rs.setOutput("left", false)
  87. os.reboot()
  88. end
  89. und die Programme sind dan so
  90. rs.setBundleOutput("bottom", colors.white)
  91. sleep(20)
  92. shell.run("reboot")
...zum Beitrag

hier auf pastebin das Menu

http://pastebin.com/GkiYePhQ

...zur Antwort

suche halt ein plugin wie http://dev.bukkit.org/server-mods/shops/ wo man sagen kann wen du mir das item rose brings bekommst du das item. nur dsa plugin hat den nachteil wen man einfach drüber leuft bekommt man das schwebene Item ohne das man was zahlt. kent wer da was

...zur Antwort