You can GET or SET a value into an objects string field or a variable.
Fields you would most often want to use this on are: matvals,skillvals,pocket,slot1,slot2,slot3 however there is no restriction.
Yes pocket is a new field for an object.. I will promote this instead of pocket variables.. maybe replace them all-together.
Syntax: value of {thing} set|get {key} = {value|$variable} [by {delimiter}]
You are iether setting a key=value pair into a string or getting the value for the key from a string.
You can use iether an object's field eg $actor's slot1 or any variable name.
You should not enclose the key in quotes.. however you can use a variable to indiacate the key.
You should enclose the value in quotes, or use a variable.
('value of' or 'value for') should both work
(get, var or read) all put the value int the variable
(set, put, update or write) all set the key=value par into the string
(=, to, as, with) can all be used to seperate the key from your value.
So technically:
value for $thing write mouse as "cute";
is the same as:
value of $thing set mouse = "cute";
(I just havnt tired any of the variations yet)
Some examles:
$pop = "mouse=no";
value of $pop set baloon to "yes";
$pop is now "mouse=no,baloon=yes" with commas used by default
Lets try and read the values of 'mouse' and 'baloon' from $pop using default delimiters:
value of $pop get mouse to $answer;
print "Will the mouse pop? $answer";
value of $pop get baloon to $answer;
print "Will the baloon pop? $answer";
Lest now save our pop string as a value into another string:
$purr = 'cat=yes,frog=no';
value of $touch set prick to $pop by |;
value of $touch set stroke to $purr by |;
$touch now has two sets of delimited strings.. the outer is delmited by | and the inner by ,
it looks like this:
"prick=mouse=no,baloon=yes|stroke=cat=yes,frog=no"
Nested key=value pairs do look odd with key=key=value, but it all makes logical sense and is quite readable.
Be very careful about reading back values.. if you want to read back the value for 'cat' you first have to read the value for 'stroke' delimited by | then you can get to te 'cat' delimited by ,
Confusingly, but no-doubt useful, we can do this again.. and again, using different delimiters.
Any string can act as a delimiter so:
value of $thing set mouse to "cute" by _ZZZ_;
value of $thing set slug to "slimy" by _ZZZ_;
would give us "mouse=cute_ZZZ_slug=slimy"
Delmiters I have tried are: ( , | ^ * % # and _ZZ_ ) and by all acocunts you can use almost anything for a dlimiter.
You cant use = as a delimiter (as it is used to seperate keys from values) - Im not sure of any other limitations as yet.. but I would avoid " ( ) just to be on the safe side..but feel free to test these.
Maybe there is some sense in using number bats ^1^ ^2^ ^3^ as delimiters to indicate the nesting level.. we might have to set some guidelines on this.
$sample = "prick=mouse=no^1^baloon=yes^2^stroke=cat=yes^1^frog=no";
In general the outer-most delimiter should be commas, so things like pocket variables can be used simply by all and sundry: value of $actor's pocket set gmt = "9.5";