An Introduction to Squirrel: Difference between revisions

From SigMod
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Overview ==
== Overview ==
This is a relatively brief beginner's guide to the Squirrel language (v3.2) aimed at people with no programming experience interested in trying their hand at [https://developer.valvesoftware.com/wiki/VScript VScript]. While this guide is not technically specific to any Source game in particular, it is for version 3.2 which is unique to TF2's version of Squirrel (L4D2, Portal, etc. run on older versions of Squirrel), so in practice this guide is directed at TF2 players.
This is a relatively brief beginner's guide to the Squirrel language (v3.2) aimed at people with no programming experience interested in trying their hand at [https://developer.valvesoftware.com/wiki/VScript VScript]. The only prerequisite knowledge you are expected to have is basic knowledge of the Source engine (entities, I/O system, etc). While in theory this guide is not technically specific to any Source game in particular, it is for version 3.2 which is unique as TF2's version of Squirrel. L4D2, Portal, and other Source games run on older versions, so in practice this guide is directed at TF2 players. If you're following this guide for another Source game that's perfectly fine, just be aware that some features may not function or behave differently in your game's version of Squirrel.


If you already have experience with C-like languages or programming in general I would recommend you visit the [http://squirrel-lang.org/squirreldoc/reference/index.html Squirrel Reference Manual] for a more expedited learning experience.
If you already have experience with C-like languages or programming in general I would recommend you visit the [http://squirrel-lang.org/squirreldoc/reference/index.html Squirrel Reference Manual] for a more expedited learning experience aimed at developers.




== Getting Started ==
== Getting Started ==
While it's possible to compile the Squirrel source code into binaries so that you can test your code outside of a Source game, it's really not too much trouble to launch TF2 and
While it's possible to compile the Squirrel source code into binaries with which you can test your code outside of a Source game, simply launching a game and executing your script is much simpler and allows us to test game specific code, so that's what we'll do for the duration of the guide. For guides on VScript itself, the VDC


== Keywords and Identifiers ==
== Keywords and Identifiers ==

Revision as of 01:17, 26 October 2023

Overview

This is a relatively brief beginner's guide to the Squirrel language (v3.2) aimed at people with no programming experience interested in trying their hand at VScript. The only prerequisite knowledge you are expected to have is basic knowledge of the Source engine (entities, I/O system, etc). While in theory this guide is not technically specific to any Source game in particular, it is for version 3.2 which is unique as TF2's version of Squirrel. L4D2, Portal, and other Source games run on older versions, so in practice this guide is directed at TF2 players. If you're following this guide for another Source game that's perfectly fine, just be aware that some features may not function or behave differently in your game's version of Squirrel.

If you already have experience with C-like languages or programming in general I would recommend you visit the Squirrel Reference Manual for a more expedited learning experience aimed at developers.


Getting Started

While it's possible to compile the Squirrel source code into binaries with which you can test your code outside of a Source game, simply launching a game and executing your script is much simpler and allows us to test game specific code, so that's what we'll do for the duration of the guide. For guides on VScript itself, the VDC

Keywords and Identifiers

Constants

Comments

Data Types

Literals and Operators

Expressions

Intro to Functions

Intro to Objects

Scope

Control Flow

Exceptions

Enums

Arrays

Tables

Functions

Generators

Delegation

Weak References

Classes

Inheritance

Metamethods