R4bitF00t Posted January 16, 2024 Share Posted January 16, 2024 (edited) Before we can start scripting, we need to have a script editor. While you can use any text editor to create BattleForge scripts, there are some widely used, free text editors, that make scripting incredibly easier. We will look at one popular text editor that is used to edit BattleForge scripts - Notepad++. For advanced users, I will direct you to Visual Studio Code. If you are already familiar with BattleForge scripting editors, you can skip to the next part HERE, where I explain the principles of BattleForge scripting. If you encounter any issues, don't hesitate to ask in Skylords Reborn Map Making Discord. • Content File extensions Notepad++ Visual Studio Code Next Chapter • File Extensions First thing you will need to do, is to enable file extensions in Windows. With this option enabled, you can create a text file in your script folder and rename it with the .lua extension. Windows will ask you if you want to change the file type - just confirm, and you will have created a Lua script. To enable the file extensions, follow these instructions. Windows 10 Windows 11 • Notepad++ You can download Notepad++ HERE. It is a simpler text editor, more suited to beginners. After installation, we will need to set up the Notepad working language and the most important thing - Snippets. To set the script language in Notepad++ to Lua, go to Language -> L -> Lua in the top toolbar. Once you've done that, download the following RAR file. It includes the Snippet libraries. NotepadSnippets.rar Quote Note: If you don't have WinRAR. Here are the Snippet libraries separately. BF-Actions.sqliteBF-Conditions.sqliteBF-Conditions-Negated.sqliteBF-Events+State+Outcries.sqliteBF-WarfarePatterns+SpawnWaves.sqlite What are Snippets? They are a collection of pre-written lines of code. You can browse through a list of them, find whatever action or condition you need and simply insert it into your script. Quote Note: Some people feel bad when they don't write everything manually. I am one of them. But in this case, I strongly encourage you to use the snippets. There are some actions and conditions with around 6-10 parameters, and remembering any of it is quite tough. You will spend most of your time scripting the basic functionalities anyway, so using snippets is still better than writing the same lines of code hundreds of times. Now that you have downloaded and extracted the snippet libraries, we might need to download the Snippet plugin. Don't worry, it's quite easy. In Notepad++ go to Plugins -> Plugins Admin... In the Available tab, search for Snippets. Select Snippets in the list by checking the small box on the left and click the Install button at the top right of the window. Now that you have installed the Snippets plugin, you can open the Snippets tab Plugins -> Snippets -> Snippets A Snippets window will appear. For now, we can only see the Templates library. We need to import our BattleForge snippets, and we do that by right-clicking the Library selection field (Templates), and selecting Import library... Then navigate to your extracted snippet library files and import them, one by one. Now, whenever you are working on BattleForge scripts, you can find the snippet you need in the corresponding library, and insert it into your script by double-clicking it in the list. • Visual Studio Code You can download Visual Studio Code HERE. VS Code is for advanced scripters with some experience. You will need at least some knowledge of BattleForge Script to use it effectively. As I don't use Visual Studio Code myself, I will direct you to Bergerb's tutorial on how to set it up HERE. Alternatively, HERE is a video tutorial for VS Code snippets by Metagross31. If you want snippets in VS Code, download this file. sr-scripting.code-snippets And put it into \AppData\Roaming\Code\User\snippets folder. • Next Chapter Now that we have our preferred script editor set up. We can move onto the script structure and basic scripting rules. • Scripting Introduction • Edited November 20, 2024 by R4bitF00t Metagross31 and Emmaerzeh like this Link to comment Share on other sites More sharing options...
Metagross31 Posted January 16, 2024 Share Posted January 16, 2024 In case you want to add a section about code snippets in VSCode and IntelliJ based IDEs, I made a video about that a while ago, maybe you find it useful 🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now