Advertisement
Guest User

startup

a guest
Nov 21st, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. rednet.open("back")
  2.  
  3. Pc1 = 260
  4. Pc2 = 266
  5. Pc3 = 264
  6. Pc4 = 265
  7.  
  8. cursorPos = 0
  9. cursorPosEnd = 0
  10.  
  11. sleepTime = 0.3
  12.  
  13. function main()
  14.  
  15. while true do
  16.  
  17.   term.clear()
  18.   term.setCursorPos(1,1)
  19.   term.write("> ")
  20.  
  21.   text = read()
  22.  
  23.   cursorPos = 66
  24.   cursorPosEnd = 0 - string.len(text)
  25.  
  26.   while true do
  27.  
  28.     rednet.send(Pc1, "1".."$"..cursorPos.."%"..text)
  29.     rednet.send(Pc2, "2".."$"..cursorPos.."%"..text)
  30.     rednet.send(Pc3, "3".."$"..cursorPos.."%"..text)
  31.     rednet.send(Pc4, "4".."$"..cursorPos.."%"..text)
  32.  
  33.     cursorPos = cursorPos - 1
  34.  
  35.     if cursorPos <= cursorPosEnd then
  36.  
  37.       os.run({},shell.getRunningProgram())
  38.  
  39.     end
  40.    
  41.     sleep(sleepTime)
  42.    
  43.   end
  44.  
  45. end
  46.  
  47. end
  48.  
  49. function sleeper()
  50.  
  51.   while true do
  52.  
  53.   term.setCursorPos(1,2)
  54.   term.write("< "..sleepTime.." >")
  55.  
  56.   term.setCursorPos(3,1)
  57.  
  58.   event, side, x, y = os.pullEvent("mouse_click")
  59.  
  60.   if x == 1 and y == 2 then
  61.  
  62.     if sleepTime >= 0.2 then
  63.    
  64.       sleepTime = sleepTime - 0.1
  65.    
  66.     end
  67.  
  68.   elseif x == (4 + string.len(tostring(sleepTime))) and y == 2 then
  69.  
  70.     if sleepTime <= 0.9 then
  71.    
  72.       sleepTime = sleepTime + 0.1
  73.    
  74.     end
  75.  
  76.   end
  77.  
  78.   end
  79.  
  80. end
  81.  
  82. parallel.waitForAny(main,sleeper)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement