Discuss Scratch

BossRushFanatic
New to Scratch
17 posts

Help with randomizer script!

Hey y'all! I need help with a randomizer script for my project. It's a script to pick a random number! I already know how to do that, I just need to choose the “Pick number between” block but I need a lil help with another script for this block. I want to create a script that removes a number from that block anytime I get that number. For example if the “Pick number between” block picks the number 1 I want it so whenever I try that block again it gives me any number except 1. Is there I way I can do this? Thank you and hope y'all have an amazing day! ^^

Last edited by BossRushFanatic (April 8, 2024 15:48:18)

Fluffygamer_
Scratcher
1000+ posts

Help with randomizer script!

There is definitely a way to do this ! I'm gonna show you the code in a bit

BREAKING NEWS
The evil kumquats have rebelled and now they don't just eat signatures.

NOW THEY EAT YOUR «MY STUFF» PAGE AND OTHER 2.0 UI PAGES !
Credit to @jmdzti_0-0

BLOCKS ARMY :
((0) - (0)) //  This is Zero. He protects my signature from evil kumquats

------(:-:)------ :: pen //  This is Bumpa. She bumps my topics when necessary. She also have a few skills at fighting since Zero taught her.

(O(w :: variables)O :: sensing) // This is Dogee. He helps me doing projects

('-' :: list) // This is Little. She verify that evil kumquats aren't coming.

° ° :: #0055ff //  This is 2S. He is the best animator I never seen on scratch. His account is Scratcheurscratch (https://scratch.mit.edu/users/Scratcheurscratch)

when green flag clicked :: cap //  This is Soja. I don't know if it's a boy or a girl but who cares ? Soja often draw thumbnails for my projects.
Pixilized
Scratcher
100+ posts

Help with randomizer script!

Whenever you get a number, add it to a list. Then, keep generating numbers until you get a new one. I’ve made the scripts below.

delete all of [numbers v] :: list //Use this to reset the randomizer

define Generate Number
repeat until <not <[numbers v] contains (random)>>
Set [random v] to (pick random [min] to [max]
End
add (random) to [numbers v]

Fluffygamer_
Scratcher
1000+ posts

Help with randomizer script!

repeat until <not <(result) = (last result)>>
set [ result] to (pick random () to ())
end
set [ last result] to (result)
Then, whatever is your code, put your variable “result” instead of the “pick random” block.

BREAKING NEWS
The evil kumquats have rebelled and now they don't just eat signatures.

NOW THEY EAT YOUR «MY STUFF» PAGE AND OTHER 2.0 UI PAGES !
Credit to @jmdzti_0-0

BLOCKS ARMY :
((0) - (0)) //  This is Zero. He protects my signature from evil kumquats

------(:-:)------ :: pen //  This is Bumpa. She bumps my topics when necessary. She also have a few skills at fighting since Zero taught her.

(O(w :: variables)O :: sensing) // This is Dogee. He helps me doing projects

('-' :: list) // This is Little. She verify that evil kumquats aren't coming.

° ° :: #0055ff //  This is 2S. He is the best animator I never seen on scratch. His account is Scratcheurscratch (https://scratch.mit.edu/users/Scratcheurscratch)

when green flag clicked :: cap //  This is Soja. I don't know if it's a boy or a girl but who cares ? Soja often draw thumbnails for my projects.
Fluffygamer_
Scratcher
1000+ posts

Help with randomizer script!

Pixilized wrote:

(#3)
Whenever you get a number, add it to a list. Then, keep generating numbers until you get a new one. I’ve made the scripts below.

delete all of [numbers v] :: list //Use this to reset the randomizer

define Generate Number
repeat until <not <[numbers v] contains (random)>>
Set [random v] to (pick random [min] to [max]
End
add (random) to [numbers v]
I think he wanted it to only remember the very last result

BREAKING NEWS
The evil kumquats have rebelled and now they don't just eat signatures.

NOW THEY EAT YOUR «MY STUFF» PAGE AND OTHER 2.0 UI PAGES !
Credit to @jmdzti_0-0

BLOCKS ARMY :
((0) - (0)) //  This is Zero. He protects my signature from evil kumquats

------(:-:)------ :: pen //  This is Bumpa. She bumps my topics when necessary. She also have a few skills at fighting since Zero taught her.

(O(w :: variables)O :: sensing) // This is Dogee. He helps me doing projects

('-' :: list) // This is Little. She verify that evil kumquats aren't coming.

° ° :: #0055ff //  This is 2S. He is the best animator I never seen on scratch. His account is Scratcheurscratch (https://scratch.mit.edu/users/Scratcheurscratch)

when green flag clicked :: cap //  This is Soja. I don't know if it's a boy or a girl but who cares ? Soja often draw thumbnails for my projects.
Pixilized
Scratcher
100+ posts

Help with randomizer script!

Fluffygamer_ wrote:

I think he wanted it to only remember the very last result
I believe they wanted it to generate random numbers without repeating any numbers.

Fluffygamer_
Scratcher
1000+ posts

Help with randomizer script!

Pixilized wrote:

(#6)

Fluffygamer_ wrote:

I think he wanted it to only remember the very last result
I believe they wanted it to generate random numbers without repeating any numbers.
Oh wait, you're right ! Sorry for the confusion

BREAKING NEWS
The evil kumquats have rebelled and now they don't just eat signatures.

NOW THEY EAT YOUR «MY STUFF» PAGE AND OTHER 2.0 UI PAGES !
Credit to @jmdzti_0-0

BLOCKS ARMY :
((0) - (0)) //  This is Zero. He protects my signature from evil kumquats

------(:-:)------ :: pen //  This is Bumpa. She bumps my topics when necessary. She also have a few skills at fighting since Zero taught her.

(O(w :: variables)O :: sensing) // This is Dogee. He helps me doing projects

('-' :: list) // This is Little. She verify that evil kumquats aren't coming.

° ° :: #0055ff //  This is 2S. He is the best animator I never seen on scratch. His account is Scratcheurscratch (https://scratch.mit.edu/users/Scratcheurscratch)

when green flag clicked :: cap //  This is Soja. I don't know if it's a boy or a girl but who cares ? Soja often draw thumbnails for my projects.

Powered by DjangoBB