View difference between Paste ID: BFP5s115 and MEqcZvJ3
SHOW: | | - or go back to the newest paste.
1-
os.loadAPI("ender")
1+
--Version 0.0.2
2-
os.loadAPI("touchpoint")
2+
--------LISCENCE--------
3
--This code is owned by kd8lvt, and all APIs are owned by their respective creators, listed next to their 'os.loadAPI'-s
4
--This code is liscensed under a custom liscence that is as follows:
5
--You may:
6
--  1.Look at and use portions of the code, with credit.
7
--  2.Learn from this code
8
--  3.Include this code in your "Computecraft OS", with credit, and without modification.
9
--You may NOT:
10
--  1.Claim this code as your own
11
--  2.Re-host this code (use the original pastebin!)
12
--  3.Put this code behind a adwall/paywall (ad.fly etc)
13
--------HOW TO INSTALL--------
14
--1. Install the APIs (they are on the ComputerCraft forums in the APIs section as CCEnder and Touchpoint)
15-
  ender.send("kd8lvtTurtle",command)
15+
--2. Install this program
16
--3. Install CCEnder and the turtle program on your turtle that has a pickaxe and a sword.
17
--4. Configure both devices to the same "channel" in the below "CONFIGURATION" section
18
--------CONFIGURATION--------
19
channel = "put your uuid here"
20
--------ACTUAL CODE--------
21
os.loadAPI("ender") --Created by Sxw on the Computercraft Forums
22
os.loadAPI("touchpoint") --Created by Lyqyd on the Computercraft Forums
23
main = touchpoint.new()
24
inv = touchpoint.new()
25
local t
26
function mainMenu()
27
  t = main
28
end
29-
  inv:add("1",function() tellTurtle("select1") end,2,2,4,5,colors.green,colors.lime)
29+
30
function invMenu()
31
  t = inv
32
end
33-
  inv:add("5",function() tellTurtle("select5") end,2,6,4,8,colors.green,colors.lime)
33+
34
function tellTurtle(command)
35
  ender.send(channel,command)
36
end
37-
  inv:add("9",function() tellTurtle("select9") end,2,9,5,11,colors.green,colors.lime)
37+
38
  main:add("^",function() tellTurtle("forward") end,10,2,12,3,colors.green,colors.lime)
39
  main:add("<",function() tellTurtle("left") end,8,5,10,6,colors.green,colors.lime)
40
  main:add(">",function() tellTurtle("right") end,12,5,14,6,colors.green,colors.lime)
41-
  inv:add("13",function() tellTurtle("select13") end,2,12,5,12,colors.green,colors.lime)
41+
42-
  inv:add("14",function() tellTurtle("select14") end,6,12,9,12,colors.green,colors.lime)
42+
43-
  inv:add("15",function() tellTurtle("select15") end,10,12,13,12,colors.green,colors.lime)
43+
44-
  inv:add("16",function() tellTurtle("select16") end,14,12,17,12,colors.green,colors.lime)
44+
45-
  inv:add("Place",function() tellTurtle("place") end,2,14,25,15,colors.green,colors.lime)
45+
46-
  inv:add("Place Up",function() tellTurtle("place up") end,2,17,13,19,colors.green,colors.lime)
46+
47-
  inv:add("Place Down",function() tellTurtle("place down") end,15,17,25,19,colors.green,colors.lime)  
47+
48
--Inventory--
49
  inv:add("1",function() tellTurtle("select1") end,1,2,4,5,colors.green,colors.lime)
50
  inv:add("2",function() tellTurtle("select2") end,5,2,8,5,colors.green,colors.lime)
51
  inv:add("3",function() tellTurtle("select3") end,9,2,12,5,colors.green,colors.lime)
52-
  -- local event, p1, p2, p3 = os.pullEvent() ---monitor_touch, side, xpos, ypos
52+
53-
  local event, p1 = t:handleEvents(os.pullEvent()) --button_click, name
53+
  inv:add("5",function() tellTurtle("select5") end,1,6,4,8,colors.green,colors.lime)
54
  inv:add("6",function() tellTurtle("select6") end,5,6,8,8,colors.green,colors.lime)
55-
    --Remove toggling and simplify button running
55+
56
  inv:add("8",function() tellTurtle("select8") end,13,6,16,8,colors.green,colors.lime)
57
  inv:add("9",function() tellTurtle("select9") end,1,9,5,11,colors.green,colors.lime)
58
  inv:add("10",function() tellTurtle("select10") end,6,9,9,11,colors.green,colors.lime)
59
  inv:add("11",function() tellTurtle("select11") end,10,9,13,11,colors.green,colors.lime)
60
  inv:add("12",function() tellTurtle("select12") end,14,9,17,11,colors.green,colors.lime)
61
  inv:add("13",function() tellTurtle("select13") end,1,12,4,12,colors.green,colors.lime)
62
  inv:add("14",function() tellTurtle("select14") end,5,12,8,12,colors.green,colors.lime)
63
  inv:add("15",function() tellTurtle("select15") end,9,12,12,12,colors.green,colors.lime)
64
  inv:add("16",function() tellTurtle("select16") end,13,12,16,12,colors.green,colors.lime)
65
  inv:add("Place",function() tellTurtle("place") end,1,14,25,15,colors.green,colors.lime)
66
  inv:add("Place Up",function() tellTurtle("place up") end,1,17,12,19,colors.green,colors.lime)
67
  inv:add("Place Down",function() tellTurtle("place down") end,14,17,25,19,colors.green,colors.lime)  
68
  inv:add("Main",function() mainMenu() end,18,2,23,4,colors.green,colors.lime)
69
mainMenu()
70
while true do
71
  t:draw()
72
  local event, p1 = t:handleEvents(os.pullEvent())
73
  if event == "button_click" then
74
    t.buttonList[p1].func()
75
  end
76
end