Skip to content
WlodekM edited this page Feb 20, 2025 · 4 revisions

bsl (backslash script) is a programming language made by me :3 for making backslash projects

it is inspired by c like programming languages such as javascript, javascript and javascript

the super awesome bsl tutorial

basics

including

in backslash every* block needs to be included first

the inclde format looks like this

#include <"INCLUDETYPE" "PATH/URL">

example:

#include <"blocks/js" "tw-blocks/blocks_vertical/control.js">

this will include the control category from turbowarp

base.js

but what if you dont want to include every single category from scratch, thats why i made base.js!

just add this to your code

#include <"blocks/js" "base.js">

and all scratch blocks will be included in your code

hats

hat blocks are the start of execution in scratch, blocks like when greenflag clicked, when i receive [v event] and such

the sytax for them looks like this:

event_whenflagclicked() {
    // ...
}

but what if you dont want to type all that for just a simple when greenflag clicked, thats why i added gf {}

instead of doing all that just add this

gf {
    // ...
}

reporters

reporters are the basic, everyday blocks, like move (steps) steps

the syntax for them is like calling a function in most programming languages

OPCODE(ARG1, ARG2, ...)

for example:

motion_gotoxy(5, 5)

opcodes are usually similar to the block's name in the editor but they can be different, that's why i recommend using the bsl VSCode extension

branch blocks

branch blocks (eg. if, ifelse) are like reporters but they also have branch inputs that you can put blocks in

the syntax is also fairly simple

OPCODE(ARG1, ARG2, ...) {
    // ...
}

for example:

control_if(true) {
    // ...
}

if there are more branches just add them after

example:

control_if_else(false) {
    // ...
} {
    // ...
}

variables

variables are declared using the var keyword and by default are local (only for the sprite running the code), to make global variables use global var instead of var

example

var a = 0

use vars by uh using their name, its literally like every programming language ever

looks_say(a)

advanced stuff

custom blocks

to make a custom block do this

fn blockNameHere(arg1, arg2, etc) {
    // looks_say(arg1 + arg2) or something
}

use it like a reporter

Clone this wiki locally