Lets chance in snap!

This is a port from a post on the scratch topic The Obscure MIT Project by Lifelong Kindergarten of Scratch, "Let's Chance." Let's add it to Scratch Lab! - Discuss Scratch
This has all the info you need on let’s chance

Some of the formatting is messed up due to scratch fourms and snap forums having different bb code and rings not working on this forums scratchblocks

Let’s Chance Snap Remake

This is the post dedicated to the snap remake of let’s chance by me!

You can access the project here!

if you don’t know why this isn’t it’s own topic see here
Or if you are wondering why this was ported look at the posts below it

Notices and information

I figured out a way to make the blocks have a drop-down that auto updates when a new dice is created! Let me know if you would like to see that!

Features:

The basics

There are 2 types of dice, basic and weighted

Most blocks support both basic and weighted dice

$nl is a new line character in a block, this can’t be done with the fourms plugin

The basic blocks you’ll be using the most are the following:

[scratchblocks]
New dice named [new dice] with [1] [2] [3] [4] [5] > ::pen
[/scratchblocks]

Adds a basic dice to the “dice” category of the editor, if a dice with the same name already exists it will be overwritten with the data of the new dice

[scratchblocks]
Set odds of dice ({} ring ::grey) $nl to (1) (2) (3) (4) (5) > ::pen
[/scratchblocks]

Turns a basic dice into a weighted dice, if the inputted dice is already a weighted dice then it overwrites the odds with the new ones

[scratchblocks]
(Roll dice ({} ring ::grey)::pen)
[/scratchblocks]

Rolls a basic or weighted dice

The more complicated

These are the more complicated blocks, they do the following:

[scratchblocks]
(Roll dice ({} ring ::grey) $nl with odds (1) (2) (3) (4) (5) > ::pen)
[/scratchblocks]

Rolls a basic dice with weights, if the dice is weighted already overwrites the weights with the new ones

[scratchblocks]
(Add onto dice ({} ring ::grey) $nl odds (1) (2) (3) (4) (5) >::pen)
[/scratchblocks]

Adds weights onto a basic dice without setting the pallet dice, if the dice is weighted already overwrites the weights with the new ones

[scratchblocks]
(Number dice from (1) to (10)::pen)
[/scratchblocks]

Returns a dice with the values of every whole number on the range provided

[scratchblocks]
Delete dice ({} ring ::grey)::pen
[/scratchblocks]

Deletes a pallet dice

The multi functionals

There’s 2 multi functional blocks

The first one is

[scratchblocks]
(Special dice [ v]::pen)
[/scratchblocks]

It has 3 menus

costume

sound

sprite

All of these submenus have the option to get the item itself or the name of the items (in snap sounds costumes and sprites are data types, a sound and it’s name are not the same thing)

The second one is

[scratchblocks]
([ v] of ({} ring ::grey)::pen)
[/scratchblocks]

This has 2 submenus, the first one has:

Values: returns the outcomes of the dice

Odds: returns the chance of each outcome

Rarest: returns the least likely outcome(s) of a dice roll

Likely: returns the most likely outcome(s) of a dice roll

Type: returns “basic” or “weighted” based on the type of dice

Flipped: returns the dice but with the order of the odds reversed

And the second has:

Dice: returns any sized list/table as a dice

Weighted dice: returns a weighted dice based on any sized list/table from the amount of time each item repeats

Rotated: returns the inputted list rotated 360°

Block: returns the provided list (NOT table) as a “list” block

Not empty: removes empty list items

Misc blocks

There’s a few miscellaneous blocks

[scratchblocks]
Save ({} ring ::grey) as dice named [new dice]::pen
[/scratchblocks]

Saves the provided dice as a palette dice

[scratchblocks]
Paint odds of dice ({} ring ::grey) $nl Width: () Height: ()::pen
[/scratchblocks]

Draws the values and odds of a dice as a bar chart onto the stage using the pen

[scratchblocks]
(Costume from odds of dice ({} ring ::grey) $nl Width: () Height: ()::pen)
[/scratchblocks]

Same as previous but returns what would have been drawn as a costume

Conclusion

This is mainly to give people something to do while we wait for a response from scratch team or the creators of LC

If you have any ideas on what could be added leave it on my profile to not clutter this fourm!

Any updates will be added onto the main topic as edits

Time: ~1.5 hours to write

Text: 4244 characters

image
these were made using the create die block

do not use the dev version of snap
any project made in the dev version may break in future versions

I didn’t mean to use the dev version, that’s just what I have bookmarked in my browser

The thing was made entirely in the normal version

How?? I’ve never seen anything like that before, especially that big text

You need to change your bookmark to the standard version

https://snap.berkeley.edu/snap/snap.html

I’m gonna do that and fix the link

image

Just put a $ before the word and append -x to the end of the word where x equals the size of the text. 1 is default size.

Okay? I don’t see how that’s exactly a bug as that’s expected

I didn't say it was a bug.

I was confused, the way coder phrased it made it sound like it was a bug report

Especially because I don’t see how you could get an input like that

That $ symbol tells Snap! that the text will be formatted in some way, like turn text into a symbol, change the color, etc.

Very very very very very big update to the topic

% symbol makes an input

Two things:

  1. What's with this:

Screen Shot 2023-10-12 at 4.56.00 PM

I haven't always had this problem with scratchblocks, I'm pretty sure.

  1. Sorry to be an English teacher, but I'm really having trouble reading this thread because of the ambiguities and/or confusions: "Dice" is the plural. The singular is "die." One die, two dice.

I'm assuming it might be the browser or an extension forcing a font size.

1: that’s a formatting error, scratchblocks don’t let you make rings here
[scratchblocks]
(()@addInput::ring)
[/scratchblocks]
This is what I typed:
(()@addInput::ring)
If this is done on the scratch forums you get this
IMG_1332
This is a function explicitly added to make snap notation possible


And it breaks in the plugin used here

2: i was taught die is the plural and dice is the singular…. I will fix that


I’ll actually just make it all “dice” to prevent confusion because of this

I made a version that uses drop-down menus that auto update. It’s slow because if I ran all the “set menus” blocks at once it would crash or lag really really bad it’s also really buggy and a lot of the blocks don’t work right
https://snap.berkeley.edu/snap/snap.html#present:Username=cookieclickerer33&ProjectName=Chances%20Experements
This is mainly just to prove it’s technically possible to do but requires a lot of work