Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local currentProg = 0
- local maxsize = 8
- local time_to_full = 10
- local step = 0.01
- local move_per_step = maxsize / (time_to_full / step)
- local function updateBar(name)
- currentProg = currentProg + ((move_per_step / maxsize) * 100)
- local formspec = "size[8,2]" ..
- "button[0,0;" .. ((maxsize / 100) * currentProg) .. ",1;name;".. math.floor(currentProg) .."%]" ..
- "label[0,1;We are noticing incredible progress.]"
- minetest.show_formspec("testmod:test", formspec)
- if(currentProg < 100) then
- minetest.after(step, updateBar, name)
- end
- end
- minetest.register_chatcommand("progbar", {
- params = "",
- description = "Shows a progress bar.",
- func = function(name)
- currentProg = 0
- minetest.after(step, updateBar, name)
- end,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement