Discuss Scratch
- Discussion Forums
- » Suggestions
- » Allow typing of x, A, B, C, D, F, in number inputs.
- thugatwoary
-
100+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
Scratch's math blocks support hexadecimal but you can't type hex numbers in number inputs. To fix this, x should be typable so people can put 0x to specify it's a hex number, and A, B, C, D, and F should be typable so people can put hexadecimal numbers.
- yavuz61035
-
500+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
maybe something like there would be 2 modes when writing a number input, base-10 (decimal) and base-16 (hexadecimal) and there would be 2 buttons to switch between them (deafult is base-10) and base-16 would probably have a scroll feature to fit the x and A-F characters or the number input frame
would be higher to fit in the other characters
anyways, support.
would be higher to fit in the other characters
anyways, support.
- ScolderCreations
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
I don't think there should be some sort of option, or anything that makes it very obvious, because people who don't know what hexadecimal is won't understand what this means, and might even think this is talking about hex colors. However, I do think it should be possible to type in those letters with your keyboard, that is a good way to allow people to use this without making it too confusing.
- ideapad-320
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
you forgot E. Scratch's math blocks support hexadecimal but you can't type hex numbers in number inputs. To fix this, x should be typable so people can put 0x to specify it's a hex number, and A, B, C, D, and F should be typable so people can put hexadecimal numbers.
- mybearworld
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
No they didn't - e is already allowed, try this: you forgot E.
(1e6) + ()
- portalpower
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
workaround:
define decimal->hexadecimal (input)It doesn't work for decimals though
//run without screen refresh
set [input v] to ([abs v] of (input::custom))
set [output v] to []
repeat until <(input::variables) = [0]>
set [output v] to (join (letter (((input::variables) mod (16)) + (1)) of [0123456789ABCDEF]) (output)
set [input v] to ([floor v] of ((input::variables) / (16)))
end
set [output v] to ((output) * ((input) / ([abs v] of (input))))
- thugatwoary
-
100+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
This is not suggesting decimal->hexadecimal. Please read the title before posting on a topic. workaround:define decimal->hexadecimal (input)It doesn't work for decimals though
...
- portalpower
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
(#7)Oops, I forgot to put the hexa->deci. Oh well.This is not suggesting decimal->hexadecimal. Please read the title before posting on a topic. workaround:define decimal->hexadecimal (input)It doesn't work for decimals though
...
If you use the encoders, then you don't really need to type the inputs in hexadecimal.
- thugatwoary
-
100+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
That doesn't change the fact that this suggestion was about allowing the typing of hexadecimal in inputs that support them.(#7)Oops, I forgot to put the hexa->deci. Oh well.This is not suggesting decimal->hexadecimal. Please read the title before posting on a topic. workaround:define decimal->hexadecimal (input)It doesn't work for decimals though
...
If you use the encoders, then you don't really need to type the inputs in hexadecimal.
- portalpower
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
Entire workaround:
define decimal->hexadecimal (input)There.
//run without screen refresh
set [i v] to (round ([abs v] of (input::custom)))//for this sprite only
set [output v] to []
repeat until <(i) = [0]>
set [output v] to (join (letter (((i) mod (16)) + (1)) of [0123456789ABCDEF]) (output)
set [i v] to ([floor v] of ((i) / (16)))
end
set [output v] to ((output) * ((i) / ([abs v] of (input))))
define hexadecimal->decimal (input)
//run without screen refresh
set [output v] to [0]
set [input v] to (round ([abs v] of (input)))//for this sprite only
set [i v] to [0]//for this sprite only
repeat (length of (input::variables))
change [output v] by ((round ([e^ v] of ((i) * ([ln v] of (16)))::operators)) * ((item # of (letter ((length of (inputs::variables)) - (i)) of (input::variables)) in [numbers v]::list) - (1)))//numbers list would be numbers 0-F
end
hexadecimal->decimal (...::grey)//how to use
set [var v] to (*operations*(output)::grey)
decimal->hexadecimal (var)
- thugatwoary
-
100+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
Since someone is posting a workaround to something entirely different, I figured I'd post an actual workaround that's… actually kinda simple.
((join [0x] [...]) + (...))Despite how simple this is, I still feel like it'd make sense to add support for these characters. Actually, how simple this is makes me feel like there's even less of a reason not to as it is already nearly entirely supported, and supporting these characters would make other users who might want to use hex numbers know that they are actually supported, since the workaround is still a somewhat hacky one that most users wouldn't think of.
Last edited by thugatwoary (June 24, 2022 23:13:53)
- portalpower
-
1000+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
(#11)It also doesn't stay in hexadecimal. You have to use a custom function to convert it back.
Since someone is posting a workaround to something entirely different, I figured I'd post an actual workaround that's… actually kinda simple.((join [0x] [...]) + (...))Despite how simple this is, I still feel like it'd make sense to add support for these characters. Actually, how simple this is makes me feel like there's even less of a reason not to as it is already nearly entirely supported, and supporting these characters would make other users who might want to use hex numbers know that they are actually supported, since the workaround is still a somewhat hacky one that most users wouldn't think of.
- thugatwoary
-
100+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
True, but having it stay hex was not what was suggested, as the title only says “Allow typing of x, A, B, C, D, F, in number inputs.”(#11)It also doesn't stay in hexadecimal. You have to use a custom function to convert it back.
Since someone is posting a workaround to something entirely different, I figured I'd post an actual workaround that's… actually kinda simple.((join [0x] [...]) + (...))Despite how simple this is, I still feel like it'd make sense to add support for these characters. Actually, how simple this is makes me feel like there's even less of a reason not to as it is already nearly entirely supported, and supporting these characters would make other users who might want to use hex numbers know that they are actually supported, since the workaround is still a somewhat hacky one that most users wouldn't think of.
- TheReal_BestGamer
-
33 posts
Allow typing of x, A, B, C, D, F, in number inputs.
Perhaps there could be an option in a more subtle way, such as making you only able to do Hex if they type ACBDEF first then the actual Hex number. I don't think there should be some sort of option, or anything that makes it very obvious, because people who don't know what hexadecimal is won't understand what this means, and might even think this is talking about hex colors. However, I do think it should be possible to type in those letters with your keyboard, that is a good way to allow people to use this without making it too confusing.
- thugatwoary
-
100+ posts
Allow typing of x, A, B, C, D, F, in number inputs.
bump
Last edited by thugatwoary (June 27, 2022 13:27:32)
- Discussion Forums
- » Suggestions
-
» Allow typing of x, A, B, C, D, F, in number inputs.