Scripting Standards

I'd also go for teaching these code standards in our scripting documentations or in another file, but making reference to it since they're good practice =)

 
Before deciding on the line length (I'm personally for 80, but I'm still fine with 120), I think we should check if limiting it to 80 would cause issues with some scripts (too many indentation levels, or too many NPC headers too wide to fit, since those can't be split into multiple lines, and need to be an exception to the line-length rule, and would cause horizontal scrolling regardless)

 
  • Upvote
Reactions: pan
Before deciding on the line length (I'm personally for 80, but I'm still fine with 120), I think we should check if limiting it to 80 would cause issues with some scripts (too many indentation levels, or too many NPC headers too wide to fit, since those can't be split into multiple lines, and need to be an exception to the line-length rule, and would cause horizontal scrolling regardless)
Agreed. What script do we have with the most indents? Figure that'd be the best thing to test it out on.

 
npc/quests/newgears/2005_headgears.txt has a block with twelve indents, but it's inside several switch() blocks, so it'll decrease to just 7 if you use single-indentation for switch/case. npc/quests/seals/megingard_seal.txt has a line with eleven indents, and a block with ten (and those aren't heavily nested inside switch/case)

 
The longest line has exactly 120 characters.
default_biggrin.png


 
*throws note*

The script header should contain a reference to what license the script uses ("GNU General Public License version 3 or later" for all the currently-shipping scripts, unless otherwise specified). The GPL encourages us to do so, because it makes it clear what the license is, even if the file is distributed separately from the emulator.

 
*throws note*

The script header should contain a reference to what license the script uses ("GNU General Public License version 3 or later" for all the currently-shipping scripts, unless otherwise specified). The GPL encourages us to do so, because it makes it clear what the license is, even if the file is distributed separately from the emulator.
Agreed. I'll include when I do a major re-commit of all the scripts rewritten to standards.

 
Back
Top