3 posts
Posted 06 January 2016 - 01:39 AM
Hi
im making a auto installer but i want a good looking install bar (that isn't simpleinstall or whatever its called simple something)
i want one that looks like this and the middle is the loading bar
——————————————————————–
(While is the bar in this line) Installing | %42 |
——————————————————————-
If you know how to do this please let me know the code
8543 posts
Posted 06 January 2016 - 02:27 AM
Moved to Ask a Pro.
You need to read the sticky posts and forum descriptions. This is the second time you've posted a question in the wrong section, and you've only made two posts!
1847 posts
Location
/home/dannysmc95
Posted 06 January 2016 - 09:00 AM
- snip -
This is fairly simple to make, but what will the loading bar be for? Like a download (which is not really possible), like you can do one on a timer? or you can use data?
you can use a for loop and loop through so an example is:
-- This is the start position
local startx = 2
-- This is the end position
local endx = 49
-- This is the yvalue the bar will draw on
local ypos = 8
-- This is the colour of the bar
local barcolour = "blue"
-- Sleep time (progress speed of the bar)
local stime = 0.1
-- Simple loop from startx to endx
for i=startx, endx do
-- Draw a pixel at the y value, and then the internal counter, with the colour you wanted
paintutils.drawPixel(i, ypos, colours[barcolour])
-- Wait to make it an animation
sleep(stime)
end
If you want to use data, then it depends on what you want…?
3 posts
Posted 07 January 2016 - 02:50 AM
It doesn't seem to work i do this in a file
– This is the start position
local startx = 2
– This is the end position
local endx = 49
– This is the yvalue the bar will draw on
local ypos = 8
– This is the colour of the bar
local barcolour = "white"
– Sleep time (progress speed of the bar)
local stime = 0.1
– Simple loop from startx to endx
for i=startx, endx do
– Draw a pixel at the y value, and then the internal counter, with the colour you wanted
paintutils.drawPixel(i, 8, colours[white])
– Wait to make it an animation
sleep(0.1)
end
1847 posts
Location
/home/dannysmc95
Posted 07 January 2016 - 07:55 AM
It doesn't seem to work i do this in a file
– This is the start position
local startx = 2
– This is the end position
local endx = 49
– This is the yvalue the bar will draw on
local ypos = 8
– This is the colour of the bar
local barcolour = "white"
– Sleep time (progress speed of the bar)
local stime = 0.1
– Simple loop from startx to endx
for i=startx, endx do
– Draw a pixel at the y value, and then the internal counter, with the colour you wanted
paintutils.drawPixel(i, 8, colours[white])
– Wait to make it an animation
sleep(0.1)
end
This is because you changed part of the code…
where it says
paintutils.drawPixel(i, 8, colours[white])
It SHOULD be:
paintutils.drawPixel(i, ypos, colours[barcolour])
The only code you edit should be the variables at the top, not the actual for loop.