jacob614

set wifi v2

Nov 17th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. channel = -1 lastindex = 0
  2. function setwifi(i,x,y,surround_space,nt)
  3.    if i < lastindex then -- if tpt has looped through every index, this
  4.       channel = -1       -- must be a new frame, so reset entered channel
  5.    end
  6.    temp = math.floor(tpt.get_property("temp",i)-273.1)
  7.    if temp == 22 and channel == -1 then
  8.       channel = tpt.input("Enter a Channel Number", "Must Be Between 0 and 100")
  9.    end
  10.    if temp == 22 then
  11.       tpt.set_property("temp", channel*100 + 23.15, i)
  12.    end
  13.    lastindex = i
  14. end
  15.  
  16. tpt.element_func(setwifi,tpt.element("WIFI"),0,setwifi)
  17. tpt.element_func(setwifi,tpt.element("PRTI"),0,setwifi)
  18. tpt.element_func(setwifi,tpt.element("PRTO"),0,setwifi)
  19. --tpt.element_func(setwifi,tpt.element("PPTI"),0,setwifi) --uncomment these
  20. --tpt.element_func(setwifi,tpt.element("PPTO"),0,setwifi) --if using my mod
  21.  
  22.  
  23. function nothing(i,x,y,surround_space,nt)
  24.    
  25. end
  26.  
  27. --for i = 0, 159 do                              --uncomment this to delete
  28. --   pcall(tpt.element_func,nothing,i,1,nothing) --all element update functions
  29. --end                                            --just a fun test I did
  30.  
  31. --fun fact: I use this as storage... things past this point deleted...
Advertisement
Add Comment
Please, Sign In to add comment