User variables not working correctly with minimum block

If you try to use the minimum block with a user variable, it will work incorrectly unless the user variable has been set in the current play. For example, in the project below it sets it to 10000, and minimum correctly shows 9. If you remove the set block, it will change to show 10000, even though that makes no sense.

19 Likes

What set block?

7 Likes

weird bug…

4 Likes

@Petrichor it doesn’t work because the 9 or the min or Marx must be on the right side not left so your equation says 9 but it Capps at test (1000) so it will end up doing 1000

5 Likes

Hmm thats weird

5 Likes

Hey @Petrichor, User variables are saved as strings, so when you are doing
min((9)(user var)) without the set block, it’s doing min((9)(“10000”)). It still doesn’t make sense though. The set block set the variable to a number when you play the project, but when you remove the block and play it again, it treats it as a string…

Maybe strings are treated as something less than a number or integer, IDK

1 Like

The comparison with strings states that the character “1” comes before “9” so therefore it is less.

I think I stared somewhere else that Hopscotch needs to parse all user variables before playing a project because local storage can only store values as strings.

This is really the same bug as “comparison bug”:

2 Likes

Yep, you did, and I know…