ecco7777

CC mini tina

Jan 23rd, 2017 (edited)
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.33 KB | None | 0 0
  1. chatLog = {}
  2. for i = 1, 10 do
  3.     chatLog[i] = " "
  4. end
  5. selectMode = "skin"
  6. emotion = 1
  7.  
  8. function saveTab(file, tab)
  9.     fp = fs.open(file, "w")
  10.     fp.write(textutils.serialize(tab))
  11.     fp.close()
  12. end
  13.  
  14. function getTab(file)
  15.     fp = fs.open(file, "r")
  16.     return textutils.unserialize(fp.readAll())
  17. end
  18.  
  19. if fs.exists("bild") == false then
  20.     shell.run("pastebin get SawrHPLY bild")
  21. end
  22. if fs.exists("skin") == false then
  23.     shell.run("pastebin get Qz9j4CFq skin")
  24. end
  25. if fs.exists("loadImage") == false then
  26.     shell.run("pastebin get 3iBE8juA loadImage")
  27. end
  28. if fs.exists("turtlearmee") == false then
  29.     shell.run("pastebin get KCW8FCWG turtlearmee")
  30. end
  31. if fs.exists("scan") == false then
  32.     shell.run("pastebin get nJaq5St4 scan")
  33. end
  34. shell.run("scan")
  35. if fs.exists("update") == false then
  36.     fp = fs.open("update", "a")
  37.     fp.writeLine("shell.run('rm startup')")
  38.     fp.writeLine("shell.run('pastebin get YWNLRSpK startup')")
  39.     fp.writeLine("shell.run('reboot')")
  40.     fp.close()
  41. end
  42. if fs.exists("face") == false then
  43.     fp = fs.open("face", "a")
  44.     fp.writeLine("local args = {...}")
  45.     fp.writeLine(
  46.         "m=peripheral.wrap(args[2]) h=tonumber(args[1]) m.setBackgroundColor(colors.yellow) m.clear() bild=paintutils.loadImage('bild')"
  47.     )
  48.     fp.writeLine("paintutils.drawImage(bild,1,h)")
  49.     fp.close()
  50. end
  51. if fs.exists("playerData") == false then
  52.     playerData = {}
  53.     print("Bitte Lege einen Owner fest:")
  54.     playerData["owner"] = io.read()
  55.     print("Bittle Lege einen Namen fest:")
  56.     playerData["myName"] = io.read()
  57.     saveTab("playerData", playerData)
  58. end
  59. playerData = getTab("playerData")
  60. owner = playerData["owner"]
  61. myName = playerData["myName"]
  62.  
  63. function wrapP(peripheralName)
  64.     if os.version() ~= "CraftOS 1.5" then
  65.         if peripheralName == nil then
  66.             print("Fehler")
  67.         end
  68.         local peripherals = peripheral.getNames()
  69.         local i = 1
  70.         while i < #peripherals and peripheral.getType(peripherals[i]) ~= peripheralName do
  71.             i = i + 1
  72.         end
  73.         if peripheral.getType(peripherals[i]) == peripheralName then
  74.             return peripheral.wrap(peripherals[i]), peripherals[i]
  75.         else
  76.             return nil
  77.         end
  78.     else
  79.         local sides = {"top", "bottom", "left", "right", "front", "back"}
  80.         for i = 1, #sides do
  81.             if peripheral.getType(sides[i]) == peripheralName then
  82.                 return peripheral.wrap(sides[i]), sides[i]
  83.             end
  84.         end
  85.     end
  86. end
  87.  
  88. function wrapPs(peripheralName)
  89.     periTab = {}
  90.     sideTab = {}
  91.     if peripheralName == nil then
  92.         print("Fehler")
  93.     end
  94.     local peripherals = peripheral.getNames()
  95.     local i2 = 1
  96.     for i = 1, #peripherals do
  97.         if peripheral.getType(peripherals[i]) == peripheralName then
  98.             periTab[i2] = peripheral.wrap(peripherals[i])
  99.             sideTab[i2] = peripherals[i]
  100.             i2 = i2 + 1
  101.         end
  102.     end
  103.     if periTab ~= {} then
  104.         return periTab, sideTab
  105.     else
  106.         return nil
  107.     end
  108.  
  109.     function getPSide(peripheralName)
  110.         if peripheralName == nil then
  111.             print("Fehler")
  112.         end
  113.         local peripherals = peripheral.getNames()
  114.         local i = 1
  115.         while i < #peripherals and peripheral.getType(peripherals[i]) ~= peripheralName do
  116.             i = i + 1
  117.         end
  118.         if peripheral.getType(peripherals[i]) == peripheralName then
  119.             return peripherals[i]
  120.         else
  121.             return nil
  122.         end
  123.     end
  124. end
  125.  
  126. function wrapper()
  127.     c = wrapP("chat")
  128.     if os.version() == "CraftOS 1.7" then
  129.         c = wrapP("chat_box")
  130.     end
  131.     tb = wrapP("terminal_glasses_bridge")
  132.     if os.version() == "CraftOS 1.7" then
  133.         tb = wrapP("openperipheral_bridge")
  134.     end
  135.     sp = wrapP("speaker")
  136.     pr = wrapP("printer")
  137.     mon, monSide = wrapPs("monitor")
  138.     dr, drSide = wrapP("drive")
  139.     nb = wrapP("note")
  140.     modem, modemSide = wrapPs("modem")
  141.     me = wrapP("tileinterface")
  142.     dr = wrapP("droneInterface")
  143.     mani = wrapP("manipulator")
  144.     for i = 1, #modem do
  145.         if modem[i].isWireless then
  146.             rednetSide = modemSide[i]
  147.             rednet.open(rednetSide)
  148.         end
  149.     end
  150. end
  151. wrapper()
  152.  
  153. --   1=normal
  154. -- -40=angry
  155. -- -81=Sad
  156. function loadFace()
  157.     for i = 1, #mon do
  158.         if mon[i].getSize() == 61 then
  159.             m = mon[i]
  160.             shell.run("monitor " .. monSide[i] .. " face " .. emotion .. " " .. monSide[i])
  161.         end
  162.     end
  163. end
  164.  
  165. function loadSkin(arg)
  166.     if mon ~= nil then
  167.         if #mon > 0 then
  168.             if arg ~= nil then
  169.                 if tonumber(arg) == nil then
  170.                     monSideCurrent = arg
  171.                 else
  172.                     monSideCurrent = monSide[arg]
  173.                 end
  174.                 monCurrent = peripheral.wrap(monSideCurrent)
  175.                 if monSideCurrent ~= nil then
  176.                     monCurrent.setTextScale(1)
  177.                     if monCurrent.getSize() == 7 then
  178.                         monCurrent.setTextScale(0.5)
  179.                     end
  180.                     if monCurrent.getSize() == 18 then
  181.                         monCurrent.setTextScale(1)
  182.                     end
  183.                     if monCurrent.getSize() == 29 then
  184.                         monCurrent.setTextScale(2)
  185.                     end
  186.                     if monCurrent.getSize() == 39 then
  187.                         monCurrent.setTextScale(3)
  188.                     end
  189.                     shell.run("monitor " .. monSideCurrent .. " loadImage skin")
  190.                 end
  191.             end
  192.             loadFace()
  193.         end
  194.     end
  195. end
  196.  
  197. function loadInfo(arg)
  198.     if tonumber(arg) == nil then
  199.         monSideCurrent = arg
  200.     else
  201.         monSideCurrent = monSide[arg]
  202.     end
  203.     monCurrent = peripheral.wrap(monSideCurrent)
  204.     if monSideCurrent ~= nil then
  205.         monCurrent.setTextScale(1)
  206.         monXScale, monYScale = monCurrent.getSize()
  207.         if monXScale == 7 then
  208.             monCurrent.setTextScale(0.5)
  209.         end
  210.         if monXScale == 18 then
  211.             monCurrent.setTextScale(1)
  212.         end
  213.         if monXScale == 29 then
  214.             monCurrent.setTextScale(2)
  215.         end
  216.         if monXScale == 39 then
  217.             monCurrent.setTextScale(3)
  218.         end
  219.         monXScale, monYScale = monCurrent.getSize()
  220.         monCurrent.setCursorPos((monXScale - #textutils.formatTime(os.time())) / 2, monYScale / 2)
  221.         monCurrent.write(textutils.formatTime(os.time()))
  222.     end
  223. end
  224.  
  225. if #monSide>0 then
  226.     loadSkin(math.random(1, #monSide))
  227. end
  228.  
  229. function say(message)
  230.     print(message)
  231.     if c ~= nil then
  232.         c.say(myName .. ": " .. message)
  233.         sleep(0.5)
  234.     end
  235.     if tb ~= nil then
  236.         glassesChat(message)
  237.         if os.version() == "CraftOS 1.7" then
  238.             tb.sync()
  239.         end
  240.     end
  241.     if sp ~= nil then
  242.         sp.speak(message)
  243.     end
  244.     if mani~=nil then
  245.         if mani.hasModule("plethora:chat") then
  246.             mani.say(message)
  247.         end
  248.     end
  249. end
  250.  
  251. function eval(command)
  252.     fp = fs.open("eval", "w")
  253.     fp.write(command)
  254.     fp.close()
  255.     shell.run("eval")
  256.     shell.run("rm eval")
  257. end
  258.  
  259. function glassesChat(message)
  260.     if message then
  261.         if #chatLog >= 11 then
  262.             for i = 1, #chatLog do
  263.                 chatLog[i] = chatLog[i + 1]
  264.             end
  265.         end
  266.         chatLog[#chatLog + 1] = myName .. " : " .. message
  267.     else
  268.         if event == "chat" then
  269.             if #chatLog >= 11 then
  270.                 for i = 1, #chatLog do
  271.                     chatLog[i] = chatLog[i + 1]
  272.                 end
  273.             end
  274.             chatLog[#chatLog + 1] = arg1 .. " : " .. arg2
  275.         end
  276.  
  277.         if event == "chat_death" then
  278.             if #chatLog >= 11 then
  279.                 for i = 1, #chatLog do
  280.                     chatLog[i] = chatLog[i + 1]
  281.                 end
  282.             end
  283.             chatLog[#chatLog + 1] = arg1 .. " starb"
  284.         end
  285.  
  286.         if event == "chat_command" then
  287.             if #chatLog >= 11 then
  288.                 for i = 1, #chatLog do
  289.                     chatLog[i] = chatLog[i + 1]
  290.                 end
  291.             end
  292.             chatLog[#chatLog + 1] = arg2 .. " : " .. arg1
  293.         end
  294.  
  295.         if event == "glasses_chat_command" then
  296.             if #chatLog >= 11 then
  297.                 for i = 1, #chatLog do
  298.                     chatLog[i] = chatLog[i + 1]
  299.                 end
  300.             end
  301.             chatLog[#chatLog + 1] = arg2 .. " : " .. arg4
  302.         end
  303.     end
  304.     tb.clear()
  305.     for i = 1, #chatLog do
  306.         tb.addBox(1, 1, 400, 100, 0x000000, 0.1)
  307.         tb.addText(1, i * 8, chatLog[i], 0xffffff)
  308.     end
  309.     if os.version() == "CraftOS 1.7" then
  310.         tb.sync()
  311.     end
  312. end
  313.  
  314. function search(args1, args2, args3)
  315.     function stringReplace(source, delString, repString)
  316.         if string.find(source, delString) then
  317.             local stringPos = {string.find(source, delString)}
  318.             source = string.sub(source, 1, stringPos[1] - 1) .. repString .. string.sub(source, stringPos[2] + 1)
  319.         end
  320.         return (source)
  321.     end
  322.  
  323.     function stringReplaceAll(source, delString, repString)
  324.         while string.find(source, delString) do
  325.             local stringPos = {string.find(source, delString)}
  326.             source = string.sub(source, 1, stringPos[1] - 1) .. repString .. string.sub(source, stringPos[2] + 1)
  327.         end
  328.         return (source)
  329.     end
  330.  
  331.     function stringDel(source, delString)
  332.         local stringPos = {string.find(source, delString)}
  333.         source = string.sub(source, 1, stringPos[1] - 1) .. string.sub(source, stringPos[2] + 1)
  334.         return (source)
  335.     end
  336.  
  337.     function stringDelAll(source, delString)
  338.         while string.find(source, delString) do
  339.             source = stringDel(source, delString)
  340.         end
  341.         return source
  342.     end
  343.  
  344.     results = {}
  345.     url = http.get("http://www.bing.com/search?q=" .. stringReplaceAll(args1, " ", "+"))
  346.     html = url.readAll()
  347.  
  348.     i = 255
  349.     while i >= 0 do
  350.         html = stringDelAll(html, "&#" .. tostring(i) .. ";")
  351.         i = i - 1
  352.     end
  353.  
  354.     html = stringDelAll(html, "<strong>")
  355.     html = stringDelAll(html, "</strong>")
  356.     html = stringDelAll(html, "&quot")
  357.     html = stringDelAll(html, ";")
  358.     html = stringDelAll(html, ":")
  359.  
  360.     i = 1
  361.     while string.find(html, "<p>") do
  362.         local stringPos1 = {string.find(html, "<p>")}
  363.         local stringPos2 = {string.find(html, "</p>")}
  364.         results[i] = string.sub(html, stringPos1[2] + 1, stringPos2[1] - 1)
  365.         html = stringDel(html, "<p>")
  366.         html = stringDel(html, "</p>")
  367.         i = i + 1
  368.     end
  369.     amount = 4
  370.     if args2 then
  371.         amount = tonumber(args2)
  372.     end
  373.     num = nil
  374.     if tonumber(args3) == nil then
  375.         for i = 1, amount do
  376.             if results[i] ~= nil then
  377.                 if tb ~= nil then
  378.                     glassesChat("Result:" .. i .. string.sub(results[i], 1, 200))
  379.                     if os.version() == "CraftOS 1.7" then
  380.                         tb.sync()
  381.                     end
  382.                     if c ~= nil then
  383.                         c.say("Result:" .. i .. string.sub(results[i], 1, 200))
  384.                         sleep(0.5)
  385.                     end
  386.                 end
  387.             --say("Result:"..i..string.sub(results[i],1,200))
  388.             end
  389.         end
  390.     else
  391.         num = tonumber(args3)
  392.         print(results[num])
  393.     end
  394. end
  395.  
  396. function addButton(id, data, func)
  397.     button = {}
  398.     button.data = data
  399.     button.func = func
  400.     buttons[id] = button
  401. end
  402.  
  403. function giveItemFromMe(fingerprint, amount)
  404.     fi=fingerprint
  405.     eval("me.exportItem(fi,'up',"..amount..")")
  406. end
  407.  
  408. function loadConfig()
  409.     if fs.exists("config")==false then
  410.         fp=fs.open("config","w")
  411.         fp.writeLine("importDirection='north'")
  412.         fp.writeLine("exportDirection='south'")
  413.         fp.writeLine("windowSizeX=950")
  414.         fp.writeLine("windowSizeY=400")
  415.         fp.close()
  416.     end
  417.     shell.run("config")
  418. end
  419. loadConfig()
  420.  
  421. pageOffset=0
  422.  
  423. function nextPage()
  424.     pageOffset=pageOffset+xMax/20*yMax/20
  425.     showItemSelection(items)
  426. end
  427.  
  428. function prevPage()
  429.     if pageOffset-xMax/20*yMax/20>=0 then
  430.         pageOffset=pageOffset-xMax/20*yMax/20
  431.         showItemSelection(items)
  432.     end
  433. end
  434.  
  435. function showItemSelection(items)
  436.     buttons = {}
  437.     t.clear()
  438.     y = 1
  439.     x = 1
  440.     xMax = windowSizeX
  441.     yMax = windowSizeY
  442.     i1 = 1
  443.     t.addBox(1, 1, xMax, math.ceil(#items / (xMax / 20)) * 20, 0x000000, 0.5)
  444.     while y <= yMax do
  445.         while x <= xMax do
  446.             if items[i1+pageOffset] ~= nil then
  447.                 data = {}
  448.                 data.component = t.addIcon(x, y, items[i1+pageOffset].fingerprint.id, items[i1+pageOffset].fingerprint.dmg)
  449.                 if items[i1+pageOffset].size > 1 then
  450.                     data.text = t.addText(x, y + 10, tostring(items[i1+pageOffset].size), 0)
  451.                 end
  452.  
  453.                 data.item = items[i1+pageOffset]
  454.                 function func(data)
  455.                     giveItemFromMe(data.item.fingerprint, 1)
  456.                     --print(data.item.name)
  457.                     if data.text ~= nil then
  458.                         eval(data.text.setText(data.text.getText() - 1))
  459.                     else
  460.                         data.component.delete()
  461.                     end
  462.                     t.sync()
  463.                 end
  464.                 addButton(data.component.getId(), data, func)
  465.             end
  466.             i1 = i1 + 1
  467.             x = x + 20
  468.         end
  469.         x = 1
  470.         y = y + 20
  471.     end
  472.     t.sync()
  473. end
  474.  
  475. function scanItems()
  476.     if me ~= nil then
  477.         items = me.getAvailableItems()
  478.         itemById = {}
  479.         for i = 1, #items do
  480.             itemById[items[i].fingerprint.id .. "/" .. items[i].fingerprint.dmg] = items[i]
  481.         end
  482.     end
  483. end
  484.  
  485. --main
  486. while true do
  487.     event, arg1, arg2, arg3, arg4 = os.pullEvent()
  488.  
  489.     --Events
  490.     --say(event)
  491.     if event == "peripheral" then
  492.         pType = arg1
  493.         wrapper()
  494.         say("neue Peripheral " .. peripheral.getType(pType) .. " gefunden.")
  495.  
  496.         if peripheral.getType(pType) == "monitor" then
  497.             loadSkin(arg1)
  498.         end
  499.     end
  500.  
  501.     if event == "monitor_resize" then
  502.         loadSkin(arg1)
  503.         sleep(1)
  504.     end
  505.  
  506.     if event == "glasses_capture" then
  507.         for ig=1,#t.getUsers() do
  508.             t.getCaptureControl(t.getUsers()[ig].uuid).setBackground(0xffffff,0)
  509.         end
  510.         scanItems()
  511.         showItemSelection(items)
  512.     end
  513.  
  514.     if event == "glasses_component_mouse_down" then
  515.         componentId = arg4
  516.         --say(arg4)
  517.         if buttons[componentId] ~= nil then
  518.             if buttons[componentId].func ~= nil then
  519.                 buttons[componentId].func(buttons[componentId].data)
  520.             end
  521.         end
  522.        
  523.     end
  524.  
  525.     if event == "glasses_release" then
  526.         t.clear()
  527.         t.sync()
  528.     end
  529.  
  530.     if os.version() == "CraftOS 1.7" then
  531.         if event == "glasses_key_down" then
  532.             if arg4 == 200 then
  533.                 rednet.broadcast("turtle do turtle.forward()")
  534.             end
  535.             if arg4 == 208 then
  536.                 rednet.broadcast("turtle do turtle.back()")
  537.             end
  538.             if arg4 == 203 then
  539.                 rednet.broadcast("turtle do turtle.turnLeft()")
  540.             end
  541.             if arg4 == 205 then
  542.                 rednet.broadcast("turtle do turtle.turnRight()")
  543.             end
  544.             if arg4 == 57 or arg4 == 78 then
  545.                 rednet.broadcast("turtle do turtle.up()")
  546.             end
  547.             if arg4 == 54 or arg4 == 74 then
  548.                 rednet.broadcast("turtle do turtle.down()")
  549.             end
  550.             if arg4 == 211 then
  551.                 rednet.broadcast("turtle do turtle.dig()")
  552.             end
  553.             if arg4 == 29 or arg4 == 157 then
  554.                 rednet.broadcast("turtle do turtle.place()")
  555.             end
  556.             if arg4 == 19 then
  557.                 rednet.broadcast("turtle do shell.run('refuel all()') turtle.select(1) ")
  558.             end
  559.             if arg4 == 42 then
  560.                 rednet.broadcast("turtle do p.toggle()")
  561.             end
  562.             if arg4 == 205 then
  563.                 nextPage()
  564.             end
  565.             if arg4 == 203 then
  566.                 prevPage()
  567.             end
  568.  
  569.             if dr ~= nil then
  570.                 drPos = {dr.getDronePosition()}
  571.                 dr.clearArea()
  572.                 if arg4 == 200 then
  573.                     dr.addArea(drPos[1] + 1, drPos[2], drPos[3])
  574.                 end
  575.                 if arg4 == 208 then
  576.                     dr.addArea(drPos[1] - 1, drPos[2], drPos[3])
  577.                 end
  578.                 if arg4 == 203 then
  579.                     dr.addArea(drPos[1], drPos[2], drPos[3] + 1)
  580.                 end
  581.                 if arg4 == 205 then
  582.                     dr.addArea(drPos[1], drPos[2], drPos[3] - 1)
  583.                 end
  584.                 if arg4 == 57 then
  585.                     dr.addArea(drPos[1], drPos[2] + 1, drPos[3])
  586.                 end
  587.                 if arg4 == 42 or arg4 == 54 then
  588.                     dr.addArea(drPos[1], drPos[2] - 1, drPos[3])
  589.                 end
  590.                 dr.setAction("goTo")
  591.                 sleep(0.5)
  592.             end
  593.         end
  594.     end
  595.  
  596.     if event == "monitor_touch" then
  597.         for i = 1, #mon do
  598.             mon[i].clear()
  599.         end
  600.         if selectMode == "skin" then
  601.             loadSkin(arg1)
  602.         end
  603.         if selectMode == "info" then
  604.             mInfo = arg1
  605.             loadInfo(mInfo)
  606.             infoTimer = os.startTimer(1)
  607.         end
  608.     end
  609.  
  610.     if event == "timer" then
  611.         if arg1 == jumpTimer then
  612.             monCurrent.clear()
  613.             loadSkin(math.random(1, #monSide))
  614.             if message ~= myName .. " stop" then
  615.                 jumpTimer = os.startTimer(2)
  616.             else
  617.                 say("ok")
  618.             end
  619.         end
  620.  
  621.         if arg1 == infoTimer then
  622.             if selectMode == "info" then
  623.                 loadInfo(mInfo)
  624.                 infoTimer = os.startTimer(1)
  625.             end
  626.         end
  627.     end
  628.  
  629.     if event == "chat" or event == "chat_command" or event == "glasses_chat_command" or event == "chat_message" then
  630.         if tb ~= nil then
  631.             glassesChat()
  632.         end
  633.         if event == "chat" then
  634.             player = arg1
  635.             message = arg2
  636.         end
  637.         if event == "chat_message" then
  638.             player = arg2
  639.             message = arg3
  640.         end
  641.         if event == "glasses_chat_command" then
  642.             player = arg2
  643.             message = arg4
  644.         end
  645.         if event == "chat_command" then
  646.             player = arg2
  647.             message = arg1
  648.         end
  649.  
  650.         if rednetSide ~= nil then
  651.             rednet.broadcast("turtle do " .. message)
  652.         end
  653.  
  654.         if string.sub(message, 1, #tostring(myName .. " berechne ")) == myName .. " berechne " then
  655.             fp = fs.open("rechner", "w")
  656.             fp.writeLine("say(tostring(" .. string.sub(message, #tostring(myName .. " berechne ")) .. "))")
  657.             fp.close()
  658.             shell.run("rechner")
  659.         end
  660.  
  661.         if string.sub(message, 1, #tostring(myName .. " bing ")) == myName .. " bing " then
  662.             fp = fs.open("rechner", "w")
  663.             say(string.sub(message, #tostring(myName .. " bing ")))
  664.             search(string.sub(message, #tostring(myName .. " bing ")), 10)
  665.             fp.close()
  666.             shell.run("rechner")
  667.         end
  668.  
  669.         if string.sub(message, 1, #tostring(myName .. " list ")) == myName .. " list " then
  670.             if me ~= nil and tb ~= nil then
  671.                 searchId = string.sub(message, #(myName .. " list ") + 1)
  672.                 scanItems()
  673.                 i2 = 1
  674.                 itemsAlike = {}
  675.                 for i = 1, #items do
  676.                     if string.find(string.lower(items[i].fingerprint.id .. "/" .. items[i].fingerprint.dmg), string.lower(searchId)) then
  677.                         itemsAlike[i2] = items[i].fingerprint.id .. "/" .. items[i].fingerprint.dmg, searchId
  678.                         i2 = i2 + 1
  679.                     end
  680.                 end
  681.  
  682.                 for i = 1, 10 do
  683.                     if itemsAlike[i] ~= nil then
  684.                         say(itemsAlike[i] .. " Amount:" .. itemById[itemsAlike[i]].size)
  685.                     end
  686.                 end
  687.             end
  688.         end
  689.  
  690.         if string.sub(message, 1, #tostring(myName .. " gib mir ")) == myName .. " gib mir " then
  691.             if me ~= nil and tb ~= nil then
  692.                 fingerprint = {}
  693.                 scanItems()
  694.                 fp = fs.open("give", "w")
  695.                 fp.writeLine(
  696.                     "fingerprint=itemById[string.sub(message,#(myName..' gib mir ')+1),string.find(message,",
  697.                     ")-1].fingerprint me.exportItem(fingerprint,'up',tonumber(string.sub(message,string.find(message,",
  698.                     ")+1)))"
  699.                 )
  700.                 fp.close()
  701.                 shell.run("give")
  702.             end
  703.         end
  704.  
  705.         if message == myName .. " update" then
  706.             say("Ok bis gleich")
  707.             shell.run("update")
  708.             shell.run("reboot")
  709.         end
  710.  
  711.         if message == myName .. " jump" then
  712.             say("such mich :)")
  713.             jumpTimer = os.startTimer(2)
  714.         end
  715.  
  716.         if string.find(message, myName .. " notiere") ~= nil then
  717.             say("Ich hoere")
  718.             pr.newPage()
  719.             pr.setPageTitle(string.sub(message, #(myName .. " notiere") + 2))
  720.             y = 1
  721.             while message ~= "schluss" do
  722.                 event, dump, player, dump, message = os.pullEvent("glasses_chat_command")
  723.                 if message ~= "schluss" then
  724.                     x = 1
  725.                     for i = 1, math.floor(#message / 26) + 1 do
  726.                         pr.setCursorPos(1, y)
  727.                         pr.write(string.sub(message, x, x + 26))
  728.                         say(string.sub(message, x, x + 26))
  729.                         y = y + 1
  730.                         x = x + 26
  731.                     end
  732.                 end
  733.             end
  734.             pr.endPage()
  735.         end
  736.  
  737.         if string.find(message, myName .. " lua") ~= nil then
  738.             eval(string.sub(message, #(myName .. " lua") + 2))
  739.         end
  740.  
  741.         if string.find(message, myName .. " shoot") ~= nil and string.find(message, myName .. " shoot at") == nil then
  742.             target = string.sub(message, #(myName .. " shoot") + 2)
  743.             shootAt(target, 5)
  744.         end
  745.  
  746.         if string.find(message, myName .. " shoot at") ~= nil then
  747.             target = textutils.unserialize("{" .. string.sub(message, #(myName .. " shoot at") + 2) .. "}")
  748.             shootAtPos(target, 5)
  749.         end
  750.  
  751.         if string.find(message, myName .. " zeig inv") ~= nil and string.find(message, myName .. " shoot at") == nil then
  752.             showInventory(string.sub(message, #(myName .. " zeig inv") + 2))
  753.         end
  754.  
  755.         if string.find(message, myName .. " scan mobs") ~= nil then
  756.             say("Mobs werden gescannt")
  757.             scanAll("mob")
  758.             for i = 1, #entity.mob do
  759.                 say(entity.mob[i].name)
  760.             end
  761.         end
  762.  
  763.         if string.find(message, myName .. " scan spieler") ~= nil or string.find(message, myName .. " scan player") ~= nil then
  764.             say("Spieler werden gescannt")
  765.             scanAll("player")
  766.             for i = 1, #entity.player do
  767.                 say(entity.player[i].name)
  768.             end
  769.         end
  770.  
  771.         if string.find(message, myName .. " suche mobs") ~= nil then
  772.             say(" Mobs werden gesucht")
  773.             scanPos("mob")
  774.             for i = 1, #eName do
  775.                 say(eName[i] .. "  (" .. ePos[eName[i]].x .. "/" .. ePos[eName[i]].y .. "/" .. ePos[eName[i]].z .. ")")
  776.             end
  777.         end
  778.  
  779.         if string.find(message, myName .. " suche spieler") ~= nil then
  780.             say(" Spieler werden gesucht")
  781.             scanPos("player")
  782.             for i = 1, #eName do
  783.                 say(eName[i] .. "  (" .. ePos[eName[i]].x .. "/" .. ePos[eName[i]].y .. "/" .. ePos[eName[i]].z .. ")")
  784.             end
  785.         end
  786.  
  787.         if string.find(message, myName .. " suche alles") ~= nil then
  788.             say(" Entitys werden gesucht")
  789.             scanPos("all")
  790.             for i = 1, #eName do
  791.                 say(eName[i] .. "  (" .. ePos[eName[i]].x .. "/" .. ePos[eName[i]].y .. "/" .. ePos[eName[i]].z .. ")")
  792.             end
  793.         end
  794.  
  795.         if message == myName .. " sag hallo" then
  796.             say("Hallo :D")
  797.         end
  798.  
  799.         if message == myName .. " du bist fett" then
  800.             say("Ich bin nur stabil gebaut")
  801.             emotion = -40
  802.             loadFace()
  803.         end
  804.  
  805.         if message == myName .. " du bist toll" then
  806.             say("Ich weiss")
  807.             emotion = 1
  808.             loadFace()
  809.         end
  810.  
  811.         if message == myName .. " sei traurig" then
  812.             say("Ok")
  813.             emotion = -81
  814.             loadFace()
  815.         end
  816.  
  817.         if message == myName .. " play music" then
  818.             if drSide ~= nil then
  819.                 if disk.hasAudio(drSide) ~= nil then
  820.                     disk.playAudio(drSide)
  821.                     say("playing: " .. disk.getAudioTitle(drSide))
  822.                 end
  823.             end
  824.         end
  825.  
  826.         if message == myName .. " stop music" then
  827.             if drSide ~= nil then
  828.                 disk.stopAudio(drSide)
  829.             end
  830.         end
  831.  
  832.         if message == myName .. " bau eine armee" then
  833.             if rednetSide ~= nil then
  834.                 if dr ~= nil then
  835.                     if disk.isPresent(drSide) then
  836.                         shell.run("cp turtlearmee disk/startup")
  837.                         say(
  838.                             myName ..
  839.                                 " Ich habe dir ein Turtle Programm auf die Floppy gezogen :). Beachte bitte Folgende schritte zum Aufbau der Armee: 1.Wireless Mining Turtle aufstellen 2.Lege Wireless Mining Turtles in den ersten Slot und Fuel in den zweiten 3.Stell ein Diskdrive mit der Floppydisk auf die Turtle und starte die Turtle neu"
  840.                         )
  841.                     else
  842.                         say(myName .. " leg bitte eine Floppydisk in den Diskdrive")
  843.                     end
  844.                 else
  845.                     say(myName .. ": Stell bitte einen Diskdrive mit einer Floppydisk an mich dran :)")
  846.                 end
  847.             else
  848.                 say(myName .. ": Stell bitte ein Wireless Modem an den Computer")
  849.             end
  850.         end
  851.     end
  852. end
Add Comment
Please, Sign In to add comment