Discuss Scratch

Unithlees3
Scratcher
1000+ posts

Random costume block

I really want a
random costume :: looks
block
BTW there is no workarounds for this block
An actual workaround

Last edited by Unithlees3 (May 2, 2021 17:08:56)

wvj
Scratcher
1000+ posts

Random costume block

workaround

when green flag clicked
switch costume to (pick random (1) to (number of costumes in sprite))
Unithlees3
Scratcher
1000+ posts

Random costume block

wvj wrote:

workaround

when green flag clicked
switch costume to (pick random (1) to (number of costumes in sprite))
Good, but the original block detects the number of costumes.
If we had the “maximum costume number” reporter, then it will be possible
switch costume to (pick random (1) to (maximum costume number :: looks))

Last edited by Unithlees3 (May 2, 2021 12:01:24)

Prime689
Scratcher
1000+ posts

Random costume block

Why just do those workarounds?

Also, I don't think that this would be used widely.

No support.
han614698
Scratcher
1000+ posts

Random costume block

Unithlees3 wrote:

wvj wrote:

workaround

when green flag clicked
switch costume to (pick random (1) to (number of costumes in sprite))
Good, but the original block detects the number of costumes.
If we had the “maximum costume number” reporter, then it will be possible
switch costume to (pick random (1) to (maximum costume number :: looks))
I would like to note that there is a workaround to test how many costume they are.
Here it is (it is complicated, though):

. . .
hide
RWSR::custom stack
show
. . .
define RWSR
set [a v] to [0]
delete all of [list v]::list stack
switch costume to ((costume [number v]::looks reporter) - (costume [number v]::looks reporter))//switches to first costume
repeat until <(costume [number v]::looks reporter) = ((item (length of [list v] :: list) of [list v] :: list) - (1))>
next costume
change [a v] by (1)
add (costume [number v]::looks reporter) to [list v]
end
switch costume to (pick random (1) to (costume [number v]::looks reporter)
You can't add costumes in projects whilst they're running, so you can manually just use the workaround stated by wvj above because the costume number will always be the same throughout the project. You can probably live with just adding one to the end number everytime.

Edit - 2024 I removed second workaround because it was stupid.

Last edited by han614698 (March 13, 2024 13:04:31)

Unithlees3
Scratcher
1000+ posts

Random costume block

han614698 wrote:

Unithlees3 wrote:

wvj wrote:

workaround

when green flag clicked
switch costume to (pick random (1) to (number of costumes in sprite))
Good, but the original block detects the number of costumes.
If we had the “maximum costume number” reporter, then it will be possible
switch costume to (pick random (1) to (maximum costume number :: looks))
I would like to note that there is a workaround to test how many costume they are.
Here it is (it is complicated, though):

. . .
hide
RWSR::custom stack
show
. . .
define RWSR
set [a v] to [0]
delete all of [list v]::list stack
switch costume to ((costume [number v]::looks reporter) - (costume [number v]::looks reporter))//switches to first costume
repeat until <(costume [number v]::looks reporter) = ((item (length of [list v] :: list) of [list v] :: list) - (1))>
next costume
change [a v] by (1)
add (costume [number v]::looks reporter) to [list v]
end
switch costume to (pick random (1) to (costume [number v]::looks reporter)
You can't add costumes in projects whilst they're running, so you can manually just use the workaround stated by wvj above because the costume number will always be the same throughout the project. You can probably live with just adding one to the end number everytime.
Alternately, you can set the random script to be:
switch costume to (pick random (1) to ((foo)))

when [space v] key pressed
if <[Unithlees3] = (username)> then
change [foo v] by (1)//you can run the project and press space every time you add a costume.
end
No Support because the workarounds (except the top one, which was hypothetical) aren't that hard.
Ok
Unithlees3
Scratcher
1000+ posts

Random costume block

bump
han614698
Scratcher
1000+ posts

Random costume block

removed

Last edited by han614698 (March 13, 2024 13:04:51)

Zoomer_X
Scratcher
500+ posts

Random costume block

I believe that
when green flag clicked
switch costume to (join [r] [andom costume])
works
Unithlees3
Scratcher
1000+ posts

Random costume block

Zoomer_X wrote:

I believe that
when green flag clicked
switch costume to (join [r] [andom costume])
works
let me try that
dertermenter
Scratcher
1000+ posts

Random costume block

The workaround is really simple. The workaround is better as if random limit needs changing, you can use a variable to do that, making the workaround more flexible
Unithlees3
Scratcher
1000+ posts

Random costume block

dertermenter wrote:

The workaround is really simple. The workaround is better as if random limit needs changing, you can use a variable to do that, making the workaround more flexible
I prefer using the block, not the workaround
Unithlees3
Scratcher
1000+ posts

Random costume block

bump
bluedragon8633
Scratcher
1000+ posts

Random costume block

No support, the workaround is too simple.
han614698
Scratcher
1000+ posts

Random costume block

yeah bruh

Last edited by han614698 (March 13, 2024 13:05:23)

Unithlees3
Scratcher
1000+ posts

Random costume block

han614698 wrote:

bluedragon8633 wrote:

No support, the workaround is too simple.
Vs

Unithlees3 wrote:

I prefer using the block, not the workaround

Okay!
run platformer::custom-arg//scratch loses all educational value and goes bankrupt and you can never use it again
bruh
dertermenter
Scratcher
1000+ posts

Random costume block

Unithlees3 wrote:

dertermenter wrote:

The workaround is really simple. The workaround is better as if random limit needs changing, you can use a variable to do that, making the workaround more flexible
I prefer using the block, not the workaround
But the workaround is better, explained in post above ^^
Unithlees3
Scratcher
1000+ posts

Random costume block

dertermenter wrote:

Unithlees3 wrote:

dertermenter wrote:

The workaround is really simple. The workaround is better as if random limit needs changing, you can use a variable to do that, making the workaround more flexible
I prefer using the block, not the workaround
But the workaround is better, explained in post above ^^
OK then, now I prefer using workarounds

Last edited by Unithlees3 (May 2, 2021 17:10:41)

Sikecon
Scratcher
1000+ posts

Random costume block

Unithlees3 wrote:

bump

Don't bump a topic after only 2 minutes.

Unithlees3
Scratcher
1000+ posts

Random costume block

bump

Powered by DjangoBB