

Please note, however, that the globals table in the world and the globals table in the console are two different tables. This is a unique table which is accessible from any running script, and it can be used to pass information between two different script instances running on a level (or in the console). In addition to local variables, you can use a special global table globals (aka worldGlobals in world scripts pre-SS4). However, a variable may be defined without the declaration – for example, if you create a handle variable using the drag-and-drop method (more on that later) – in this case you don’t have to write local anywhere. In its default implementation, Lua allows you to declare variables by just stating their name, like this: Most of the talk in this guide will be devoted to the first category, the world scripts, because these can actually operate with the entities in the game world and affect gameplay. Technically, the console in the Serious Engine games is just a big Lua interpreter. a running level, and are “tied” to itĬonsole scripts, on the other hand, are running continuously while the game is running, independently from the levels and what happens in them, and they can interact with the cvars (console variables) and call a number of functions, including some console-only functions (like loading/saving external text files). The very first characteristic there is to make about scripts in Serious Engine is that there are world scripts and console scripts (I’m not sure that’s what they are called, but I call them that myself). In this chapter I will cover some basic ideas and principles in a semi-structured manner.
#SERIOUS SAM 3 WALKTHROUGH CODE#
You can also find some code snippets which can help you familiarize with the syntax here: The basics You can also find some code snippets which can help you familiarize with the syntax here:

Checking other people’s scripts is a good way of expanding your understanding of the capabilities of the scripting in the game, and just a source of (possibly) valuable techniques. So if it feels too much for you at first, I recommend lurking in original CT scripts (both on levels and used for, say, enemy AI). Almost everything else is a Croteam-added construct or function, which you can find in the Serious Editor using suggestions box (section “Suggestion box”). You have your basic if-elseif-else, for and while loops, base types, functions, tables and table-related functions, strings and string-related functions, and that’s it. Reality is, the number of native Lua constructs which are available in Serious Engine can be counted on both hands: I also won’t be teaching you the basics of the Lua scripting language. Assigning and using a network descriptor.Preparing class for scripted net synchronization.

