Unexpected fun (or fun facts)
-
I was going to post a link with my post about the very useful drawMultiColoredText() command, but it seems to have been removed without any notification. I guess we are not allowed to discuss undocumented features here?
-
@vinicity There is no problem with discussing them but they may or may not be come permanent language features so use with care
-
But why was the other topic deleted, then?
-
It was deleted by the poster
-
I see! Sorry for thinking it was you guys!
So, here is what I got:
drawMulticoloredText(float x, float y, float size, vector tint, ...)
where...
can be one string or a series of strings like other text drawing functions.It supports colour markup like
"[red]This will be red [blue]and this will be blue"
. Hex colour codes are also supported (should be prefixed with # like in HTML).But the most useful thing about it is that you can add in one of the following constants in the string:
CONTROLS_A, CONTROLS_B, CONTROLS_X, CONTROLS_Y, CONTROLS_DPAD, CONTROLS_STICK_LEFT, CONTROLS_STICK_RIGHT, CONTROLS_L3, CONTROLS_R3, CONTROLS_L, CONTROLS_ZL, CONTROLS_R, CONTROLS_ZR, CONTROLS_MINUS, CONTROLS_PLUS
and a little picture of the corresponding joy-con control will be rendered in its place.Just beware that this is undocumented and unsupported stuff, so it might change or even be removed in future Fuze updates. I think (and hope) the plan is to add this functionality to the old text rendering commands in the future...
-
@vinicity thats valuable information, thanks. But I am sure, you got some coding fun too to share😉?
-
Wow this is very nice! thanks you for sharing!
-
I got another one: never seen a thread going off topic as quick as this one 😂
-
OK, here is a joke:
A Programmer was walking out of door for work, his wife said “while you’re out, buy some milk” and he never came home.
-
My wife said: "Please go to the store and buy a carton of milk and if they have eggs, get six." I came back with 6 cartons of milk She said, "why in the hell did you buy six cartons of milk"
"They had eggs"
-
Yes, guys, you nailed it. 😄😆
-
How do mathematicians deal with constipation?
They sit down and work it out with a pencil.
-
what is a computers favorite food?... bits and chips
-
Depending on your integer size 4294967297 + 4294967297 = 2 ;-) also you can get over it if you use int() to define your integer value.
(further down in the code you need aupdate()
andsleep(10)
, not shown in the screenshot)
We seem to have 4 bytes available if we use a normal int assignment (not over the int() return value).
FFFF FFFF = 0 = 4294967296 = 2^32
Maybe int() returns a 64 bit integer? -
Yes, Fuze integers are 64 bit signed values, but the constant literals (numbers typed into the code editor) are 32 bit signed values. It is somewhat unusual for literals to be a smaller type than the variables they are assigned to. It makes for some interesting code if you want to use larger integers.
-
...so if you do ’x = 4294967296
y = x+x
Print(y)’You’ll get the right answer?
-
@toxibunny well not wrong, but probably not what you would expect. The number is stored in x as 0. So the result will be zero. @Gothon mentioned that the editor or interpreter is assigning only
2 bytes4 bytes for the number you type in the editor. If you generate that number with a function like int() and pow() you get the right value into x and it will show correctly. (Hope i got that right) -
What if x was set to be 4294967295?
-
@toxibunny said in Unexpected fun (or fun facts):
What if x was set to be 4294967295?
You will get 4294967295 + 4294967295 = -2 because 4294967295 = 2^32 - 1. Valid values for 32 bit (4 byte) signed numbers go from -2^31 to 2^31 - 1 (-2147483648 to 2147483647), anything outside that range wraps around. Eg, 2147483648 = -2147483648
-
I asked my lawyer if it was a crime to throw Sodium Chloride at a person.
Lawyer: yes, it's assault
Me: I know it's a salt but is it a crime?!?