Advertisement
theoriginalbit

Loading API: Example β€” Multiple Bars

Jan 13th, 2013
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. os.loadAPI( "/load")
  2.  
  3. local logo = {
  4.     "7   7              7     7        77 3   3 3  ",
  5.     "7   7                              7 3     3  ",
  6.     "777 777 777 777 77 7 777 7 777 777 7 333 3 333",
  7.     "7   7 7 7 7 7 7 7  7 7 7 7 7 7 7 7 7 3 3 3 3  ",
  8.     "7   7 7 777 7 7 7  7 777 7 7 7 777 7 3 3 3 3  ",
  9.     "7   7 7 7   7 7 7  7   7 7 7 7 7 7 7 3 3 3 3  ",
  10.     " 77 7 7 777 777 7  7 777 7 7 7 7 7 7 333 3  33",
  11. }
  12.  
  13. local overall = load.init( load.STANDARD, logo, 10, 30, 13, colors.red, "Starting up...", "Load Screen Example", "By TheOriginalBIT" )
  14. local bar = load.init( load.BAR_ONLY, nil, 20, 30, 14, colors.yellow, nil, nil, nil )
  15.  
  16. local function dooverallstuff()
  17.     overall:setMessage( "Downloading...")
  18.     for i = 1, 9 do
  19.         sleep( 1 ) -- normally something would be done here, please for the love of ___ don't just sleep it, this api isn't designed for fake loading screens
  20.         overall:triggerUpdate( "Downloading ("..( overall:getCurrentProgress() + 1 ).."/10)..." )
  21.     end
  22.    
  23.     overall:triggerUpdate( "Done!" )
  24. end
  25.  
  26. local function dobarstuff()
  27.     for i = 1, 20 do
  28.         sleep( 0.3 ) -- normally something would be done here, please for the love of ___ don't just sleep it, this api isn't designed for fake loading screens
  29.         bar:triggerUpdate( )
  30.     end
  31. end
  32.  
  33. local function dooverall()
  34.     overall:run( )
  35. end
  36.  
  37. local function dobar()
  38.     bar:run( )
  39. end
  40.  
  41. parallel.waitForAll( dooverall, dobar, dooverallstuff, dobarstuff )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement