Create Variables Through Code

A feature I’d like to see in Hopscotch is:

Variable creation

I’d use it for this type of project:

A sandbox game

Here are some examples of Hopscotch code that could be improved if we had this:

It could be used as an add-on for global variables (in case they’re added). It could be used to make comment sections, IDs, Level sharing and some others

Here is an example design I’ve made:

|| When (create id) is tapped

Create variable type (global) name (:iphone:username) value ([IDcount]+1)

Increase (IDcount) by (1)

– The code above is creating a global variable with the users name. This variable is an “id”. Everytime an ID is created the variable IDcount increases, allowing more IDs to be created. Well sorry for the bad explanation.

I’ve seen something similar in another programming languages, it looks like this:

I’m not so good in other programming languages and I’m too lazy to code :no_mouth:

12 Likes

Yeah I think what might be missing in Hopscotch is the ability to create lists and arrays, which might help with some of these. You can keep adding new items to a list. So for example, with a comments section, you can store multiple comments and keep adding more.

But the ability to create variables through code is definitely really interesting too.

8 Likes

oh wait I forgot arrays were a thing lol

6 Likes

Yes I like this idea.

2 Likes