97
« on: June 11, 2015, 10:18:25 AM »
Datablocks are objects (clusters of information) that are downloaded by clients when they connect. Once the game starts, they cannot (or should not) be changed. For example, the wand item has two primary datablocks, one which is the item when its on the ground or spawned from a brick ('item'), and one which is when its in a players hand ('image'). The image datablock has all the data about how the weapon fires, like if you click and hold if it keeps firing automatic, or if you've got to click and release each time.
The main advantage of them is that clients can do some 'client sided prediction' to predict what will happen when doing things, to significantly reduce the effects of lag. The client doesn't need to be told that when they fire the weapon, it plays a set animation, then produces particles, then fires a projectile, because the client already knows that it should do that.
Script objects are more complicated, but very useful to the intermediate coder. If you're at the point where you are coding full add-ons (with the exception of mainly copy-paste add-ons, weapons, particles), and have not learnt about script objects, I seriously recommend that you learn them. They completely changed how I coded things, and allowed for a whole ton of new opportunities.
A function is a collection of code that you can run from anywhere. They are a basic programming concept, so you can just use google to find your answer.