Guest User

Untitled

a guest
Nov 24th, 2017
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local currentProg = 0
  2. local maxsize = 8
  3. local time_to_full = 10
  4. local step = 0.01
  5. local move_per_step = maxsize / (time_to_full / step)
  6.  
  7. local function updateBar(name)
  8.     currentProg = currentProg + ((move_per_step / maxsize) * 100)
  9.     local formspec = "size[8,2]" ..
  10.                  "button[0,0;" .. ((maxsize / 100) * currentProg) .. ",1;name;".. math.floor(currentProg) .."%]" ..
  11.                  "label[0,1;We are noticing incredible progress.]"
  12.     minetest.show_formspec("testmod:test", formspec)
  13.     if(currentProg < 100) then
  14.         minetest.after(step, updateBar, name)
  15.     end
  16. end
  17.  
  18. minetest.register_chatcommand("progbar", {
  19.     params = "",
  20.     description = "Shows a progress bar.",
  21.     func = function(name)
  22.         currentProg = 0
  23.         minetest.after(step, updateBar, name)
  24.     end,
  25. })
RAW Paste Data