SHOW:
|
|
- or go back to the newest paste.
1 | -- enchanter by MouseyPounds | |
2 | -- | |
3 | -- Simple enchanting script for an XP Turtle in FTB Mindcrack 8.1.1 | |
4 | ||
5 | local xp = peripheral.wrap("right") | |
6 | local eLevel = 30 | |
7 | local oldLevel = -1 | |
8 | local isOff = false | |
9 | ||
10 | print(string.format("Turtle %s reporting for duty!",os.getComputerLabel())) | |
11 | - | print("No signal. XP module off") |
11 | + | |
12 | while(true) do | |
13 | if (not redstone.getInput("back")) then | |
14 | if (not isOff) then | |
15 | print("No signal. XP module off.") | |
16 | - | isOff = false |
16 | + | |
17 | - | xp.setAutoCollect(true) |
17 | + | |
18 | - | local myLevel = xp.getLevels() |
18 | + | |
19 | - | if (myLevel ~= oldLevel) then |
19 | + | |
20 | - | oldLevel = myLevel |
20 | + | isOff = false |
21 | - | print(string.format("Level %d", myLevel)) |
21 | + | xp.setAutoCollect(true) |
22 | - | end |
22 | + | local myLevel = xp.getLevels() |
23 | - | if (myLevel>=eLevel) then |
23 | + | if (myLevel ~= oldLevel) then |
24 | - | print("Enchanting Time!") |
24 | + | oldLevel = myLevel |
25 | - | local books = turtle.getItemCount(16) |
25 | + | print(string.format("Level %d", myLevel)) |
26 | - | if (books<5) then |
26 | + | end |
27 | - | for i=14,1,-1 do |
27 | + | if (myLevel>=eLevel) then |
28 | - | turtle.select(i) |
28 | + | print("Enchanting Time!") |
29 | - | if turtle.compareTo(16) then |
29 | + | local books = turtle.getItemCount(16) |
30 | - | turtle.transferTo(16,64-books) |
30 | + | if (books<5) then |
31 | for i=14,1,-1 do | |
32 | - | if turtle.getItemCount(16)==64 then |
32 | + | turtle.select(i) |
33 | - | break |
33 | + | if turtle.compareTo(16) then |
34 | turtle.transferTo(16,64-books) | |
35 | end | |
36 | if turtle.getItemCount(16)==64 then | |
37 | - | if turtle.getItemCount(16)==0 then |
37 | + | break |
38 | - | print "Out of Books!" |
38 | + | end |
39 | - | return |
39 | + | end |
40 | end | |
41 | - | if turtle.getItemCount(15)>0 then |
41 | + | if turtle.getItemCount(16)==0 then |
42 | - | print "Dumping items from slot 15" |
42 | + | print "Out of Books!" |
43 | return | |
44 | end | |
45 | if turtle.getItemCount(15)>0 then | |
46 | - | turtle.select(16) |
46 | + | print "Dumping items from slot 15" |
47 | - | turtle.transferTo(15,1) |
47 | + | turtle.select(15) |
48 | - | turtle.select(15) |
48 | + | turtle.dropUp() |
49 | - | xp.enchant(eLevel) |
49 | + | |
50 | - | turtle.dropUp() |
50 | + | turtle.select(16) |
51 | - | end |
51 | + | turtle.transferTo(15,1) |
52 | - | end |
52 | + | |
53 | xp.enchant(eLevel) | |
54 | - | end |
54 | + | |
55 | end -- of if (myLevel>=eLevel) | |
56 | end -- of else check on redstone | |
57 | sleep(1) | |
58 | end -- of while (true) |