Discuss Scratch

FireArrow879
Scratcher
65 posts

Different Bases

We should be able to use different bases for easier decoding/encoding, and easier color picking.
This is what the block would look like:
(convert () to base (16) with digits (0123456789ABCDEF))
set [ v] to [] in base (16) with digits (0123456789ABCDEF)
And the default for the base will be 10.

The benefits would be more convenient base conversion, easier hex codes, better cloud data, and cloud variables being able to have a bigger decimal value!

Last edited by FireArrow879 (Sept. 16, 2021 06:21:20)

BautistaConTodo
Scratcher
100+ posts

Different Bases

Technically scratch already haves Base 16.

when green flag clicked
set [my variable] to (join[0x] [ff])

Last edited by Paddle2See (Sept. 16, 2021 02:08:41)

Steve0Greatness
Scratcher
1000+ posts

Different Bases

BautistaConTodo wrote:

Technically scratch already haves Base 16.

when green flag clicked
set [my variable] to (join[0x] [ff])
what?

EDIT: close your tags.

Last edited by Steve0Greatness (Sept. 15, 2021 23:33:22)

Quantum-Cat
Scratcher
1000+ posts

Different Bases

Steve0Greatness wrote:

BautistaConTodo wrote:

Technically scratch already haves Base 16.

when green flag clicked
set [my variable] to (join[0x] [ff])
what?

EDIT: close your tags.
Yes, Scratch has support for converting binary, hexadecimal and octal to decimal.

((join [0x] [ffffff]) + ()) // hexadecimal --> decimal: 16777215
((join [0b] [11111111]) + ()) // binary --> decimal: 255
((join [0o] [12345]) + ()) // octal --> decimal: 5349
mumu245
Scratcher
1000+ posts

Different Bases

Quantum-Cat wrote:

Steve0Greatness wrote:

BautistaConTodo wrote:

Technically scratch already haves Base 16.

when green flag clicked
set [my variable] to (join[0x] [ff])
what?

EDIT: close your tags.
Yes, Scratch has support for converting binary, hexadecimal and octal to decimal.

((join [0x] [ffffff]) + ()) // hexadecimal --> decimal: 16777215
((join [0b] [11111111]) + ()) // binary --> decimal: 255
((join [0o] [12345]) + ()) // octal --> decimal: 5349
I didn't knew that!

Powered by DjangoBB