I gave reformatting and organizing the tutorial a go. It's not complete so feel free to add on/modify stuff for correctness.
Tendon's Console Tutorial
Introduction While knowledge of the console is not necessary to have fun in Blockland, it will allow you to do much more.
Accessing the Console
To access the console in Blockland, press the tilda (~) key while in-game. This key is located below escape, at the top-left of your keyboard.
Basic Concepts
Client- a person's connection, or
Game Connection, which stores information such as their name, game settings, etc. If you delete this the person will be removed from the game.
- client.player will get you the client's corresponding player object
Player- the little blockhead dude you see in the game. The Player has health, a position, and items.
- player.client will get you the player's corresponding client object
Object ID- a non-negative integer assigned to all objects. You can use in the console to mess with an object.
- /getID- returns the ID of the object you're looking at
- Object ID's are assigned in the order the objects are created
- Object IDs should bot be confused with Blockland IDs. A blockland ID is basically just an invoice number.
An object can be modified if you know it's ID number. However, we can't use /getid on a client object, gui element, or any other non-visual object. In order to get these IDs, we must learn about SimGroups.
SimGroups- Simulated groups that are basically just information directories.
- ClientGroup- the SimGroup for clients
Knowing this,
ClientGroup.getObject(0); will return the object ID of one of the clients currently in the game.
ClientGroup.getObject(1); will return the next client (if it exists), and so on. However, nothing will appear in the console just by typing this in. We haven't told the console what to do with this information.
Functions- Operations that perform a task
- Function names are always followed by an open parenthesis, any arguments, and a closed parenthesis
- getObject() is a function
echo()- A function that prints the given value out to the console
- echo("hello") would print out the string "hello" in the console
To view the object ID of the first object in the ClientGroup, we would use
echo(ClientGroup.getObject(0));Fields- Elements attached to objects
- player.position- position is a field of player
Adding your own fields to objects is simple.
findclientbyname("Name").fieldname = "value";
This would add a field "fieldname" to the specified client object, and set its value to the string "value"
Server Applications
1. DeletingDeleting is one of the most basic applications of the console. Type /getID to get the ID of the object you're looking at. Then use
<objectID>.delete();
to remove the object from the game. (Replace <objectID> with the integer value provided by /getID)
2. TeleportationA simple first application of the console is teleportation. To teleport someone, we need to first find the player object we want to teleport. This can be done by finding the client with specified name, then retrieving the player field of that client. After we have the player, we then need to access the position field of the player and set it to our own value.
To teleport a player 20 brick studs above the center of the world, use:
findclientbyname("Name").player.position = "0 0 10";
But what if we want to teleport someone upwards from their current position? Then we would need to set their transform to their current position vector added with the vector in the direction we want to teleport them.
findClientByName("Name").player.setTransform(vectorAdd(findClientByName("Name").player.getPosition(), "0 0 10"));