Posted 22 September 2013 - 08:51 PM
So I've been off the forums for quite a while, but during that time I got better at Lua programming.
So the API has two functions.
Function 1: Get the mouse click coordinates.
Function 2: Test whether you click a certain place on the screen.
Sample code of function 1
and
Sample code of function 2
To get the API do:
Please respond with any bugs issues or suggestion.
So the API has two functions.
Function 1: Get the mouse click coordinates.
Function 2: Test whether you click a certain place on the screen.
Sample code of function 1
Spoiler
function test()
os.unloadAPI("clickAPI")
os.loadAPI("clickAPI")
term.clear()
term.setCursorPos(1,1)
print("Click Test 1")
print(" ")
print("Click Test 2")
local x, y = clickAPI.click()
if tonumber(x) > 0 and tonumber(x) < 13 then
if tonumber(y) == 1 then
print("You clicked 'Click Test 1'.")
sleep(1.5)
tst()
elseif tonumber(y) == 3 then
print("You clicked 'Click Test 2'.")
sleep(1.5)
tst()
else
print(x.." "..y)
end
else
print(x.." "..y)
sleep(1.5)
test()
end
end
test()
and
Sample code of function 2
Spoiler
os.unloadAPI("clickAPI")
os.loadAPI("clickAPI")
function test2()
term.clear()
term.setCursorPos(1,1)
print("Click Me")
if clickAPI.click(1,1,8,1) then
print("You clicked it.")
sleep(1.5)
test2()
end
end
test2()
To get the API do:
pastebin get uiS71Xrd clickAPI
or view the code here http://pastebin.com/uiS71Xrd.Please respond with any bugs issues or suggestion.