New Stuff Mods List Register

Creating your first mod


Creating a mod in Shroud of the Avatar is easy.

Open up the folder "C:\Users\your user\AppData\Roaming\Portalarium\Shroud of the Avatar" or just type %AppData% in the address bar (for Windows users) to save some click. The folder could be hidden, make sure to be able to see all folders. You can search google on how to see hidden folders on Windows about this.

Once in the folder, you should have Lua folder in there, if not create it (the game should create it for you). This will be the folder used to place all your mods. Any .lua file extension in that folder will be executed when the game start. If a .lua file is placed into a subfolder, it won't be automatically loaded.

Now that you know this, you must know that there is a hierarchy to follow in order to send your mod to this site.
Read more about this in the Uploading to this site page

So now that you know the emplacement of the files i suggest you read the section below then jump into the scripts examples to have an idea how to start writing code. If you really have no idea about programming i suggest you to read this entire webpage here: Crash Course. It's fun, easy to read and you will learn alot. Pressing escape on that webpage will pop a live lua console and text editor on top of the screen to test out the examples given in the page, really cool!

Debugging


If the script ever hang up, or you want to simply restart it because you have changed code in it, you can type /lua reload in the game chatbox.

There is a couple way to know what went wrong while creating your mod.

First one is to use the chatbox which could also be used to write command line text or show some help for the user.

To enable Lua in chatbox, click the cogwheel on the chat tab and check Lua like shown below.




The second way is to use the debugger from the game. If you write /debug in the chatbox, a menu will appear up top of your screen, you can click that and the message to see what's going on. Type /debug again to make it disappear. It's not super verbose to view error this way as the game will often throw encoded/compressed errors code we can't easily read on client.

The correct method would be to use the assert function from lua and enable Lua in chatbox to view the errors message or simply to debug and know where your code is blocking by adding a couple ShroudConsoleLog function.

Creating mods in harmony with others


If you don't want to end up being the bad guy that broke everything on a user computer, you will have to follow some rules. This is some 'check' points you have to keep in mind while creating a mod. Here is the list:

  • Make sure your mod contains all 4 global functions (as shown in the API References).
    This cause problem when having multiple mod are installed and one of them don't have it all.

  • Look in the scripts examples section on how to start mod once the game is loaded to prevent mods from appearing on loading screen.

  • Use local functions and name them with the name of your mod at the beginning. With this pattern, you won't interfer with other mods function. Look at scripts examples for more details.

  • If you are using io to write data, please make sure to only write in your main folder of your mod.

  • TEST your mod before sending it publically. You don't want your modding reputation to look bad with a mod that freeze everyone screen, right?

That's about it! Happy modding!