290 posts
Location
St.Louis, MO
Posted 30 December 2012 - 11:10 PM
So I was wondering, it would be cool if there Owas a colors.random. So i added one. And i plan to add more functions. i present to you
COLOR360!!!!!it only has one function for now ._. the functions it adds are
Spoiler
random color term.setTextColor(math360.random())
and thats it for now.
pastebin get
iMs6yAwL color360
color360 = {}
function color360.random()
toReturn = 1
for i = 1,math.random(1,15) do
toReturn = toReturn * 2
end
return toReturn
end
496 posts
Location
New Zealand
Posted 31 December 2012 - 12:12 AM
Just wanted to point something out, with your random colour function you will never get white (1) only orange (2) and up.
Also instead of using a for loop you could do 2 ^ randomNumber.
function randomColour()
return 2 ^ math.random(0, 15) -- Shortens the for loop to a single line, and allows for the full range of white (1, 2 ^ 0) and up
end
There's nothing wrong with yours just thought I'd give you some (hopefully) helpful tips.
98 posts
Posted 31 December 2012 - 12:25 AM
couldn't you do
term.setTextColor(math.random(0,15))
290 posts
Location
St.Louis, MO
Posted 31 December 2012 - 12:32 AM
couldn't you do
term.setTextColor(math.random(0,15))
no because the color codes go to above 6000 and last time i checked 15 wasn't ANYWHERE near 6000
98 posts
Posted 31 December 2012 - 02:43 AM
couldn't you do
term.setTextColor(math.random(0,9999))
Problem solved
no because the color codes go to above 6000 and last time i checked 15 wasn't ANYWHERE near 6000
could you please be less bossy and angry next time, i was just trying to help.
290 posts
Location
St.Louis, MO
Posted 31 December 2012 - 11:45 AM
couldn't you do
term.setTextColor(math.random(0,9999))
Problem solved
no because the color codes go to above 6000 and last time i checked 15 wasn't ANYWHERE near 6000
could you please be less bossy and angry next time, i was just trying to help.
how was i being bossy? or angry? i just put anywhere in caps because it was a big difference
7508 posts
Location
Australia
Posted 31 December 2012 - 08:46 PM
couldn't you do
term.setTextColor(math.random(0,15))
you could actually do
term.setTextColor( 2 ^ math.random( 0, 15 ) )
since all the colors are actually on a binary scale
8543 posts
Posted 07 March 2013 - 07:20 PM
Locked by request.