Jump to content

Map Editor Tutorial - Script Editors


R4bitF00t

Recommended Posts

image.png.a312ef79e371481a9bc5ece8edd2ec12.png

 

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
image.png.e268e322a29eec058e7fb2ae5f05bc2b.png

  • File extensions
  • Notepad++
  • Visual Studio Code
  • Next Chapter

 

 • File Extensions
image.png.e268e322a29eec058e7fb2ae5f05bc2b.png

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.

image.png.32fc9cbb70cfd4e8d415bdee1c856864.png

To enable the file extensions, follow these instructions.

Windows 10

image.png.334ea87dd7ee74555b4445894142b3ee.png

image.png.14414ec9255c78ea8dc199512dc4f5db.png

Windows 11

image.png.04996beee267ca14caef5a59dd0cd17c.png

 

 • Notepad++
image.png.e268e322a29eec058e7fb2ae5f05bc2b.png

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.

image.png.292b25c8d9f6e48a2df47c45d6b1c7fc.png

Once you've done that, download the following RAR file. It includes the Snippet libraries.

NotepadSnippets.rar

 

Quote

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.

image.png.397efafe1389c6567ef5507cc42541e5.png

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...

image.png.b8655aae7709c9365580b7c5ab0288c5.png

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...

image.png.f0a63c725f61463c0c7a758b4db840d4.png

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.

image.png.397efafe1389c6567ef5507cc42541e5.png

 

 • Visual Studio Code
image.png.e268e322a29eec058e7fb2ae5f05bc2b.png

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
image.png.e268e322a29eec058e7fb2ae5f05bc2b.png

Now that we have our preferred script editor set up. We can move onto the script structure and basic scripting rules.

 

• Scripting Introduction

 

image.png.fc82c56b88d4373274d02434ae7374a1.png

Edited by R4bitF00t
Metagross31 and Emmaerzeh like this
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use