Here is some basic stuff you should put in a new mod.
You should always use this at the start of your mod:
GROUP CLEARALL ELEMENTSCLEAR
This clear all groups & all elements.
Then if you want to have the default element appear, just add this after:
INCLUDE elements.bs2
Creating a new group will not make him appear at startup, you will have to click on a group or an element to refresh the listing.
EXEC listgroups
If you create an element and want to start with it as the default element (instead of sand).<br> First you set ELEMENT1 to the element you want, then you refresh that group listing. Like this ('MyElement' is in the 'New' group):
SET ELEMENT1:MyElement EXEC listelements GROUP:New
Sometime you may want to see what is the value of a variable in real-time. You can setup a small function that will display any var you give to the status panel.
REMOVETRIGGER debugmenu ON debugmenu STATUS CLEAR ON debugmenu STATUS ADDTEXT "FPS: " ON debugmenu STATUS ADDNUMBER FPS ON debugmenu STATUS ADDTEXT "MyVar Value=" ON debugmenu STATUS ADDNUMBER MyVar ON debugmenu TIMER 1 FRAMES debugmenu
So you can just replace MyVar by any variable you want, or add other line to see more than one variable at time.<br> To use it you just have to execute it once in your code, like at the end:
EXEC debugmenu
Here is some structure you should use to make your code easier to read.
First thing when you create a new trigger is to clear every past reference to it, you should always make a trigger like this:
REMOVETRIGGER TriggerName ON TriggerName Command
Also make your trigger in one bloc, dont make your trigger spread all over your code, keep it together.
Sieben implemented a new and easy way of creating trigger just use this syntax:
TRIGGER MyTrigger {
EXEC TriggerAction1
EXEC TriggerAction2
...
}
I highly recommend giving all your variables name some sense. It will be easier to retrieve it after or to know what was it for. Pay attention to CAPITAL letter, since BS2 is case sensitive you can easily look all night for your error to discover you forgot to put a capital letter in you variable name.