Bad Boy JH
2010-12-08 22:21:16
This is going to be a list of little tips and tricks to help you increase your scripts readability, and most will help you script.
Tip 1 : Constants
Constants are my best friend when I script.
When you want to open a bank, and each player has a different bank location, you might use
Tip 2 : function Load____(Which____: Integer)
When I write any script, I use functions like, LoadPath, LoadDTM, and these basically have all the DTMs stored in 1 function, and I can call them quickly, without pasting the code everywhere. If something changes, its easy to find and change, without searching through my code.
Also, rather than using Integers eg
LoadDTM(0)
combine with Tip 1 and use
LoadDTM(IronOre).
At this stage, this will do me, If anyone else has input, add it in.
Tip 1 : Constants
Constants are my best friend when I script.
When you want to open a bank, and each player has a different bank location, you might use
R_OpenBankBoth(Players[CurrentPlayer].Strings[0]);I have at the top of my scriptconst
whichBank = 0so when I use it in my script, I can useR_OpenBankBooth(Players[CurrentPlayer].String[WhichBank]);This helps me remember which variable I am using, and to not accidentaly use one I already have used. It also helps people read your script.Tip 2 : function Load____(Which____: Integer)
When I write any script, I use functions like, LoadPath, LoadDTM, and these basically have all the DTMs stored in 1 function, and I can call them quickly, without pasting the code everywhere. If something changes, its easy to find and change, without searching through my code.
Also, rather than using Integers eg
LoadDTM(0)
combine with Tip 1 and use
LoadDTM(IronOre).
At this stage, this will do me, If anyone else has input, add it in.