Zum Würfeln der Zahlen die Kamera eimal nach links, dann nach rechts drehen und wieder gerade( 270 Grad - 90 Grad - 0 Grad).
Nur für Kameras mit Orientierungssensor!
Syntax: [ Download ] [ Verstecken ]
Benutze Lua Syntax Highlighting
--[[
@title lotto demo
@param n how many
@default n 6
@param r max
@default r 49
@param s min
@default s 1
@param e exclusive 1=on
@default e 1
@param o sort
@default o 1
@param z sound 1=on
@default z 1
]]
function shake()
repeat
until get_orientation_sensor() == 270
repeat
until get_orientation_sensor() == 90
repeat
until get_orientation_sensor() == 0
if sound == 1 then play_sound(4) end
end
--start script
count = n
min = s
max = r
exclusive = e
order = o
sound = z
if (min >= max) then
print("Wrong params, dumbass!;-)")
wait_click(0)
else
if ((exclusive == 1) and ((max - min + 1)<count)) then
print("Wrong params, dumbass!;-)")
wait_click(0)
else
repeat
result= {}
if exclusive == 1 then
array = {}
for i = min, max do
array[i] = i
end
for i = min, max do
rnd = math.random(min, max)
buffer = array[i]
array[i] = array[rnd]
array[rnd] = buffer
end
for c=1, count do
result[c] = array[c]
end
else
for i = min, max do
result[i] = math.random(min, max)
end
end
if order == 1 then table.sort(result) end
output = table.concat(result,", ")
cls()
print("-----[shake the cam]-----")
print()
print(output)
shake()
until false
end
end
@title lotto demo
@param n how many
@default n 6
@param r max
@default r 49
@param s min
@default s 1
@param e exclusive 1=on
@default e 1
@param o sort
@default o 1
@param z sound 1=on
@default z 1
]]
function shake()
repeat
until get_orientation_sensor() == 270
repeat
until get_orientation_sensor() == 90
repeat
until get_orientation_sensor() == 0
if sound == 1 then play_sound(4) end
end
--start script
count = n
min = s
max = r
exclusive = e
order = o
sound = z
if (min >= max) then
print("Wrong params, dumbass!;-)")
wait_click(0)
else
if ((exclusive == 1) and ((max - min + 1)<count)) then
print("Wrong params, dumbass!;-)")
wait_click(0)
else
repeat
result= {}
if exclusive == 1 then
array = {}
for i = min, max do
array[i] = i
end
for i = min, max do
rnd = math.random(min, max)
buffer = array[i]
array[i] = array[rnd]
array[rnd] = buffer
end
for c=1, count do
result[c] = array[c]
end
else
for i = min, max do
result[i] = math.random(min, max)
end
end
if order == 1 then table.sort(result) end
output = table.concat(result,", ")
cls()
print("-----[shake the cam]-----")
print()
print(output)
shake()
until false
end
end
Erstellt in 0.012 Sekunden, mit GeSHi 1.0.8.9