30 posts
Location
Somewhere in France
Posted 23 February 2017 - 03:49 PM
Can someone make me a looping random text generator, with
characters ASCII 0 to 255? And it should work in the latest CC version for 1.7.10. Thanks.
All the ones I tried could not change the seed.
8543 posts
Posted 23 February 2017 - 05:48 PM
Moved to General. Ask a Pro is where you'd ask for help when you get stuck creating something. There's no place on the forums to request that someone make something for you, but we usually stick these sort of posts in General.
726 posts
Location
Rem is best girl
Posted 23 February 2017 - 07:03 PM
function randomLetter()
return string.char(math.random(33,255)) -- 32 and below are control characters and other ones we dont need :^)
end
function generateString(number) -- cant be bothered to add checks for number to be a number.
local str = ""
for i=0,number,1 do
str = str .. randomLetter()
end
return str
end
Edited on 26 February 2017 - 01:18 PM
30 posts
Location
Somewhere in France
Posted 26 February 2017 - 08:27 AM
function randomLetter()
return string.char(math.random(33,255)) -- 32 and below are control characters and other ones we dont need :^)
end
function generateString(number) -- cant be bothered to add checks for number to be a number.
local str = ""
for i,number do
str = str .. randomLetter()
end
return str
end
Thanks, but i'm getting this error:
Spoiler
726 posts
Location
Rem is best girl
Posted 26 February 2017 - 02:18 PM
Try now.
30 posts
Location
Somewhere in France
Posted 02 March 2017 - 06:39 PM
Try now.
No error, but no output too.
218 posts
Location
tmpim
Posted 03 March 2017 - 03:57 AM
What's your exact code? Because the code that TehRockettek posted should work.
726 posts
Location
Rem is best girl
Posted 03 March 2017 - 08:07 AM
I believe you are using 1.7.10 minecraft which doesnt support certain characters?
Change
math.random(33,255)
to
math.random(33,122)
2427 posts
Location
UK
Posted 03 March 2017 - 02:00 PM
TehRockettek's code doesn't print the string, it just makes it
add this to the bottom of Rocket's code
local length = 5
print(generateString(length))
Edited on 03 March 2017 - 01:01 PM