Best Practices: Prefix Variables in Papyrus?

Post » Sat Nov 17, 2012 11:08 pm

I've noticed in script examples that variables and properties are often prefixed with ak, ab, r, etc. (i.e. akActor). I'd like to keep my scripts neat and organized, can anyone tell me what the best practices are for naming variables/properties and what the common prefixes are/stand for?
User avatar
Dean Brown
 
Posts: 3472
Joined: Fri Aug 31, 2007 10:17 pm

Post » Sat Nov 17, 2012 8:33 pm

If you want to use Hungarian-style prefixes, there's a thread http://www.gamesas.com/topic/1380379-meanings-behind-papyrus-script-variable-naming-conventions/page__p__20913249__hl__unsigned__fromsearch__1#entry20913249 giving our best guesses about Bethesda's. I don't think there is a consensus in the modding community about how things should be named.
User avatar
Emma-Jane Merrin
 
Posts: 3477
Joined: Fri Aug 08, 2008 1:52 am

Post » Sat Nov 17, 2012 2:50 pm

thank you Ingenue. that's kinda annoying there's no consensus on naming conventions. Perhaps we should start standardizing them, it would make reading and writing scripts a lot easier imho.
User avatar
Kira! :)))
 
Posts: 3496
Joined: Fri Mar 02, 2007 1:07 pm

Post » Sat Nov 17, 2012 1:29 pm

From all the people reading your scripts you are the only one that need to be confortable with your code. Unless you are working with other scripters, you should use the convention that adapt best to your own style. Unless you are planning to create a script library modders resource. But it's a bit early for something like that.
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Post » Sun Nov 18, 2012 12:39 am

that's kinda annoying there's no consensus on naming conventions. Perhaps we should start standardizing them, it would make reading and writing scripts a lot easier imho.
There's already a standard for argument/variable nomenclature which is consistent in, at least, Beth's scripts:

a : Argument :: b : Bool :: f : Float :: i : Int :: k : Form/Alias :: r : Reference :: s : String :: u : *Unsigned Integer

*"Papyrus doesn't have an unsigned type, but the game will take your value or 0, whichever is higher." (Jeff Lundin)
User avatar
Johanna Van Drunick
 
Posts: 3437
Joined: Tue Jun 20, 2006 11:40 am

Post » Sat Nov 17, 2012 10:40 am

Awesome! Thanks JustinOther!
User avatar
Syaza Ramali
 
Posts: 3466
Joined: Wed Jan 24, 2007 10:46 am


Return to V - Skyrim