Hopscript: Hopscotch Text Language (Concept)

Though, wow, now that I think about it, writing it in Rust as opposed to Python could be interesting… Wow, imagine full type safety built into the transpiler, and all those language features…

Being able to write script and transpile it into however many blocks you want is the dream here! Kinda like macros for everything besides abilities (EDIT: and loops too).

Good luck on the prototype!!

4 Likes

well abilities would be their own .py files, so yes you would write each ability’s blocks

yeah but problem is HS doesn’t have type safety lol

Thanks! I think I know how I want to deal with nested abilities too which is cool

5 Likes

lol yeah that’s fair. It’s a lot like JS…

I think you were onto something when you were initially making those JS prototypes, actually. Hopscotch itself runs on JS, so you would get it 1:1 with the interpreter it runs if it were run, say in node.js? That’s a theory though, you know better lol

Like, with linting and all that dynamic stuff.

4 Likes

I’ve been wanting to make a player mod to run hopscotch projects with node, but i didn’t get very far at all before getting distracted by something completely different. But yeah it would definitely be very cool to do.

5 Likes

Again, I’m just talking about the transpiler here. Not the runtime! Just some way to get live feedback on my code with ESLint, if that’s at all how Hopscotch works in relation to JS and its variables. It just sounds cool. :')

But yeah your idea is cool too!

4 Likes

Stuff like… writing TypeScript and converting it into JavaScript. I dunno. Rhetorical situations like that which would let me scale my Hopscotch code in the first place so I can use it for tooling (external editors… like a level editor program for the PC that spits out Hopscotch code, written in Electron, or maybe Tauri!)

For this specific idea, I’m assuming that because Hopscotch runs in the browser, and it runs with a canvas, it probably handles variables similarly with all the weird “undefined” behavior that happens with Hopscotch’s very loose type systems.

Shoutouts to sometime in 201X, the time when Valgo placed a number value into a Color block to make a custom color. Before custom colors were even added as their own block in the first place. :D

4 Likes

It’s actually particularly harder with JS than a language like Python because JS doesn’t let you do things like operator overloads. You are basically limited to strings since .valueOf() is called when you add things together, which as you imagine can be a pain

Python operator overloads means that if you, for example, add an operator to another operator, you can return a third operator that contains both previous ones in one parameter

4 Likes

Yeah language features are a big plus in comparison. And that’s sort of what I was getting at with Rust, in a way.

And speaking of that - packages. It’ll be so cool!!! Seriously, with Python you can do some crazy things that would be tremendously more annoying to implement with a dedicated programming language, ie. Hopscript.

This is probably possible using Python and a Hopscotch API layer: Imagine making a Google clone on Hopscotch built with premade scraped web data, using BeautifulSoup and requests, and then converting that into Hopscotch objects semantically to display webpages. I would be awestruck lol. Those auto pixel art scripts are just the tip of the iceberg at this point.

I guess that raises sort of an ethical question too, though… Stuff like people not liking pixel art scripts because they’re low effort. But I would just use it to make cooler projects lol
I will never stop quoting BaS’s MIDI hack and how much it blew my mind then. lol

4 Likes

Woah yeah.

As long as you make the package call the same functions as the rest of the Py/HS library with its parsed data, yes you can.

So yes, you absolutely can run any python code, as long as it returns all the stuff and calls the hopscotch block functions when the main script is run.

Pioneers, always special. Hopefully a similar feeling to finally editing on the web!

7 Likes

would you mind if i try to make my own?

3 Likes

I mean up to you but once I have the basics all working, mine will be open source

5 Likes
"conditionals" are working


if/else working as well. not the best syntax ever created, but working with language limits here...

I may or may not enforce using ELSE with check_if_else instead of any conditional control, but not right now

ELSE will force you to put it under a conditional control though

also double nesting is not any harder than single nesting

5 Likes
variables working :<sdalkghk>D

Syntax for other types of variables:

Edit: and trails and other nested blocks
next is probably traits or something idk

Edit 2 (2023-10-14T15:13:00Z):

Conditionals by calling functions are working, but not by the natural syntax yet


Generated by with check_once_if(condition_equals(self.letter, 'A')):
Natural syntax refers to with check_once_if(self.letter == 'A'):

Edit 3: traits are working

5 Likes

unfortunately there are compromises to make still despite the flexibility given:

It’s not possible to override and and or, so you will have to write conditionals like this using the bitwise operation (single ampersand &), and the conditions will have to be individually parenthesized.

I can also make a function that takes two params available like this:
AND(self.letter == 'A', self.letter == 'C')

However, I think this is less readable because you want to see the and between the two conditions

  • make it available (give the option)
  • just stick with (condition) & (condition)
0 voters

I may also consider completely getting rid of the “check if else” method, and making it so that this automatically converts the check once if to a check if else.

  • Allow check_once_if and check_if_else to be used with ELSE(): (current)
  • Force check_if_else as the only thing to use with ELSE()
  • Get rid of check_if_else, and just use make ELSE() automatically change the check_once_if to a check_if_else
0 voters

@Good-Es ↓↓ Share thoughts below ↓↓

8 Likes

This is kind of why for my one I’m doing as a library.

1 Like

wdym?

3 Likes

I’m making a version of this in c# as a library. You can have all your c# code and just use my library to add blocks and compile it.

Builder.SetColour(#ffffff)

Conditionals would be for the user to make in c#

1 Like

yeah that’s exactly what I’m doing. I’m not sure if you thought I was doing something different.

I was just showing screenshots of code that the user would write. The library automatically converts all of the python code, including the conditionals I wrote, to HS JSON and runs a player with it.

Nothing is stopping a user from still writing python conditionals, it’s just that you have to write them differently if you want it to build into HS code. It’s a library rather than a compiler, so it has to be called

3 Likes

Ah ok. It seems I misunderstood, I thought you were making a language in python

2 Likes

omg getting rules to work is unbelievably painful because it supporting things like object references before the classes load (which don’t exist).

i.e. when self.letter == stage.object2.width means:

  1. I have to resolve self to something. It doesn’t exist yet because the class is still being initialized
  2. stage.object2 cannot reference object2 yet because objects only are resolvable once all of them have been loaded onto the “stage”
  3. getting .width requires an object ID, which requires an object reference (above) that doesn’t exist yet


i.e. this – the rule is defined in the decorator, which runs as the class gets defined ^^

still working on the self part

4 Likes