Advertisement
electronic_steve

#tptscipts ESTools !

Dec 2nd, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.30 KB | None | 0 0
  1. --EST
  2.  local table={}
  3.  table[1]={name="nnnooo",drawfunc=function(x,y) end,func=function(n1,n2,n3,n4,n5) print(n1) end}
  4.  tableselect=1
  5.  menurender=0
  6.  EST3recte=false
  7.  ESTdublepressfix=false
  8.  
  9. local function keyTester(key_char)
  10. if key_char=="." then ESTdublepressfix=not ESTdublepressfix if ESTdublepressfix then tableselect=miax(1,tableselect+1,#table)   menurender=255  end end
  11. if key_char=="," then ESTdublepressfix=not ESTdublepressfix if ESTdublepressfix then tableselect=miax(1,tableselect-1,#table) menurender=255 end end
  12. if key_char=="/" then ESTdublepressfix=not ESTdublepressfix if ESTdublepressfix then  table[tableselect].func(true) end end
  13. end
  14. function ESTDraw()
  15. table[tableselect].drawfunc()
  16.  
  17. end
  18. tpt.register_step(ESTDraw)
  19. local function ESwindowUpdate()
  20. menurender=menurender-1
  21. tpt.drawrect(606-tpt.textwidth(tableselect.."|"..table[tableselect].name),372,tpt.textwidth(tableselect.."|"..table[tableselect].name)+5,12,menurender,menurender,menurender,menurender)
  22. tpt.drawtext(609-tpt.textwidth(tableselect.."|"..table[tableselect].name),374,tableselect.."|"..table[tableselect].name,menurender,menurender,menurender,menurender)
  23. x,y=realcord(tpt.mousex,tpt.mousey)
  24. -- wifi channel number render
  25.     if tpt.get_property("type", x,y)>0 then
  26.     local etype=tpt.element(tpt.get_property("type", x,y))
  27.         if etype=="WIFI" or etype=="PRTO" or etype=="PRTI" then
  28.         graphics.fillRect(tpt.mousex-tpt.textwidth(tpt.get_property("tmp", x,y))/2-3,tpt.mousey-13,tpt.textwidth(tpt.get_property("tmp", x,y))+6,11,0,0,0,100)
  29.         graphics.drawText(tpt.mousex-tpt.textwidth(tpt.get_property("tmp", x,y))/2,tpt.mousey-10,tpt.get_property("tmp", x,y))
  30.         end
  31.     end
  32. end
  33.  
  34.  
  35.  
  36. tpt.register_step(ESwindowUpdate)
  37. tpt.register_keypress(keyTester)
  38. --tools!
  39. table[2]={
  40.  
  41. name="wifi search",
  42. drawfunc=function(x,y) end,
  43. func=function(n1,n2,n3,n4,n5)
  44. local ESS={}
  45.     for i=1,101 do
  46.     ESS[i]=false
  47.     end
  48.  
  49.     for x=0,611 do
  50.         for y=0,383 do
  51.             if tpt.get_property("type",x,y)==124  then
  52.             ESS[tpt.get_property("tmp",x,y)]=true
  53.  
  54.                 for x=1,101 do
  55.                     if ESS[x] then
  56.                     tpt.delete(505+x,5)
  57.                     tpt.create(505+x,5,124)
  58.                     tpt.set_property("temp", x*100 + 23.15,505+x,5)
  59.                     end
  60.                 end
  61.             end
  62.         end
  63.     end
  64.  
  65. end
  66. }
  67. table[3]={
  68.  
  69.  
  70. name="rotate by 90 degrees",
  71. drawfunc=function()
  72. local x,y=realcord(tpt.mousex,tpt.mousey)
  73.     if x>0 and x<511 and
  74.     y>0 and y<283 then
  75.    
  76.  
  77.     tpt.drawrect(x,y,100,100,255,0,0,100)
  78.     end
  79.  end,
  80. func=function(n1,n2,n3,n4,n5)
  81. local x,y=realcord(tpt.mousex,tpt.mousey)
  82.     if x>0 and x<511 and
  83.     y>0 and y<283 then
  84.    
  85.    
  86.  
  87.         for nx=0,100 do
  88.             for ny=0,100 do
  89.                 for i=1,5 do
  90.                 tpt.set_property("x",x-ny+100,x+nx,y+ny)
  91.                 tpt.set_property("y",y+nx,x+nx,y+ny)
  92.                 end
  93.             end
  94.         end
  95.     end
  96. end
  97. }
  98. table[4]={
  99. name="wifi set",
  100. drawfunc=function () end,
  101. func=function()
  102.  
  103.  
  104.  
  105.  local x,y=realcord(tpt.mousex,tpt.mousey)
  106.  local channel = tpt.input("Enter a Channel Number.", "Must Be Between 0 and 100")
  107.        tpt.set_property("temp", channel*100 + 23.15, x,y)
  108.  
  109.  
  110. end
  111. }
  112.  
  113. --API
  114. function realcord(x,y)
  115. if x >= 611 then x2 = 611 else x2 = x end
  116. if y >= 383 then y2 = 383 else y2 = y end
  117.     return  sim.adjustCoords(x2,y2)
  118. end
  119.  
  120. function miax(i,m,a)
  121. if   i>=m          then return i
  122. elseif i<m  and m<a then return m
  123. elseif m>=a          then return a end
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement