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?
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.
(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.
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.
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.
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.
thanks
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
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).
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)
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).
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!
It literally mentions the whole arbitrary thing (âof arbitrary lengthsâ) in their project.
ik, missunderstook the sentence [1], see edit
-
i thought you meant the string needs to be at a specific length âŠď¸
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).
interesting
may i give you the challenge to create a recursive regex search char?
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.
You might be able to get away with thatâŚ
I already did (find index of character in string v3). Itâs in my profile.
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?