LabBlocks
  • Appearance
  • Light
  • Dark
  • Match my system
  • Blocks
  • Cat blocks
  • Welcome screen…
  • New
  • Open an example…
  • Recent projects…
  • Load from your computer
  • Save to your computer
  • Share as a link…
  • Build plugin (.dll)
  • Undo
  • Redo
  • Clean up blocks

Making an SCP:SL plugin with blocks

1. Start with an event

Every script starts with a yellow hat block from Events. when plugin enabled runs once when the server starts your plugin. The other hats are LabAPI events, named exactly as in LabAPI: OnPlayerJoined, OnServerRoundStarted, … The everyday ones are in Events; all of them are in Player Events, Server Events and SCP Events. Not sure where to begin? File → Open an example has three finished plugins to take apart.

2. Use and change the event's information

The round reporters on an event hat, like player on OnPlayerJoined, are that event's arguments. Drag one off the hat to get a copy, then drop it into any block that needs it. set event [ ] to ( ) changes what the event does: its list shows what that event lets you change, e.g. the role a player spawns as in OnPlayerChangingRole. In events that can be stopped, use cancel this event. Do both before any wait.

3. Waits, loops and timers

wait, wait until, forever and repeat until pause just their own script, and the server keeps running (they compile to MEC coroutines). after … seconds, every … seconds and run in background start timed work without holding up the rest of the script; every runs once straight away. for each item in ( ) goes through any list: doors, pickups, the words of a command… Everything stops when the plugin is disabled, or with stop all.

4. Variables and lists

Make a Variable asks what it holds (a number, text, a player, a position, a door, a role…) and whether it is for all players (one value) or each player has their own (use [coins] of (player); a player's value is forgotten when they leave). Lists hold several things of one kind.

5. My Blocks

Make a Block creates your own block. Give it inputs (number, text, true/false, player, or any other type from the last card), drag its inputs off the define block to use them, and use the new block anywhere: in events, commands and other blocks.

6. Commands

when command [heal] runs in [Remote Admin ▾] adds your own command for Remote Admin, the server console, or the player console (typed with a dot, like .heal). Read what was typed with argument 1 or player in argument 1, answer with reply, and stop with an error using fail with.

7. Config

The Config panel on the right holds settings server owners can change in the plugin's config.yml without rebuilding. Each value has a type, a default and a description (the comment above it in the file). Use them in scripts from the Config blocks.

8. The rest of LabAPI

Effects gives and removes status effects, Damage reads and changes damage (in OnPlayerHurting) and deals your own. Every LabAPI class has blocks named as in LabAPI. The less common ones show a few and a Show all button. The big lists fold: click a class name to open it, or use Show all inside a section. Can't find something? Press / or type in Find blocks. The blocks you used last are in Recent at the top.

9. Build

Press Build .dll. If something needs fixing, the Build panel lists it. Click an issue to jump to the block. Put the downloaded .dll in the server's SCP Secret Laboratory/LabAPI/plugins/global folder (or plugins/<port> for one server only) and restart it.

10. Maps, saved values and per-item values

Make a Map (in Variables) stores a value for each key, like kills for each player. Tick Keep after the server restarts on a variable or map to save it to data.yml, and choose Each item has its own to give every item, and the pickup it turns into, its own value.

11. Player settings

The Player settings panel adds keybinds, sliders, dropdowns and more to the game's Settings → Server-specific tab. Players set them for themselves. Use them from the Player Settings blocks: when [Heal] is pressed, [Volume] of (player) and so on.

12. Saving, sharing and shortcuts

Your work is saved in this browser as you go, and File → Recent projects brings back the last few. Save to your computer makes a .labblocks file. Share as a link packs the whole plugin into a link you can paste in chat; whoever opens it gets a copy of their own. Shortcuts: Ctrl/Cmd+S saves the file, Ctrl/Cmd+Enter builds, / searches for blocks.

Build and plugin

Build

Ready

Build .dll turns your blocks into an SCP:SL plugin.

Problems appear here. Click one to jump to its block.

Plugin

Advanced

Config

Settings server owners can change in the plugin's config.yml without rebuilding. Use them from the Config blocks.

    Player settings

    Keybinds, sliders, dropdowns and more that each player sets for themselves in the game's Settings → Server-specific tab, under your plugin's name. Use them from the Player Settings blocks.