Object, Game and User Var convert strings into number when they shouldn’t

Use this template to make awesome bug reports:

Your username: NTh3R

What kind of device are you using?: iPad 6th gen, iPadOS 15.thing

1 sentence description of the problem (I was doing _________, and then __________ happened): I was coding in a project when i noticed Local Variables are slow to update. I change the Local to Object Variables, and totally destroyed my collision code. Here’s why: (open the linked project)

Steps that the Hopscotch team can take to reproduce my problem every time:

  1. Open my report bug project

I expected this to happen: All variables, Local, Object, Game n User Variables keep the 000

But instead this happened: Only Local var keept the 000

Here’s a sweet screenshot:

  1. Open https://awesome-e.github.io/hs-tools/hs-builder/?loadUrl=124k1yv58k
  2. Play the project — Don’t know how? Open this picture.
4 Likes

i swear this breaks my game

@Yuanyuan @AwesomeOnion @Awesome_E

2 Likes

Question: are non-local variables faster than local variables?

4 Likes

i can confirm the answer is yes. With local variables, clone index 3 was only able to see 3 datas in the string list. With object variables, it can view up 10 datas.

I unfortunately cannot test on Game and User variables.


edit: cannot confirm what i’m saying, i had found something that could affect that result. I’m testing rn on a separate draft

3 Likes

I thought the whole string to number was supposed to happen, as it was seen as an integer.

The user variable should stay as string after leaving the project and going back in due to the fact user variables can only be stored as string. It will still say 483, but it will be seen as “483” (the string version of 483) instead, which will therefore make some things not work.

1 Like

okay, what about the others? /nm /n

1 Like

If anything, they should’ve all be converting to number as it was using numeral values (0-9). Maybe Local variables work differently in this case. I generally use a special character to force a number to string. Although it still will not work if you try to grab just the numbers (it will still say 483).

I know user variables can only store its values as string, but that’s besides the point.

2 Likes

and it’s supposed to keep the 000 because it was previously a string

1 Like

You kind of lost me there. I don’t see how trailing 0’s have anything to do with being a string.

Although it would be neat if we were able to declare variables as string/float/integer.

1 Like

go in my code and you’ll understand

1 Like

Unfortunately, it seems that the opposite is true. It appears that local variables aren’t saving “possible numbers from strings” as numbers, as in the project below.

Honestly, I prefer that behavior since converting to a number is as easy as “round(str)”, but I don’t see that working in Hopscotch, at least in the current state.

2 Likes

Just curious, what part of your game did you need the trailing 0’s for? (000483)

1 Like

i seems that the string keeps its 0 before local var appears, so it’s way easier to manipulate strings, but i could be wrong tho

@Crosbyman64 clone collision code

2 Likes

Unfortunately I don’t think it’s intended, but like I said I would like behavior like that

1 Like