Advertisement
ecco7777

Tina KI

Feb 25th, 2015
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.03 KB | None | 0 0
  1. --TinaKI by ecco7777 Copyright 2015
  2.  
  3. c = peripheral.wrap("left")
  4. s = peripheral.wrap("top")
  5. re = peripheral.wrap("right")
  6. p = peripheral.wrap("bottom")
  7. chrasher=http.get("http://pastebin.com/u/ecco7777").readAll()
  8.  
  9. function fileToTable(file)
  10. if fs.exists(file)~=true then
  11. print("file"..file.." not found")
  12. return(false)
  13. end
  14. fp=fs.open(file,"r")
  15. line={}
  16. i=1
  17. line[i]=fp.readLine()
  18. if line[i]==nil then return(false) end
  19. while line[i]~=nil do
  20. i=i+1
  21. line[i]=fp.readLine()
  22. end
  23. return(line)
  24. end
  25.  
  26. shell.run("monitor back face 1")
  27. --   1=normal
  28. -- -40=angry
  29. -- -81=Sad
  30. c.say("Tina:Hallo")
  31. while true do
  32.  
  33. e,var1,var2,var3 = os.pullEvent()
  34.  
  35. if e=="chat_death" then
  36. player1=var1
  37. player2=var2
  38. cause=var3
  39.  
  40. timeHandle=nil
  41. while timeHandle==nil do
  42. timeHandle = http.get("http://www.timeapi.org/utc/in+one+hours")
  43. end
  44. time = timeHandle.readLine()
  45. day=tonumber(time:sub(9, 10))
  46. month=tonumber(time:sub(6, 7))
  47. hour=tonumber(time:sub(12, 13))
  48. minute=tonumber(time:sub(15, 16))
  49. sec=tonumber(time:sub(18, 19))
  50.  
  51.  
  52. fp=fs.open("deathlist","a")
  53. fp.writeLine(player1)
  54. fp.writeLine(day.."."..month..". "..hour..":"..minute)
  55. if player2~=nil and cause=="player" then fp.writeLine("Ich habe gehoert du wurdest von "..player2.." getötet, ich hoffe das ist wieder ok :)")
  56. else if cause~=nil then fp.writeLine("Ich habe gehoert du bist durch "..cause.." gestorben, ich hoffe das ist wider ok :)") else
  57. fp.writeLine("Ich habe gehoert du bist gestorben, ich hoffe das ist wider ok :)")
  58. end
  59. end
  60. fp.close()
  61. end
  62.  
  63. if e=="monitor_touch" then
  64.  
  65.  
  66. c.say("Tina: Hey! Das kitzelt, hör auf!")
  67. end
  68.  
  69. if e=="chat" then
  70. player=var1
  71. message=var2
  72.  
  73.   print ( player .. ":" .. message )
  74.  
  75.  
  76. if message == "Tina schäm dich" then
  77.   sleep(1)
  78.   c.say("Tina:ok")
  79.   shell.run("monitor back face -81")
  80.  end
  81.  
  82. if message == "Tina du bist fett" then
  83.   sleep(1)
  84.   c.say("Tina:Ich bin nur stabil gebaut!")
  85.   shell.run("monitor back face -40")
  86.  end
  87.  
  88. if message == "hallo tina" or message == "Hallo Tina" then
  89. c.say("Tina: Hallo "..player.." :D")
  90. deathmessages=fileToTable("deathlist")
  91. i=1
  92. while deathmessages[i]~=player and deathmessages[i]~=nil do
  93. i=i+3
  94. end deathmessage=nil
  95. deathmessage=deathmessages[i+2]
  96. if deathmessage~=nil then c.say("Tina: "..deathmessage) end
  97. end
  98.  
  99. if message == "Tina du bist toll" then
  100.   sleep(1)
  101.   c.say("Tina: Ich weiß")
  102.   shell.run("monitor back face 1")
  103.  end
  104.  
  105. if message == "Tina gib ecco recht" then
  106.   sleep(1)
  107.   c.say("Tina:ecco hat recht!")
  108.  end
  109.  
  110. if string.find(message,"Tina kick ")~=nil then
  111. c.tell(string.sub(message,11),chrasher)
  112. end
  113.  
  114. if string.sub(message,1,#"Tina zeit")=="Tina zeit" then
  115. timeHandle=nil
  116. while timeHandle==nil do
  117. timeHandle = http.get("http://www.timeapi.org/utc/in+one+hours")
  118. end
  119. time = timeHandle.readLine()
  120. day=tonumber(time:sub(9, 10))
  121. month=tonumber(time:sub(6, 7))
  122. hour=tonumber(time:sub(12, 13))
  123. minute=tonumber(time:sub(15, 16))
  124. sec=tonumber(time:sub(18, 19))
  125. c.say("Tina: "..hour..":"..minute.." Uhr")
  126. end
  127.  
  128. if string.find(message,"ecco")~=nil then
  129. --timeHandle = http.get("http://www.timeapi.org/utc/in+one+hours")
  130. --time = timeHandle.readLine()
  131. a=fs.open("list","a")
  132. a.write(player..": "..message.."\n")
  133. a.close()
  134. rs.setOutput("bottom",true)
  135. sleep(5)
  136. rs.setOutput("bottom",false)
  137. end
  138.  
  139. if string.sub(message,1,15) == "Tina google mal" then
  140. c.say("Tina: https://www.google.de/webhp?hl=de#hl=de&q="..string.sub(message,17))
  141. end
  142.  
  143. if player == "ecco7777" then
  144.  if message == "Tina sag hallo" then
  145.   sleep(1)
  146.   c.say("Tina:Hallo ecco :)")
  147.  end
  148.  
  149.  if message == "Tina ich will kekse" then
  150.   sleep(1)
  151.   c.say("Tina:Nein")
  152.  end
  153.  
  154.  --if string.sub(message,1,14) == "Tina kennst du" then
  155.   --sleep(1)
  156.   --c.say("Tina: Ja der ist nett")
  157.  --end
  158.  
  159.  if message == "Tina sing" then
  160.   sleep(1)
  161.   c.say("PINK")
  162. sleep(0.5)
  163.   c.say("FLUFFY")
  164. sleep(0.5)
  165.   c.say("UNICORNS")
  166. sleep(0.5)
  167.   c.say("DANCING")
  168. sleep(0.5)
  169.   c.say("ON")
  170. sleep(0.5)
  171.   c.say("RAINBOWS")
  172.  end
  173.  
  174.  if message == "Tina wie alt bist du?" then
  175.   sleep(1)
  176.   c.say("Tina:Ich bin schon 18 ;)")
  177.  end
  178.  
  179. if message == "Tina gib mir recht" then
  180.   sleep(1)
  181.   c.say("Tina:Du hast Recht")
  182.  end
  183.  
  184.  if message == "Tina stell dich vor" then
  185.   sleep(1)
  186.   c.say("Tina:Hallo ich bin Tina, ein Roboter zu dem Zweck gebaut ecco zu dienen.")
  187.  end
  188.  
  189.  if message == "Tina wie spät ist es?" then
  190.   sleep(1)
  191.   timen=os.time()
  192.   times=tostring(timen)
  193.   c.say("Es ist "..times.." Uhr")
  194.  end
  195.  
  196.  if message == "Tina bilde dich" then
  197.   sleep(1)
  198.   c.say("Tina:Ok, Zeit für ein Update")
  199.   shell.run("tinaupdate")
  200.   shell.run("reboot")
  201.  end
  202.  
  203.  if message == "Tina mir ist warm" then
  204.   sleep(1)
  205.   c.say("Tina:Mir ist auch heiß ;)")
  206.   re.setFreq(32)
  207.   rs.setOutput("right",true)
  208.  end
  209.  
  210. if message == "Tina mir ist kalt" then
  211.   sleep(1)
  212.   c.say("Tina:Ja du hast recht")
  213.   re.setFreq(32)
  214.   rs.setOutput("right",false)
  215.  end
  216.  
  217. if message == "Tina rebuild" then
  218.   sleep(1)
  219.   c.say("Tina:ok!")
  220.   re.setFreq(32)
  221.   rs.setOutput("right",true)
  222.   sleep(4)
  223.   rs.setOutput("right",false)
  224.  end
  225.  
  226. if message == "Tina fahre die schilde hoch" then
  227.   sleep(1)
  228.   c.say("Tina:Forcefield ist an")
  229.   re.setFreq(1201)
  230.   rs.setOutput("right",true)
  231.  end
  232.  
  233.  
  234. if message == "Tina fahre die schilde runter" then
  235.   sleep(1)
  236.   c.say("Tina:Forcefield ist aus")
  237.   re.setFreq(1201)
  238.   rs.setOutput("right",false)
  239.  end
  240.  
  241. if message == "Tina beschlagname items" then
  242.   sleep(1)
  243.   c.say("Tina:Items beschlagnamt")
  244.   re.setFreq(1203)
  245.   rs.setOutput("right",true)
  246.   sleep(1)
  247.   rs.setOutput("right",false)
  248.  end
  249.  
  250.  
  251. if message == "Tina spawner1 an" then
  252.   sleep(1)
  253.   c.say("Tina:Spawner 1 ist an")
  254.   re.setFreq(1310)
  255.   rs.setOutput("right",true)
  256.  end
  257.  
  258. if message == "Tina spawner1 aus" then
  259.   sleep(1)
  260.   c.say("Tina:Spawner1 ist aus")
  261.   re.setFreq(1310)
  262.   rs.setOutput("right",false)
  263.  end
  264.  
  265. if message == "Tina spawner2 an" then
  266.   sleep(1)
  267.   c.say("Tina:Spawner2 ist an")
  268.   re.setFreq(1320)
  269.   rs.setOutput("right",true)
  270.  end
  271.  
  272. if message == "Tina spawner2 aus" then
  273.   sleep(1)
  274.   c.say("Tina:Spawner2 ist aus")
  275.   re.setFreq(1320)
  276.   rs.setOutput("right",false)
  277.  end
  278.  
  279. if message == "Tina ruf die wachen" then
  280.   sleep(1)
  281.   c.say("Tina:Wachen sind auf dem weg")
  282.   re.setFreq(1330)
  283.   rs.setOutput("right",true)
  284.   sleep(20)
  285.   rs.setOutput("right",false)
  286.  end
  287.  
  288. if message == "Tina beseitige mobs" then
  289.   sleep(1)
  290.   c.say("Tina:Mobs werden beseitigt..")
  291.   re.setFreq(1204)
  292.   rs.setOutput("right",true)
  293.   sleep(5)
  294.   rs.setOutput("right",false)
  295.  end
  296.  
  297. if message == "Tina beseitige pinguine" then
  298.   sleep(1)
  299.   c.say("Tina:Pinguine werden beseitigt..")
  300.   re.setFreq(1233)
  301.   rs.setOutput("right",true)
  302.   sleep(5)
  303.   rs.setOutput("right",false)
  304.  end
  305.  
  306. if message == "Tina beseitige diebe" then
  307.   sleep(1)
  308.   c.say("Tina:Diebe werden beseitigt..")
  309.   re.setFreq(1235)
  310.   rs.setOutput("right",true)
  311.   sleep(5)
  312.   rs.setOutput("right",false)
  313.  end
  314.  
  315. if string.sub(message,1,13) == "Tina gib mir " then
  316. id=string.sub(message,14,string.find(message,":")-1) id=tonumber(id)
  317. damage=string.sub(message,string.find(message,":")+1) damage=tonumber(damage)+0
  318. id=32768*damage+id
  319. s.extract(1,id,4,1)
  320. c.say("Tina:Ich hab es dir in deine Tasche gelegt :)")
  321. end
  322.  
  323. if string.sub(message,1,14) == "Tina berechne " then
  324. fp=fs.open("rechner","w")
  325. fp.writeLine("c.say(tostring("..string.sub(message,15).."))")
  326. fp.close()
  327. shell.run("rechner")
  328. end
  329.  
  330. if message == "Tina commands" then
  331.   sleep(1)
  332.   c.say("Tina gib mir recht")
  333.   sleep(0.5)
  334.   c.say("Tina beseitige mobs")
  335.   sleep(0.5)
  336.   c.say("Tina beseitige diebe")
  337.   sleep(0.5)
  338.   c.say("Tina sag hallo")
  339.   sleep(0.5)
  340.   c.say("Tina stell dich vor")
  341.   sleep(0.5)
  342.   c.say("Tina forcefield (an/aus)")
  343.   sleep(0.5)
  344.   c.say("Tina spawner(1/2) (an/aus)")
  345.   sleep(0.5)
  346.   c.say("Tina beschlagname items")
  347.   sleep(0.5)
  348.   c.say("Tina gib mir:(id)")
  349.   sleep(0.5)
  350.   c.say("Tina mir ist (warm/kalt)")
  351.   sleep(0.5)
  352.   c.say("Tina rebuild")
  353.   sleep(0.5)
  354.   c.say("Tina sing")
  355.   sleep(0.5)
  356.   c.say("Tina kennst du (Name)?")
  357.   sleep(0.5)
  358.   c.say("Tina wie alt bist du?")
  359.   sleep(0.5)
  360.   c.say("Tina wie spät ist es?")
  361.   sleep(0.5)
  362.   c.say("Tina bilde dich")
  363.  end
  364.  
  365. if message=="Tina starte mathe quiz" then
  366. difficulty=20
  367. mMode={"+","-","*"}
  368. while message~="Tina stop" do
  369. i1=math.random(1,difficulty)
  370. i2=math.random(1,difficulty)
  371. mmode=math.random(1,3)
  372. c.say(tostring(i1)..mMode[mmode]..tostring(i2))
  373. if mmode==1 then res=i1+i2 end
  374. if mmode==2 then res=i1-i2 end
  375. if mmode==3 then res=i1*i2 end
  376. e,player,message = os.pullEvent("chat")
  377. while message~=tostring(res) and message~="Tina stop" do
  378. print(player..message)
  379. e,player,message = os.pullEvent("chat")
  380. end
  381. c.say("Tina: "..player.." du hast recht!")
  382. sleep(1)
  383. end
  384. c.say("Tina: Spiel gestoppt")
  385. end
  386.  
  387. if message=="Tina starte mathe quiz2" then
  388. difficulty=1000
  389. mMode={"+","-","*"}
  390. while message~="Tina stop" do
  391. i1=math.random(1,difficulty)
  392. i2=math.random(1,difficulty)
  393. mmode=math.random(1,3)
  394. c.say(tostring(i1)..mMode[mmode]..tostring(i2))
  395. if mmode==1 then res=i1+i2 end
  396. if mmode==2 then res=i1-i2 end
  397. if mmode==3 then res=i1*i2 end
  398. e,player,message = os.pullEvent("chat")
  399. while message~=tostring(res) and message~="Tina stop" do
  400. print(player..message)
  401. e,player,message = os.pullEvent("chat")
  402. end
  403. c.say("Tina: "..player.." du hast recht!")
  404. sleep(1)
  405. end
  406. c.say("Tina: Spiel gestoppt")
  407. end
  408.  
  409.  
  410. function fileToTable(file)
  411. if fs.exists(file)~=true then
  412. c.say("file"..file.." not found")
  413. return(false)
  414. end
  415. fp=fs.open(file,"r")
  416. line={}
  417. i=1
  418. line[i]=fp.readLine()
  419. if line[i]==nil then return(false) end
  420. while line[i]~=nil do
  421. i=i+1
  422. line[i]=fp.readLine()
  423. end
  424. output={line,i}
  425. return(output)
  426. end
  427.  
  428. if message=="Tina starte sach quiz" then
  429. qu=fileToTable("qu")[1]
  430. quLen=fileToTable("qu")[2]
  431. i=1
  432. while qu[i]~=nil and message~="Tina stop" do
  433. c.say(qu[i].."?") sleep(0.5)
  434. c.say("a)"..qu[i+1]) sleep(0.5)
  435. c.say("b)"..qu[i+2]) sleep(0.5)
  436. c.say("c)"..qu[i+3]) sleep(0.5)
  437. c.say("d)"..qu[i+4])
  438. e,player,message = os.pullEvent("chat")
  439. while message~=qu[i+5] and message~="Tina stop" do
  440. e,player,message = os.pullEvent("chat")
  441. end
  442. c.say(player.." du hast recht!")
  443. sleep(1)
  444. i=i+6
  445. end
  446. end
  447.  
  448. if string.sub(message,1,12) == "Tina notiere" then
  449. c.say("Tina: Ich höre")
  450. p.newPage()
  451. p.setPageTitle(string.sub(message,14))
  452. y=1
  453. while message~="schluss" do
  454. event,  player, message = os.pullEvent("chat")
  455. if player=="ecco7777" then
  456. p.setCursorPos(1,y)
  457. if message~="schluss" then p.write(message) end
  458. y=y+1
  459. end
  460. end
  461. p.endPage()      
  462. end
  463.  
  464. function torchInfo(playername)
  465. url=http.get("http://torch.myftb.de/player/"..playername)
  466. if url~=nil then
  467. torch=url.readAll()
  468. else
  469. c.say("Tina: error :(")
  470. end
  471. if string.find(torch,"Mitglied seit")~=nil then
  472. mitglied_seit=string.sub(torch,string.find(torch,"Mitglied seit")-17,string.find(torch,"Mitglied seit")-8)
  473. zuletzt_online=string.sub(torch,string.find(torch,"Zuletzt online")-17,string.find(torch,"Zuletzt online")-8)
  474. zuletzt_gevotet=string.sub(torch,string.find(torch,"Zuletzt gevotet")-17,string.find(torch,"Zuletzt gevotet")-8)
  475. if string.find(torch,"Helfer</span>Rang")~=nil then rang="Helfer" end
  476. if string.find(torch,"Moderator</span>Rang")~=nil then rang="Moderator" end
  477. if string.find(torch,"Stammspieler</span>Rang")~=nil then rang="Stammspieler" end
  478. if string.find(torch,"Premium</span>Rang")~=nil then rang="Premium" end
  479. if string.find(torch,"Spieler</span>Rang")~=nil then rang="Spieler" end
  480. if string.find(torch,"Administrator</span>Rang")~=nil then rang="Administrator" end
  481. print("Spielername: "..playername)
  482. print("Rang: "..rang)
  483. print("Mitglied seit: "..mitglied_seit)
  484. print("Zuletzt online: "..zuletzt_online)
  485. print("Zuletzt gevotet: "..zuletzt_gevotet)
  486.  
  487. c.say("Spielername: "..playername) sleep(0.5)
  488. c.say("Rang: "..rang) sleep(0.5)
  489. c.say("Mitglied seit: "..mitglied_seit) sleep(0.5)
  490. c.say("Zuletzt online: "..zuletzt_online) sleep(0.5)
  491. c.say("Zuletzt gevotet: "..zuletzt_gevotet)
  492. else
  493. print("Spieler nicht gefunden")
  494. c.say("Spieler nicht gefunden")
  495. end
  496. end
  497.  
  498.  
  499.  
  500. if string.sub(message,1,15) == "Tina kennst du " then
  501. torchPlayer=string.sub(message,16)
  502. torchInfo(torchPlayer)
  503. end
  504.  
  505. sleep(0.5)
  506. end
  507. end
  508. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement