Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cF = 0
- local cX = 60
- willDrawFPS = true
- function fpsbar()
- tpt.drawrect(4,354,200,12,255,255,255,255)
- tpt.fillrect(205,354,29,12,255,255,255,255)
- tpt.drawtext(208,357,"Reset",0,0,0,255)
- tpt.fillrect(5,355,cX,10,255,255,255,255)
- tpt.fillrect(5, 355,cFPS,10,0,155,0,155)
- tpt.drawtext(4,346,"Target FPS: " .. cX .. ", Current FPS: " .. math.floor(cFPS),255,255,255,150)
- tpt.setfpscap(cX)
- end
- function mTest()
- if tpt.mousex >= 10 and tpt.mousex <= 204 and tpt.mousey >= 355 and tpt.mousey <= 375 then
- cX = tpt.mousex - 4
- elseif tpt.mousex >= 205 and tpt.mousex <= 234 and tpt.mousey >= 354 and tpt.mousey <= 366 then
- cX = 60
- end
- end
- function currentFPS()
- f=os.clock()
- cFPS=1/(f-cF)
- cF=f
- end
- tpt.register_mouseclick(mTest)
- tpt.register_step(fpsbar)
- tpt.register_step(currentFPS)
- local running = false
- local frameCount = 0
- function drawmeter()
- tpt.fillrect(4,335,25,10,255,255,255,255)
- tpt.drawtext(6,337,"Start",0,0,0,255)
- tpt.fillrect(29,335,22,10,255,255,255,255)
- tpt.drawtext(31,337,"Stop",0,0,0,255)
- tpt.fillrect(51,335,27,10,255,255,255,255)
- tpt.drawtext(53,337,"Reset",0,0,0,255)
- tpt.drawtext(80,337,frameCount .. " frames",155,155,155,255)
- if running == true then
- frameCount = frameCount + 1
- end
- end
- function mouseTesting()
- if tpt.mousex >= 4 and tpt.mousex <= 29 and tpt.mousey >= 335 and tpt.mousey <= 345 then
- running = true
- elseif tpt.mousex >= 29 and tpt.mousex <= 51 and tpt.mousey >= 335 and tpt.mousey <= 345 then
- running = false
- elseif tpt.mousex >= 51 and tpt.mousex <= 78 and tpt.mousey >= 335 and tpt.mousey <= 345 then
- running = false
- frameCount = 0
- end
- end
- tpt.register_step(drawmeter)
- tpt.register_mouseclick(mouseTesting)
- sensorX = 200
- sensorY = 200
- sensorFileStr = tpt.input("Sensor output file","This is the file the sensor will write all of its data to.")
- if sensorFileStr == "" then
- sensorFileStr = "luasensor_Standard_Output.txt"
- end
- local sFile = io.open(sensorFileStr,"w")
- function drawSensor()
- tpt.fillrect(4,367,63,12,255,255,255,255)
- tpt.drawtext(7,370,"Take reading",0,0,0,255)
- tpt.drawpixel(sensorX,sensorY,255,0,0,275)
- tpt.drawtext(sensorX+2,sensorY,"Sensor",255,0,0,75)
- end
- function sensorMouseTest()
- if tpt.mousex >= 4 and tpt.mousex <= 67 and tpt.mousey >= 367 and tpt.mousey <= 377 and type(tpt.get_property("type",sensorX,sensorY)) == "number" and tpt.get_property("type",sensorX,sensorY) >= 1 then
- sTemp = tpt.get_property("temp",sensorX,sensorY)
- sType = tpt.get_property("type",sensorX,sensorY)
- sTime = os.date()
- sFile:write(sTime .. ": Type: " .. sType .. ", Temp: " .. sTemp .. "\n")
- end
- end
- function placeSensor(x,y)
- sFile:close()
- sensorX = x
- sensorY = y
- sensorFileStr = tpt.input("Sensor output file","This is the file the sensor will write all of its data to.")
- if sensorFileStr == "" then
- sensorFileStr = "luasensor_Standard_Output.txt"
- end
- sFile = io.open(sensorFileStr,"w")
- tpt.register_step(drawSensor)
- tpt.register_mouseclick(sensorMouseTest)
- And a basic texter:
- v.1.1 - Created!
- --To use, press T and it creates text under the cursor.
- local w = 5
- local h = 5
- pixtext = function(str, x, y, s)
- for c = 1,str.len(str) do
- cs = string.sub(str,c, c);
- if string.sub(str,c,c+1) == "\n" then
- y = y + (h + 2) * s;
- x = origX - (w + 2) * s;
- end
- if cs == "A" or cs == "a" then
- textMatrix = {{0,0,1,0,0},{0,1,0,1,0},{1,1,1,1,1},{1,0,0,0,1},{1,0,0,0,1}};
- elseif cs == "B" or cs == "b" then
- textMatrix = {{1,1,1,1,0},{1,0,0,0,1},{1,1,1,1,0},{1,0,0,0,1},{1,1,1,1,0}};
- elseif cs == "C" or cs == "c" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,1},{1,0,0,0,0},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "D" or cs == "d" then
- textMatrix = {{1,1,1,1,0},{1,0,0,0,1},{1,0,0,0,1},{1,0,0,0,1},{1,1,1,1,0}};
- elseif cs == "E" or cs == "e" then
- textMatrix = {{1,1,1,1,1},{1,0,0,0,0},{1,1,1,0,0},{1,0,0,0,0},{1,1,1,1,1}};
- elseif cs == "F" or cs == "f" then
- textMatrix = {{1,1,1,1,1},{1,0,0,0,0},{1,1,1,0,0},{1,0,0,0,0},{1,0,0,0,0}};
- elseif cs == "G" or cs == "g" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,0},{1,1,1,1,0},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "H" or cs == "h" then
- textMatrix = {{1,0,0,0,1},{1,0,0,0,1},{1,1,1,1,1},{1,0,0,0,1},{1,0,0,0,1}};
- elseif cs == "I" or cs == "i" then
- textMatrix = {{1,1,1,1,1},{0,0,1,0,0},{0,0,1,0,0},{0,0,1,0,0},{1,1,1,1,1}};
- elseif cs == "J" or cs == "j" then
- textMatrix = {{1,1,1,1,1},{0,0,1,0,0},{0,0,1,0,0},{0,0,1,0,0},{1,1,0,0,0}};
- elseif cs == "K" or cs == "k" then
- textMatrix = {{1,0,0,0,1},{1,0,0,1,0},{1,1,1,0,0},{1,0,0,1,0},{1,0,0,0,1}};
- elseif cs == "L" or cs == "l" then
- textMatrix = {{1,0,0,0,0},{1,0,0,0,0},{1,0,0,0,0},{1,0,0,0,0},{1,1,1,1,1}};
- elseif cs == "M" or cs == "m" then
- textMatrix = {{1,0,0,0,1},{1,1,0,1,1},{1,0,1,0,1},{1,0,1,0,1},{1,0,0,0,1}};
- elseif cs == "N" or cs == "n" then
- textMatrix = {{1,0,0,0,1},{1,1,0,0,1},{1,0,1,0,1},{1,0,0,1,1},{1,0,0,0,1}};
- elseif cs == "O" or cs == "o" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,1},{1,0,0,0,1},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "P" or cs == "p" then
- textMatrix = {{1,1,1,1,0},{1,0,0,0,1},{1,1,1,1,0},{1,0,0,0,0},{1,0,0,0,0}};
- elseif cs == "Q" or cs == "q" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,1},{1,0,1,0,1},{1,0,0,1,0},{0,1,1,0,1}};
- elseif cs == "R" or cs == "r" then
- textMatrix = {{1,1,1,1,0},{1,0,0,0,1},{1,1,1,1,0},{1,0,0,0,1},{1,0,0,0,1}};
- elseif cs == "S" or cs == "s" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,0},{0,1,1,1,0},{0,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "T" or cs == "t" then
- textMatrix = {{1,1,1,1,1},{0,0,1,0,0},{0,0,1,0,0},{0,0,1,0,0},{0,0,1,0,0}};
- elseif cs == "U" or cs == "u" then
- textMatrix = {{1,0,0,0,1},{1,0,0,0,1},{1,0,0,0,1},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "V" or cs == "v" then
- textMatrix = {{1,0,0,0,1},{1,0,0,0,1},{1,0,0,0,1},{0,1,0,1,0},{0,0,1,0,0}};
- elseif cs == "W" or cs == "w" then
- textMatrix = {{1,0,0,0,1},{1,0,0,0,1},{1,0,1,0,1},{1,0,1,0,1},{0,1,0,1,0}};
- elseif cs == "X" or cs == "x" then
- textMatrix = {{1,0,0,0,1},{0,1,0,1,0},{0,0,1,0,0},{0,1,0,1,0},{1,0,0,0,1}};
- elseif cs == "Y" or cs == "y" then
- textMatrix = {{1,0,0,0,1},{1,0,0,0,1},{0,1,0,1,0},{0,0,1,0,0},{0,0,1,0,0}};
- elseif cs == "Z" or cs == "z" then
- textMatrix = {{1,1,1,1,1},{0,0,0,1,0},{0,0,1,0,0},{0,1,0,0,0},{1,1,1,1,1}};
- elseif cs == "1" then
- textMatrix = {{0,0,1,0,0},{0,1,1,0,0},{1,0,1,0,0},{0,0,1,0,0},{1,1,1,1,1}};
- elseif cs == "2" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,1},{0,0,1,1,0},{0,1,0,0,0},{1,1,1,1,1}};
- elseif cs == "3" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,1},{0,0,1,1,0},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "4" then
- textMatrix = {{1,0,0,1,0},{1,0,0,1,0},{1,1,1,1,1},{0,0,0,1,0},{0,0,0,1,0}};
- elseif cs == "5" then
- textMatrix = {{1,1,1,1,1},{1,0,0,0,0},{1,1,1,1,0},{0,0,0,0,1},{1,1,1,1,0}};
- elseif cs == "6" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,0},{1,1,1,1,0},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "7" then
- textMatrix = {{1,1,1,1,1},{0,0,0,1,0},{0,0,1,0,0},{0,1,0,0,0},{1,0,0,0,0}};
- elseif cs == "8" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,1},{0,1,1,1,0},{1,0,0,0,1},{0,1,1,1,0}};
- elseif cs == "9" then
- textMatrix = {{0,1,1,1,1},{1,0,0,0,1},{0,1,1,1,1},{0,0,0,0,1},{0,0,0,0,1}};
- elseif cs == "0" then
- textMatrix = {{0,1,1,1,0},{1,0,0,1,1},{1,0,1,0,1},{1,1,0,0,1},{0,1,1,1,0}};
- elseif cs == "!" then
- textMatrix = {{0,0,1,0,0},{0,0,1,0,0},{0,0,1,0,0},{0,0,0,0,0},{0,0,1,0,0}};
- elseif cs == "@" then
- textMatrix = {{0,1,1,1,0},{1,0,1,0,1},{1,0,1,1,1},{1,0,0,0,0},{0,1,1,1,0}};
- elseif cs == "#" then
- textMatrix = {{0,1,0,1,0},{1,1,1,1,1},{0,1,0,1,0},{1,1,1,1,1},{0,1,0,1,0}};
- elseif cs == "$" then
- textMatrix = {{0,1,1,1,0},{1,0,1,0,0},{0,1,1,1,0},{0,0,1,0,1},{0,1,1,1,0}};
- elseif cs == "%" then
- textMatrix = {{1,1,0,0,1},{1,1,0,1,0},{0,0,1,0,0},{0,1,0,1,1},{1,0,0,1,1}};
- elseif cs == "^" then
- textMatrix = {{0,0,1,0,0},{0,1,0,1,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}};
- elseif cs == "&" then
- textMatrix = {{0,1,1,1,0},{1,0,0,0,0},{0,1,0,0,0},{1,0,1,0,1},{0,1,0,1,0}};
- elseif cs == "*" then
- textMatrix = {{0,0,1,0,0},{1,0,1,0,1},{0,1,1,1,0},{1,0,1,0,1},{0,0,1,0,0}};
- elseif cs == "(" then
- textMatrix = {{0,0,1,0,0},{0,1,0,0,0},{0,1,0,0,0},{0,1,0,0,0},{0,0,1,0,0}};
- elseif cs == ")" then
- textMatrix = {{0,0,1,0,0},{0,0,0,1,0},{0,0,0,1,0},{0,0,0,1,0},{0,0,1,0,0}};
- elseif cs == "," then
- textMatrix = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,1,0,0},{0,1,0,0,0}};
- elseif cs == "." then
- textMatrix = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,1,0,0}};
- elseif cs == "\n" or cs == " " then
- textMatrix = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}};
- else
- textMatrix = {{1,1,1,1,1},{1,0,0,0,1},{1,0,0,0,1},{1,0,0,0,1},{1,1,1,1,1}};
- end
- for cx = 1,5 do
- for cy = 1,5 do
- if textMatrix[cy][cx] == 1 then
- tpt.create(x + cx, y + cy, "dmnd")
- end
- end
- end
- x = x + (w + 1) * s;
- end
- end
- function texterKeyTest(a)
- if a == "t" then
- pixtext(tpt.input("Text to draw","This is the text it will draw at the cursor position"),tpt.mousex,tpt.mousey,1)
- end
- end
- tpt.register_keypress(texterKeyTest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement