View difference between Paste ID: buLFspL3 and YWNLRSpK
SHOW: | | - or go back to the newest paste.
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")
143+
144
		if modem[i].isWireless then
145
			rednetSide = modemSide[i]
146
			rednet.open(rednetSide)
147
		end
148
	end
149
end
150
wrapper()
151
152
--   1=normal
153
-- -40=angry
154
-- -81=Sad
155
function loadFace()
156
	for i = 1, #mon do
157
		if mon[i].getSize() == 61 then
158
			m = mon[i]
159
			shell.run("monitor " .. monSide[i] .. " face " .. emotion .. " " .. monSide[i])
160
		end
161
	end
162
end
163
164
function loadSkin(arg)
165
	if mon ~= nil then
166
		if arg ~= nil then
167-
		if #mon > 0 then
167+
			if tonumber(arg) == nil then
168-
			if arg ~= nil then
168+
				monSideCurrent = arg
169-
				if tonumber(arg) == nil then
169+
170-
					monSideCurrent = arg
170+
				monSideCurrent = monSide[arg]
171
			end
172-
					monSideCurrent = monSide[arg]
172+
			monCurrent = peripheral.wrap(monSideCurrent)
173
			if monSideCurrent ~= nil then
174-
				monCurrent = peripheral.wrap(monSideCurrent)
174+
				monCurrent.setTextScale(1)
175-
				if monSideCurrent ~= nil then
175+
				if monCurrent.getSize() == 7 then
176
					monCurrent.setTextScale(0.5)
177-
					if monCurrent.getSize() == 7 then
177+
178-
						monCurrent.setTextScale(0.5)
178+
				if monCurrent.getSize() == 18 then
179
					monCurrent.setTextScale(1)
180-
					if monCurrent.getSize() == 18 then
180+
181-
						monCurrent.setTextScale(1)
181+
				if monCurrent.getSize() == 29 then
182
					monCurrent.setTextScale(2)
183-
					if monCurrent.getSize() == 29 then
183+
184-
						monCurrent.setTextScale(2)
184+
				if monCurrent.getSize() == 39 then
185
					monCurrent.setTextScale(3)
186-
					if monCurrent.getSize() == 39 then
186+
187-
						monCurrent.setTextScale(3)
187+
				shell.run("monitor " .. monSideCurrent .. " loadImage skin")
188
			end
189-
					shell.run("monitor " .. monSideCurrent .. " loadImage skin")
189+
190
		loadFace()
191
	end
192
end
193
194
function loadInfo(arg)
195
	if tonumber(arg) == nil then
196
		monSideCurrent = arg
197
	else
198
		monSideCurrent = monSide[arg]
199
	end
200
	monCurrent = peripheral.wrap(monSideCurrent)
201
	if monSideCurrent ~= nil then
202
		monCurrent.setTextScale(1)
203
		monXScale, monYScale = monCurrent.getSize()
204
		if monXScale == 7 then
205
			monCurrent.setTextScale(0.5)
206
		end
207
		if monXScale == 18 then
208
			monCurrent.setTextScale(1)
209
		end
210
		if monXScale == 29 then
211
			monCurrent.setTextScale(2)
212
		end
213
		if monXScale == 39 then
214
			monCurrent.setTextScale(3)
215
		end
216
		monXScale, monYScale = monCurrent.getSize()
217
		monCurrent.setCursorPos((monXScale - #textutils.formatTime(os.time())) / 2, monYScale / 2)
218
		monCurrent.write(textutils.formatTime(os.time()))
219
	end
220
end
221
222
loadSkin(math.random(1, #monSide))
223
224
function say(message)
225-
if #monSide>0 then
225+
226-
	loadSkin(math.random(1, #monSide))
226+
227
		c.say(myName .. ": " .. message)
228
		sleep(0.5)
229
	end
230
	if tb ~= nil then
231
		glassesChat(message)
232
		if os.version() == "CraftOS 1.7" then
233
			tb.sync()
234
		end
235
	end
236
	if sp ~= nil then
237
		sp.speak(message)
238
	end
239
end
240
241
function eval(command)
242
	fp = fs.open("eval", "w")
243
	fp.write(command)
244-
	if mani~=nil then
244+
245-
		if mani.hasModule("plethora:chat") then
245+
246-
			mani.say(message)
246+
247
end
248
249
function glassesChat(message)
250
	if message then
251
		if #chatLog >= 11 then
252
			for i = 1, #chatLog do
253
				chatLog[i] = chatLog[i + 1]
254
			end
255
		end
256
		chatLog[#chatLog + 1] = myName .. " : " .. message
257
	else
258
		if event == "chat" then
259
			if #chatLog >= 11 then
260
				for i = 1, #chatLog do
261
					chatLog[i] = chatLog[i + 1]
262
				end
263
			end
264
			chatLog[#chatLog + 1] = arg1 .. " : " .. arg2
265
		end
266
267
		if event == "chat_death" then
268
			if #chatLog >= 11 then
269
				for i = 1, #chatLog do
270
					chatLog[i] = chatLog[i + 1]
271
				end
272
			end
273
			chatLog[#chatLog + 1] = arg1 .. " starb"
274
		end
275
276
		if event == "chat_command" then
277
			if #chatLog >= 11 then
278
				for i = 1, #chatLog do
279
					chatLog[i] = chatLog[i + 1]
280
				end
281
			end
282
			chatLog[#chatLog + 1] = arg2 .. " : " .. arg1
283
		end
284
285
		if event == "glasses_chat_command" then
286
			if #chatLog >= 11 then
287
				for i = 1, #chatLog do
288
					chatLog[i] = chatLog[i + 1]
289
				end
290
			end
291
			chatLog[#chatLog + 1] = arg2 .. " : " .. arg4
292
		end
293
	end
294
	tb.clear()
295
	for i = 1, #chatLog do
296
		tb.addBox(1, 1, 400, 100, 0x000000, 0.1)
297
		tb.addText(1, i * 8, chatLog[i], 0xffffff)
298
	end
299
	if os.version() == "CraftOS 1.7" then
300
		tb.sync()
301
	end
302
end
303
304
function search(args1, args2, args3)
305
	function stringReplace(source, delString, repString)
306
		if string.find(source, delString) then
307
			local stringPos = {string.find(source, delString)}
308
			source = string.sub(source, 1, stringPos[1] - 1) .. repString .. string.sub(source, stringPos[2] + 1)
309
		end
310
		return (source)
311
	end
312
313
	function stringReplaceAll(source, delString, repString)
314
		while string.find(source, delString) do
315
			local stringPos = {string.find(source, delString)}
316
			source = string.sub(source, 1, stringPos[1] - 1) .. repString .. string.sub(source, stringPos[2] + 1)
317
		end
318
		return (source)
319
	end
320
321
	function stringDel(source, delString)
322
		local stringPos = {string.find(source, delString)}
323
		source = string.sub(source, 1, stringPos[1] - 1) .. string.sub(source, stringPos[2] + 1)
324
		return (source)
325
	end
326
327
	function stringDelAll(source, delString)
328
		while string.find(source, delString) do
329
			source = stringDel(source, delString)
330
		end
331
		return source
332
	end
333
334
	results = {}
335
	url = http.get("http://www.bing.com/search?q=" .. stringReplaceAll(args1, " ", "+"))
336
	html = url.readAll()
337
338
	i = 255
339
	while i >= 0 do
340
		html = stringDelAll(html, "&#" .. tostring(i) .. ";")
341
		i = i - 1
342
	end
343
344
	html = stringDelAll(html, "<strong>")
345
	html = stringDelAll(html, "</strong>")
346
	html = stringDelAll(html, "&quot")
347
	html = stringDelAll(html, ";")
348
	html = stringDelAll(html, ":")
349
350
	i = 1
351
	while string.find(html, "<p>") do
352
		local stringPos1 = {string.find(html, "<p>")}
353
		local stringPos2 = {string.find(html, "</p>")}
354
		results[i] = string.sub(html, stringPos1[2] + 1, stringPos2[1] - 1)
355
		html = stringDel(html, "<p>")
356
		html = stringDel(html, "</p>")
357
		i = i + 1
358
	end
359
	amount = 4
360
	if args2 then
361
		amount = tonumber(args2)
362
	end
363
	num = nil
364
	if tonumber(args3) == nil then
365
		for i = 1, amount do
366
			if results[i] ~= nil then
367
				if tb ~= nil then
368
					glassesChat("Result:" .. i .. string.sub(results[i], 1, 200))
369
					if os.version() == "CraftOS 1.7" then
370
						tb.sync()
371
					end
372
					if c ~= nil then
373
						c.say("Result:" .. i .. string.sub(results[i], 1, 200))
374
						sleep(0.5)
375
					end
376
				end
377
			--say("Result:"..i..string.sub(results[i],1,200))
378
			end
379
		end
380
	else
381
		num = tonumber(args3)
382
		print(results[num])
383
	end
384
end
385
386
function addButton(id, data, func)
387
	button = {}
388
	button.data = data
389
	button.func = func
390
	buttons[id] = button
391
end
392
393
function giveItemFromMe(fingerprint, amount)
394
	fi=fingerprint
395
	eval("me.exportItem(fi,'up',"..amount..")")
396
end
397
398
function loadConfig()
399
    if fs.exists("config")==false then
400
        fp=fs.open("config","w")
401
        fp.writeLine("importDirection='north'")
402
        fp.writeLine("exportDirection='south'")
403
        fp.writeLine("windowSizeX=950")
404
        fp.writeLine("windowSizeY=400")
405
        fp.close()
406
    end
407
    shell.run("config")
408
end
409
loadConfig()
410
411
function showItemSelection(items)
412
	buttons = {}
413
	t.clear()
414
	y = 1
415
	x = 1
416
	local xMax = windowSizeX
417
	local yMax = windowSizeY
418
	i1 = 1
419
	t.addBox(1, 1, xMax, math.ceil(#items / (xMax / 20)) * 20, 0x000000, 0.5)
420
	while i1 <= yMax do
421-
pageOffset=0
421+
422
			if items[i1] ~= nil then
423-
function nextPage()
423+
424-
    pageOffset=pageOffset+xMax/20*yMax/20
424+
				data.component = t.addIcon(x, y, items[i1].fingerprint.id, items[i1].fingerprint.dmg)
425-
    showItemSelection(items)
425+
				if items[i1].size > 1 then
426
					data.text = t.addText(x, y + 10, tostring(items[i1].size), 0)
427
				end
428-
function prevPage()
428+
429-
    if pageOffset-xMax/20*yMax/20>=0 then
429+
				data.item = items[i1]
430-
        pageOffset=pageOffset-xMax/20*yMax/20
430+
431-
        showItemSelection(items)
431+
432
					--print(data.item.name)
433
					if data.text ~= nil then
434
						eval(data.text.setText(data.text.getText() - 1))
435
					else
436
						data.component.delete()
437
					end
438
					t.sync()
439
				end
440-
	xMax = windowSizeX
440+
441-
	yMax = windowSizeY
441+
442
			i1 = i1 + 1
443
			x = x + 20
444-
	while y <= yMax do
444+
445
		x = 1
446-
			if items[i1+pageOffset] ~= nil then
446+
447
	end
448-
				data.component = t.addIcon(x, y, items[i1+pageOffset].fingerprint.id, items[i1+pageOffset].fingerprint.dmg)
448+
449-
				if items[i1+pageOffset].size > 1 then
449+
450-
					data.text = t.addText(x, y + 10, tostring(items[i1+pageOffset].size), 0)
450+
451
function scanItems()
452
	if me ~= nil then
453-
				data.item = items[i1+pageOffset]
453+
454
		itemById = {}
455
		for i = 1, #items do
456
			itemById[items[i].fingerprint.id .. "/" .. items[i].fingerprint.dmg] = items[i]
457
		end
458
	end
459
end
460
461
--main
462
while true do
463
	event, arg1, arg2, arg3, arg4 = os.pullEvent()
464
465
	--Events
466
	--say(event)
467
	if event == "peripheral" then
468
		pType = arg1
469
		wrapper()
470
		say("neue Peripheral " .. peripheral.getType(pType) .. " gefunden.")
471
472
		if peripheral.getType(pType) == "monitor" then
473
			loadSkin(arg1)
474
		end
475
	end
476
477
	if event == "monitor_resize" then
478
		loadSkin(arg1)
479
		sleep(1)
480
	end
481
482
	if event == "glasses_capture" then
483
		scanItems()
484
		showItemSelection(items)
485
	end
486
487
	if event == "glasses_component_mouse_down" then
488
		componentId = arg4
489
		--say(arg4)
490
		if buttons[componentId] ~= nil then
491
			if buttons[componentId].func ~= nil then
492
				buttons[componentId].func(buttons[componentId].data)
493
			end
494
		end
495
		
496
	end
497
498
	if event == "glasses_release" then
499
		t.clear()
500
		t.sync()
501
	end
502
503
	if os.version() == "CraftOS 1.7" then
504
		if event == "glasses_key_down" then
505
			if arg4 == 200 then
506
				rednet.broadcast("turtle do turtle.forward()")
507-
		for ig=1,#t.getUsers() do
507+
508-
			t.getCaptureControl(t.getUsers()[ig].uuid).setBackground(0xffffff,0)
508+
509
				rednet.broadcast("turtle do turtle.back()")
510
			end
511
			if arg4 == 203 then
512
				rednet.broadcast("turtle do turtle.turnLeft()")
513
			end
514
			if arg4 == 205 then
515
				rednet.broadcast("turtle do turtle.turnRight()")
516
			end
517
			if arg4 == 57 or arg4 == 78 then
518
				rednet.broadcast("turtle do turtle.up()")
519
			end
520
			if arg4 == 54 or arg4 == 74 then
521
				rednet.broadcast("turtle do turtle.down()")
522
			end
523
			if arg4 == 211 then
524
				rednet.broadcast("turtle do turtle.dig()")
525
			end
526
			if arg4 == 29 or arg4 == 157 then
527
				rednet.broadcast("turtle do turtle.place()")
528
			end
529
			if arg4 == 19 then
530
				rednet.broadcast("turtle do shell.run('refuel all()') turtle.select(1) ")
531
			end
532
			if arg4 == 42 then
533
				rednet.broadcast("turtle do p.toggle()")
534
			end
535
536
			if dr ~= nil then
537
				drPos = {dr.getDronePosition()}
538
				dr.clearArea()
539
				if arg4 == 200 then
540
					dr.addArea(drPos[1] + 1, drPos[2], drPos[3])
541
				end
542
				if arg4 == 208 then
543
					dr.addArea(drPos[1] - 1, drPos[2], drPos[3])
544
				end
545
				if arg4 == 203 then
546
					dr.addArea(drPos[1], drPos[2], drPos[3] + 1)
547
				end
548
				if arg4 == 205 then
549
					dr.addArea(drPos[1], drPos[2], drPos[3] - 1)
550
				end
551
				if arg4 == 57 then
552
					dr.addArea(drPos[1], drPos[2] + 1, drPos[3])
553
				end
554
				if arg4 == 42 or arg4 == 54 then
555
					dr.addArea(drPos[1], drPos[2] - 1, drPos[3])
556
				end
557
				dr.setAction("goTo")
558
				sleep(0.5)
559
			end
560
		end
561-
            end
561+
562-
            if arg4 == 205 then
562+
563-
				nextPage()
563+
564-
            end
564+
565-
            if arg4 == 203 then
565+
566-
                prevPage()
566+
567-
            end
567+
568
			loadSkin(arg1)
569
		end
570
		if selectMode == "info" then
571
			mInfo = arg1
572
			loadInfo(mInfo)
573
			infoTimer = os.startTimer(1)
574
		end
575
	end
576
577
	if event == "timer" then
578
		if arg1 == jumpTimer then
579
			monCurrent.clear()
580
			loadSkin(math.random(1, #monSide))
581
			if message ~= myName .. " stop" then
582
				jumpTimer = os.startTimer(2)
583
			else
584
				say("ok")
585
			end
586
		end
587
588
		if arg1 == infoTimer then
589
			if selectMode == "info" then
590
				loadInfo(mInfo)
591
				infoTimer = os.startTimer(1)
592
			end
593
		end
594
	end
595
596
	if event == "chat" or event == "chat_command" or event == "glasses_chat_command" or event == "chat_message" then
597
		if tb ~= nil then
598
			glassesChat()
599
		end
600
		if event == "chat" then
601
			player = arg1
602
			message = arg2
603
		end
604
		if event == "chat_message" then
605
			player = arg2
606
			message = arg3
607
		end
608
		if event == "glasses_chat_command" then
609
			player = arg2
610
			message = arg4
611
		end
612
		if event == "chat_command" then
613
			player = arg2
614
			message = arg1
615
		end
616
617
		if rednetSide ~= nil then
618
			rednet.broadcast("turtle do " .. message)
619
		end
620
621
		if string.sub(message, 1, #tostring(myName .. " berechne ")) == myName .. " berechne " then
622
			fp = fs.open("rechner", "w")
623
			fp.writeLine("say(tostring(" .. string.sub(message, #tostring(myName .. " berechne ")) .. "))")
624
			fp.close()
625
			shell.run("rechner")
626
		end
627
628
		if string.sub(message, 1, #tostring(myName .. " bing ")) == myName .. " bing " then
629
			fp = fs.open("rechner", "w")
630
			say(string.sub(message, #tostring(myName .. " bing ")))
631
			search(string.sub(message, #tostring(myName .. " bing ")), 10)
632
			fp.close()
633
			shell.run("rechner")
634
		end
635
636
		if string.sub(message, 1, #tostring(myName .. " list ")) == myName .. " list " then
637
			if me ~= nil and tb ~= nil then
638
				searchId = string.sub(message, #(myName .. " list ") + 1)
639
				scanItems()
640
				i2 = 1
641
				itemsAlike = {}
642
				for i = 1, #items do
643
					if string.find(string.lower(items[i].fingerprint.id .. "/" .. items[i].fingerprint.dmg), string.lower(searchId)) then
644
						itemsAlike[i2] = items[i].fingerprint.id .. "/" .. items[i].fingerprint.dmg, searchId
645
						i2 = i2 + 1
646
					end
647
				end
648
649
				for i = 1, 10 do
650
					if itemsAlike[i] ~= nil then
651
						say(itemsAlike[i] .. " Amount:" .. itemById[itemsAlike[i]].size)
652
					end
653
				end
654
			end
655
		end
656
657
		if string.sub(message, 1, #tostring(myName .. " gib mir ")) == myName .. " gib mir " then
658
			if me ~= nil and tb ~= nil then
659
				fingerprint = {}
660
				scanItems()
661
				fp = fs.open("give", "w")
662
				fp.writeLine(
663
					"fingerprint=itemById[string.sub(message,#(myName..' gib mir ')+1),string.find(message,",
664
					")-1].fingerprint me.exportItem(fingerprint,'up',tonumber(string.sub(message,string.find(message,",
665
					")+1)))"
666
				)
667
				fp.close()
668
				shell.run("give")
669
			end
670
		end
671
672
		if message == myName .. " update" then
673
			say("Ok bis gleich")
674
			shell.run("update")
675
			shell.run("reboot")
676
		end
677
678
		if message == myName .. " jump" then
679
			say("such mich :)")
680
			jumpTimer = os.startTimer(2)
681
		end
682
683
		if string.find(message, myName .. " notiere") ~= nil then
684
			say("Ich hoere")
685
			pr.newPage()
686
			pr.setPageTitle(string.sub(message, #(myName .. " notiere") + 2))
687
			y = 1
688
			while message ~= "schluss" do
689
				event, dump, player, dump, message = os.pullEvent("glasses_chat_command")
690
				if message ~= "schluss" then
691
					x = 1
692
					for i = 1, math.floor(#message / 26) + 1 do
693
						pr.setCursorPos(1, y)
694
						pr.write(string.sub(message, x, x + 26))
695
						say(string.sub(message, x, x + 26))
696
						y = y + 1
697
						x = x + 26
698
					end
699
				end
700
			end
701
			pr.endPage()
702
		end
703
704
		if string.find(message, myName .. " lua") ~= nil then
705
			eval(string.sub(message, #(myName .. " lua") + 2))
706
		end
707
708
		if string.find(message, myName .. " shoot") ~= nil and string.find(message, myName .. " shoot at") == nil then
709
			target = string.sub(message, #(myName .. " shoot") + 2)
710
			shootAt(target, 5)
711
		end
712
713
		if string.find(message, myName .. " shoot at") ~= nil then
714
			target = textutils.unserialize("{" .. string.sub(message, #(myName .. " shoot at") + 2) .. "}")
715
			shootAtPos(target, 5)
716
		end
717
718
		if string.find(message, myName .. " zeig inv") ~= nil and string.find(message, myName .. " shoot at") == nil then
719
			showInventory(string.sub(message, #(myName .. " zeig inv") + 2))
720
		end
721
722
		if string.find(message, myName .. " scan mobs") ~= nil then
723
			say("Mobs werden gescannt")
724
			scanAll("mob")
725
			for i = 1, #entity.mob do
726
				say(entity.mob[i].name)
727
			end
728
		end
729
730
		if string.find(message, myName .. " scan spieler") ~= nil or string.find(message, myName .. " scan player") ~= nil then
731
			say("Spieler werden gescannt")
732
			scanAll("player")
733
			for i = 1, #entity.player do
734
				say(entity.player[i].name)
735
			end
736
		end
737
738
		if string.find(message, myName .. " suche mobs") ~= nil then
739
			say(" Mobs werden gesucht")
740
			scanPos("mob")
741
			for i = 1, #eName do
742
				say(eName[i] .. "  (" .. ePos[eName[i]].x .. "/" .. ePos[eName[i]].y .. "/" .. ePos[eName[i]].z .. ")")
743
			end
744
		end
745
746
		if string.find(message, myName .. " suche spieler") ~= nil then
747
			say(" Spieler werden gesucht")
748
			scanPos("player")
749
			for i = 1, #eName do
750
				say(eName[i] .. "  (" .. ePos[eName[i]].x .. "/" .. ePos[eName[i]].y .. "/" .. ePos[eName[i]].z .. ")")
751
			end
752
		end
753
754
		if string.find(message, myName .. " suche alles") ~= nil then
755
			say(" Entitys werden gesucht")
756
			scanPos("all")
757
			for i = 1, #eName do
758
				say(eName[i] .. "  (" .. ePos[eName[i]].x .. "/" .. ePos[eName[i]].y .. "/" .. ePos[eName[i]].z .. ")")
759
			end
760
		end
761
762
		if message == myName .. " sag hallo" then
763
			say("Hallo :D")
764
		end
765
766
		if message == myName .. " du bist fett" then
767
			say("Ich bin nur stabil gebaut")
768
			emotion = -40
769
			loadFace()
770
		end
771
772
		if message == myName .. " du bist toll" then
773
			say("Ich weiss")
774
			emotion = 1
775
			loadFace()
776
		end
777
778
		if message == myName .. " sei traurig" then
779
			say("Ok")
780
			emotion = -81
781
			loadFace()
782
		end
783
784
		if message == myName .. " play music" then
785
			if drSide ~= nil then
786
				if disk.hasAudio(drSide) ~= nil then
787
					disk.playAudio(drSide)
788
					say("playing: " .. disk.getAudioTitle(drSide))
789
				end
790
			end
791
		end
792
793
		if message == myName .. " stop music" then
794
			if drSide ~= nil then
795
				disk.stopAudio(drSide)
796
			end
797
		end
798
799
		if message == myName .. " bau eine armee" then
800
			if rednetSide ~= nil then
801
				if dr ~= nil then
802
					if disk.isPresent(drSide) then
803
						shell.run("cp turtlearmee disk/startup")
804
						say(
805
							myName ..
806
								" 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"
807
						)
808
					else
809
						say(myName .. " leg bitte eine Floppydisk in den Diskdrive")
810
					end
811
				else
812
					say(myName .. ": Stell bitte einen Diskdrive mit einer Floppydisk an mich dran :)")
813
				end
814
			else
815
				say(myName .. ": Stell bitte ein Wireless Modem an den Computer")
816
			end
817
		end
818
	end
819
end