[BETA OUT] Scratch for Blockland

Author Topic: [BETA OUT] Scratch for Blockland  (Read 16684 times)

Can you make Weapons with these?????

This looks fantastic so far for learning Torquescript, but applying Torquescript knowledge into making add-ons is another huge step.

I've worked with numerous proprietary languages, from Torquescript, to Salesforce's Apex language, as well as numerous game's implementations of existing languages, like C# in Space Engineers. In every case, even if you have the language down very solidly, you still have to learn the softwares's API; how you interface with it. What classes are available to you to use, what function should your script call to make the software do X, what should your script hook into to detect when the software does Y, etc. And that's something Blockland/Torque doesn't do a good job explaining, and if you could find a way to do that, it would be great.

For example, it's not immediately apparent that in order to make a slash command, you make a function prefixed with "serverCmd". But rather than expecting people to know that, Gytyyhgfffff gave the idea of encapsulating that into a discrete "slash command" block.

As another example, say we want a scratch script to do something when a player talks. Maybe instead of having to create a "package" block, and then a "packaged function" block, then have to know the name of the function you need to package (serverCmdMessagesent), perhaps you could have this encapsulated into a "when a player talks" block?

The more things can be encapsulated, the better. Then, if you can provide a way of seeing in real-time what the raw code is, instead of exporting to a file and opening it, you could more easily see what the game is actually doing


This is way better than using delimiter blocks. Thanks, Gyt.

I've worked with numerous proprietary languages, from Torquescript, to Salesforce's Apex language, as well as numerous game's implementations of existing languages, like C# in Space Engineers. In every case, even if you have the language down very solidly, you still have to learn the softwares's API; how you interface with it. What classes are available to you to use, what function should your script call to make the software do X, what should your script hook into to detect when the software does Y, etc. And that's something Blockland/Torque doesn't do a good job explaining, and if you could find a way to do that, it would be great.

For example, it's not immediately apparent that in order to make a slash command, you make a function prefixed with "serverCmd". But rather than expecting people to know that, Gytyyhgfffff gave the idea of encapsulating that into a discrete "slash command" block.

As another example, say we want a scratch script to do something when a player talks. Maybe instead of having to create a "package" block, and then a "packaged function" block, then have to know the name of the function you need to package (serverCmdMessagesent), perhaps you could have this encapsulated into a "when a player talks" block?
I will be implementing these ideas soon. Thanks

... Then, if you can provide a way of seeing in real-time what the raw code is, instead of exporting to a file and opening it, you could more easily see what the game is actually doing
I have an idea of how to accomplish this:
Export the code to a temporary .CS file, and inbetween every line of code, add a function that notifies Scratch of what line the code is on, and highlight the according block.

I'm also thinking of recording what local variables are defined in the script, saving the names of them, and exporting the 'callback' with the variable names (shown below) in order to 'watch' the variables' values.
Example:

This will be exported into config/cache/scratch_exectemp.cs with the following code:
Code: [Select]
function demoFunction(%str, %len) {
   if(Scratch::lineChangeCallback(0, %str, %len)) return;
   %str = getSubStr(%str, 0, %len);
   if(Scratch::lineChangeCallback(1, %str, %len)) return;
   return %str;
}
The script is executed, and you're then given a prompt on what function to execute (there is only one in this example), and if you want to go step-by-step. A panel is shown, displaying the raw script, as well.

Code: [Select]
// Description of the line callback function
Scratch::lineChangeCallback(%lineNumber, %arg1, %arg2, %argn) -- Returns 'true' if the user wants the script to stop at that specific line
Everytime 'Scratch::lineChangeCallback' is called, the block corresponding to the line number is highlighted (along with the line on the raw-script panel display), and the function returns 'true' if the user is going step-by-step (to stop the function). The variable values are fed into the function as arguments, so you can see what their values are.

Of course, I'll have to do a little more thinking on the local-variable-watching idea, as it's not very conventional to define 'Scratch::lineChangeCallback' with a bunch of arguments.

Sorry if the above text is just me rambling incoherently, lol

To me this looks more difficult than writing code by hand.

I'd like to try it out sometime.





Script debugging & variable watching is now implemented, along with error reporting.
« Last Edit: January 05, 2018, 03:07:51 PM by RTBARCHIVE »






A spawn menu. Please tell me how the GUI looks, as I didn't ask Vitawrap for design tips this time.

[im width=900]https://cdn.discordapp.com/attachments/368146625664909324/399267632450240513/2018-01-06_11-25-48.gif[/img]
[imwidth=900]https://cdn.discordapp.com/attachments/368146625664909324/399284549567250432/unknown.png[/img]
[imwidth=900]https://cdn.discordapp.com/attachments/368146625664909324/399285334002892800/unknown.png[/img]
[imwidth=900]https://cdn.discordapp.com/attachments/368146625664909324/399285413975556106/unknown.png[/img]
A spawn menu. Please tell me how the GUI looks, as I didn't ask Vitawrap for design tips this time.
Make the Save/Export button waaaay bigger and bolder. Like, a giant ass green button that says “Export” on the right

Make the Save/Export button waaaay bigger and bolder. Like, a giant ass green button that says “Export” on the right



Blockland Scratch: Collaborative Edition




What the heck Clay why are you so rad.

Seriously though this makes code collaboration so much easier.
« Last Edit: January 08, 2018, 09:15:40 AM by rggbnnnnn »

Reminds me of craftstudio/superpowers.
Next you gotta make a collab plugin for blender.

I'm still looking for someone to compile a list of useful functions for the 'Common Functions' menu, so when that is done, I'll just pull the descriptions from that menu.
This might be a good start: http://blockdoc.block.land/index.php/Essential_Functions_List