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