Flashing numbers added to Number Picker stack.
Cubist at aol.com
Cubist at aol.com
Sun Jul 31 16:04:08 EDT 2005
sez douggilliland at gmail.com:
>One more question - if it's not asking too much.
>Sometimes I want a number, once it is selected, to be taken out of
>circulation. Is there a short script to add that will do this? I have
>searched all the resources but cannot find anything that explains how
>to do this.
Try something like this:
local WhatzLeft
on MakeList DerNumber
-- call this function when you want to generate a pool of numbers
--
-- it assumes DerNumber is a positive integer, so watch what you feed it
put "" into Rezult
repeat with K1 = 1 to DerNumber
put K1 into item K1 of Rezult
end repeat
put Rezult into WhatzLeft
end MakeList
function PickOne
put the number of items in WhatzLeft into PoolSize
if PoolSize = 0 then
return "Hey! Doofus! You ain't got nuttin' left!"
else
put the random of PoolSize into Fred
put item Fred of WhatzLeft into Rezult
delete item Fred of WhatzLeft
return Rezult
end if
end PickOne
Hope this helps...
More information about the use-livecode
mailing list