Aha, that’s actually pretty smart. Maybe that’s a habit to take after then.
I think though, in this case, that since I only use DamageTDoor in this script only I don’t have to…hmmm, ok, now I see more what you mean. I actually use the string two times in the script. If I were to misspell it, that would lead to unnecessary bugs, even though I, out of habit, usually copy and paste strings, to be sure of the spelling.
yep whatever you’re happy with Ag. All i can say is i used to do it that way … but overall im a deep skeptic of my ability to copy/paste code ;)
but yeh it works …
I see what you mean. It’s very easy to cause bugs in code anyway. I’ll try to make a habit of it then.
if and perhaps when you start using an IDE or mini-IDE like geany or Eclipse (?) … an added bonus is find/highlight all references. just click and bingo it shows where all those identifiers are
another bonus to const
is that if you ever want to change the value, its there in one spot to make a ‘global’ change.
I don’t know what an IDE is, sorry.
Maybe you mean like Notepad++ ? I’ve used that sometimes when I want to make sense of a longer more complicated script, or if I’ve had to correct an illusive error. That program can highlight a lot of stuff.
Short for “Integrated Development Environment”. An editor with access to helpful features and the ability to compile the edited code without leaving the editor.
Have you tried Fancy Colors - NWScript support in text editors? Adds code hilighting for Nwscript in Notepad++ amongst others. While designed for NwN, it should at least be of some use for NwN 2.
TR
I mostly just choose C as language and it highlights stuff in colors.
if you install the NppExec plugin for Np++ and have the Advanced Script Compiler executable (standalone) on your hardrive … there’s enough instructions on the Internets to wire things up and that’s a mini-IDE
code and compile .nss files outside the toolset :)
In both cases, some keywords, constants and functions were missing, so I made a version for NWN2
nwscript.zip (7.8 KB)
I also tried to regroup the constants by type and give each a different color. It’s not the most beautiful selection, but that’s very easy to correct, so here it is
I also made the corresponding autocompletion xml if you’re interested.
Thanks for all the answers! At the moment I don’t feel it necessary to have this, but who knows…if I have another script problem I might try it out.