Editing An Introduction to Squirrel

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 13: Line 13:
* [https://developer.valvesoftware.com/wiki/Team_Fortress_2/Scripting/VScript_Examples/en VScript Examples]
* [https://developer.valvesoftware.com/wiki/Team_Fortress_2/Scripting/VScript_Examples/en VScript Examples]


To get set up, navigate to your tf/ directory and add a scripts/vscripts folder if it doesn't already exist and create a file with any name with the extension .nut. (Mine will be named testing.nut)
To get set up, navigate to your tf/ directory and add a scripts/vscripts folder if it doesn't already exist and create a file with any name with the extension .nut.
 
You should have a location something like this: C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\scripts\vscripts\testing.nut
You should have a location something like this: <pre>C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\scripts\vscripts\testing.nut</pre>
 
Go ahead and launch your favorite Source game which supports VScript and load into any map on a local server, then bind any key to <code>"script_execute testing"</code>.
 
For example: <code>bind 5 "script_execute testing"</code>


Go ahead and launch your favorite Source game which supports VScript and load into any map on a local server, then bind any key to "script_execute testing".
For example: bind 5 "script_execute testing"


Tab out of your game, open your .nut file and type:
Tab out of your game, open your .nut file and type:
Line 28: Line 25:
</syntaxhighlight>
</syntaxhighlight>


<code>'''printl'''</code> is a function that prints to the developer console, we'll go over what functions are and the syntax for it later in the guide, for now just follow along. After saving the file and pressing our script button in-game, you'll see <code>Hello World!</code> in console.
This prints the text "Hello World!" to console, we'll cover what all this means later, for now this is just to make sure you have a set up to test with as you read through the guide.
 
You just made your first program in VScript! To get started with the guide, choose a chapter in the table below. Make sure to tinker with the examples in the guide to see first hand how Squirrel works!
 
Good luck!




Please note that all contributions to SigMod are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see SigMod:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)