PDA

View Full Version : stringcontrol questions



Varsuuk
March 26th, 2018, 18:16
(I made the title more generic to not “waste” topic space ;) I figure if I or anyone else has stringcontrol-related questions, we can reuse the topic.)

I am trying to learn how to create rulesets so I started with CoreRPG and am layering on parts using AD&D (& 5e) and 3.5 to help me see how it is done.

I am working now on just creating a character sheet with one main tab where I have standard SIWDCCh stats and HP-related data to start. Using the layout of AD&D to help me do an initial UI since I like how that was based on 5e.

I was entering the “stringc_charclasslevel” template and came to “linesoffset” tag. I see it has a ‘mergerule=“replace” - while typing this I came to understand why this was...what it was replacing, it was setting default=“on”

This wasn’t self-evident due to the naming, but I get it now, the lineoffset is an UNDERLINE controlgraphic. It is by default not enabled/visible.

OK - leaving this question in case that helps anyone. Plus, in order to help me as I come across templates, could you explain the naming system employed in this? Sometimes knowing the Hungarian prefixes helps me suss things out.

“stringc_” the string part probably for string control. Damn, I answered everything only once I typed the question. The “c” part I thought to be a hungarian prefix, it was instead likely shortened from “control” - I am unsurprisingly verbose in variable and method naming (especially since I RARELY ever used vi to code other than minor edits, so there is easy cut and paste as well as code-completion so it set my habits and helps me document via code)


— Admin, erase this if the info is too obvious to anyone in this thread already. Otherwise, next stringcontrol question if I have any I will use this thread —

Moon Wizard
March 26th, 2018, 20:05
There’s no official variable naming per se. I used a bastardized kind of Hungarian naming in the Lua code quite a bit in order to help identify the “expected” values, since Lua is loosely typed. (s = string, n = number, c = control, w = window, v = (variable), r = record/table, a = array/dictionary)

For the template naming, it’s evolved over time. I try to prefix with the window class name (If window class specific) or the base control type (if generic, such as string). Of course, this has not been consistent, and backward compatibility limits changes. Also, stringc_ vs string_ differentiates between stringcontrol base (not database-linked) or stringfield base (is database-linked).

Hope that helps,
JPG

Varsuuk
March 26th, 2018, 22:44
Yes, yes it does indeed.

Btw, I really recommend to anyone starting to fully read the “building of the Runequest ruleset” in he “older rulesets” - it may have outdated stuff and I can’t even say what it is as I am only just starting but it has done a LOT towards making some of he concepts I read in the excellent new set of wiki docs concrete. Now I am reading API pages with better grasp after going through those two sets and there is more to go but of course I am chomping at the bit and have begun coding new functions.

My biggest problem is and will continue to be the GUI/art arrangement aspects. I plan on just throwing the uglies up so can get to the meat. If I get meat working, can clean up look to my level of skill and get suggestions/help from the more accomplished folks to make it look more like their rulesets.

But, who knows how much I will get done. The excitement and interest is there - what remains to. R seen is if I can do it fast enough with only “stolen time” :)

Varsuuk
March 27th, 2018, 05:48
So basically,
r=record/table which can have any number of objects, functions etc.
a=same basic object, the table, but where you are enforcing the concept of array (dictionary of key to single value (which can be a fancy object/table of course) using a strictly numeric key and likely one that increases monotomically.) or dictionary where no restrictions are placed on the key other than it is key to value pairs only in the table?

btw, Only one nitpick... I hate “a” prefix. But it’s on me because I worked with a guy who would put an “a” before all his arguments in the function definition and it would make me constantly read things like “aUserID”, “aAddressRecord”, etc and I’d read it as the “uh” UserID,etc ;)

Too bad c works already well for control. I generally called my datastructs with appended “container” or “store” to remain vague in implementation in case I swapped a vector or a deque or unsorted_map etc. I hate renaming and hate having cars with incorrectly encoded types (which is why I don’t hungarian in strongly typed languages - I can see advantage in Lua for sure though.)

Hmm maybe for mine I’ll just byte ;p it and go suffix like windowArray and characterMap for my local stuff.

Yes, I know, but I constantly want to read aVariableName as “a Variable Name” and I go d’oh a second later.



There’s no official variable naming per se. I used a bastardized kind of Hungarian naming in the Lua code quite a bit in order to help identify the “expected” values, since Lua is loosely typed. (s = string, n = number, c = control, w = window, v = (variable), r = record/table, a = array/dictionary)

For the template naming, it’s evolved over time. I try to prefix with the window class name (If window class specific) or the base control type (if generic, such as string). Of course, this has not been consistent, and backward compatibility limits changes. Also, stringc_ vs string_ differentiates between stringcontrol base (not database-linked) or stringfield base (is database-linked).

Hope that helps,
JPG