Let's say you wanna make a line of swch,metl,nscn,pscn from 100 x, 100 y to 100 x, 150 y:
for y=100,150 do
local rand = math.random(0,3)
if rand==0 then tpt.create(100,y,56) end--SWCH
if rand==1 then tpt.create(100,y,14) end--METL
if rand==2 then tpt.create(100,y,36) end--NSCN
if rand==3 then tpt.create(100,y,35) end--PSCN
end
Hope that helps
EDIT: 2d version:
for x=100,150 do
for y=100,150 do
local rand = math.random(0,3)
if rand==0 then tpt.create(x,y,56) end--SWCH
if rand==1 then tpt.create(x,y,14) end--METL
if rand==2 then tpt.create(x,y,36) end--NSCN
if rand==3 then tpt.create(x,y,35) end--PSCN
end
end
(man, it's so hard to indent code in this amazing html editor here...)
I don't think there's a way to control how randomly you can generate numbers in Lua. As for the scattering, this code plots the pixels all over the screen and also has empty spaces. If you do not want empty spaces, change "math.random(0,4)" to "math.random(1,4)":
for x=4,607 do
for y=4,379 do
local rand = math.random(0,4)
if rand==1 then tpt.create(x,y,56) end--SWCH
if rand==2 then tpt.create(x,y,14) end--METL
if rand==3 then tpt.create(x,y,36) end--NSCN
if rand==4 then tpt.create(x,y,35) end--PSCN
end
end
Guys, please tell me how to properly indent this code. The editor doesn't seem to like regular tabs ;-;
I was experimenting a bit more... and found a thing I think is slightly more random.
function rando(x,m)
local a = math.random(0,2^20)
local b = math.random(0,2^20)
x = (a*x+b)%m
return x
end
rand = math.random() + math.random(0,4)
for x=100,150 do
for y=100,150 do
rand = rando(rand,4.1)
if 0.5<=rand and rand<=1 then tpt.create(x,y,56) end--SWCH
if 1.5<=rand and rand<=2 then tpt.create(x,y,14) end--METL
if 2.5<=rand and rand<=3 then tpt.create(x,y,36) end--NSCN
if 3.5<=rand and rand<=4 then tpt.create(x,y,35) end--PSCN
end
end
yeah but math.random() doesn't seem random enough for his needs
EDIT: I've compared the results of math.random() and my unnecessarily large script and my script seems to be a bit more random. yay