A feature I’d like to see in Hopscotch is:
Multiplication copying strings
I’d use it for this type of project:
Projects where you have a number which needs a specific amount length, you could use this to add enough extra characters before/after.
Unfortunately, with “0” always being interpreted as a number, you wouldn’t be able to do this with that, but that could always be fixed by making you choose the type of a variable when you create it, and also, but slightly less easily, Replace something with something in string
Here are some examples of Hopscotch code that could be improved if we had this:
Repeat 4-length(variable)
set varaible2 to varaible2 + 0
16 Likes
sprintf and memcpy
String multiplication is for the blasphemous.
3 Likes
I don’t think that’s possible…?
But if it is then yes
1 Like
It exists in other programming languages actually. One example is Python.
https://www.pythoncentral.io/use-python-multiply-strings/
2 Likes
Better yet this would make multiplication by conditionals work with strings, and that’d save so much space
Imagine all of your story text data fitting into 4 blocks. And it takes one frame to read it.
2 Likes
Ooh yeah, just like in python with
print("Pe-trich-or! " ** 100)
There has to be a better way to do this then multiplication.
1 Like
Create a character array (String) whose size is a multiple of the string length of the string you want to multiply, iterate over it and use memcpy to copy the string into it and fill it up.
1 Like