You Can Talk About Hopscotch Here; Topic 30 [OFFICIAL]

I just realised I changed my username on hopscotch but it still shows as my old username on my profile, does anyone now how I can update it?

3 Likes

So I have been stuck on a problem that I can’t find a good solution for. I do have a solution but it’s not very good…

So basically, in hopscotch, when you have a number with 0’s in front, hopscotch automatically deletes those 0’s.

So 0056 becomes 56.

But the thing is, is that in a project I’m working on, I have a variable, and this variable is supposed to store a number. And this number often has 0’s in front.

This usually isn’t an issue as hopscotch automatically removes 0’s in front of a number (which is what I want), but this doesn’t happen with negative numbers.

So 00-56 doesn’t become -56, as hopscotch treats 00-56 as a string, not a number. And I was wondering if someone had a way to convert this string to a number.

6 Likes

(Characters in (00-56) between 2 and 5) * 1 ???

The fact it doesn’t remove the zeros from 00-56 automatically makes sense as the negative sign is also known in string as a hyphen. The only ways to get rid of the zeros here is to do it manually.

5 Likes

Go to: preferences (click your pfp at the top of your screen), then go to profile, then scroll down until you find the Hopscotch username section. It’s also where you would go to change your bio.

3 Likes

That doesn’t work as in my case the negative character can be in different positions in the string, and the string can be different sizes.

6 Likes

Then there’s no way to do it. Unless you want to do frame recursion to search for the negative sign in the potentially huge string (which can cause crashes if the string is very very large).

It would be very limited, and after a certain point it’s no longer possible to do it in one frame.

4 Likes

thanks :slightly_smiling_face:

4 Likes

method 1:
use ThinBuffaloSr’s search char algorithm (the efficient algorithm, plus you can use it anywhere else in your code as much as you wish)

method 2:
import Awesome_E’s secret blocks
write this in your code

Set pos0 to "Character at 0" matches "-"
Set pos1 to "Character at 1" matches "-"
Set pos2 to "Character at 2" matches "-"
Set pos3 to "Character at 3" matches "-"
Set pos4 to "Character at 4" matches "-"
Set pos5 to "Character at 5" matches "-"
[...]
Set pos to "pos1" + "pos2" + "pos3" + "pos4" + "pos5" + [...]
Character in (00-56) between pos and Length(00-56)

both methods are instantaneous

edit: see discussion below, and dont take method 2

3 Likes

This won’t work because their string can be ANY length (besides the required specific lengths it needs to be for the code to work correctly).

3 Likes

i dont see why my codes have length limitations

ok for the 2nd one maybe theres a length limitations, but thats not true for the first one (if you copy enough codes you’ll reach till 16384+++, which would surprise me if spy guy reaches that numb)

2 Likes

Method 1 requires it to be at arbitrary lengths (2, 4, 8, 16, 32, etc.)

Method 2 looks like it’ll take too much blocks for what they want to do (1000s of them, potentially).

1 Like

dont think thats true /little-conf

my kahoot project def doesnt have these specific length and it works perfectly

edit: oh wait do you mean inside the ability? yea just copy the code a bunch of time and you’ll reach terrifically big numbers - even more than js limit maybe!

3 Likes

It literally mentions the whole arbitrary thing (“of arbitrary lengths”) in their project.

3 Likes

ik, missunderstook the sentence [1], see edit


  1. i thought you meant the string needs to be at a specific length ↩︎

4 Likes

The frame recursion method I use is instantaneous up to 500 characters, less if you own a slower device (which, at that point, use method 1).

1 Like

interesting
may i give you the challenge to create a recursive regex search char?

3 Likes

Would it be easier if the string was a set length of 6?

As long as it works with that, I can get my code to work.

My current method is to check for every position the “-“ can be in but that isn’t a good method at all and I was hoping someone had a more simpler/efficient method.

5 Likes

You might be able to get away with that…

4 Likes

I already did (find index of character in string v3). It’s in my profile.

4 Likes

Here’s a recursive way to do it in two frames for any length string (up to the javascript limit, which varies, but you shouldn’t need to worry about with six characters). I’m not sure how good this will be for performance so I wouldn’t recommend doing it like 1000 times per frame. Just use self result as the output. It would be better if we could Return values from custom blocks but we cannot.


Do keep in mind that this will not just remove zeroes, but anything that is not a digit between 1 and 9 or a -. You can change what it stops removing at by playing the the regex.


Removing the characters is the easy part, adding them in the first place is really annoying with Characters between block no longer always returns a string not being fixed.
How are you doing it?

6 Likes