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.
What set block?
@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
Hmm thats weird
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
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”:
Yep, you did, and I know…
Use this template to make awesome bug reports:
Your username: C.H.Rissole
What kind of device are you using?: iPad13,1
1 sentence description of the problem (I was doing _________, and then __________ happened): I was making a saveable art pad but it saves the wrong colour.
Steps that the Hopscotch team can take to reproduce my problem every time:
- Make a project like this.
- Tap the screen, get a random number
- Restart. It shows the same number
- Tap ‘edit’. Tap play. Do this step twice
- It shows 100 instead of the number you have gotten.
It’s probably because of the Set variable to minimum and maximum code.
I expected this to happen:
Show the correct number
But instead this happened:
It shows 100.
Here’s a sweet screenshot:
It’s at the thumbnail of the project linked above.
I’ll try this and update you.
Edit: it works fine.
I had it do the 100 thing worked every time here’s how i did it
- Play it
2.tap a few times
- Press edit and play x2
4.then play the project
Sorry. I just found out what’s wrong. This topic can be closed.
Can I know what the problem was
The iPad somehow thinks that the number is a string instead of a number. All you need to do is to multiply it by 1 so it understands that it is a number instead.
Hey there, while this is true its still a bug and is a valid report! I can close this, or i can merge into an older topic on the same subject matter!
@c.h.rissole I’ve deleted all posts about merging for a less cluttered view