I promised someone a basic walkthrough into Lavishsettings...
But I thought others might find it useful so I'm posting it here.
An introduction to Lavishsettings by Mycroft
LavishSettings don't use a variable to access a particular bit of information in a settings file.
What they use is Pointers , these pointers locate where the information you want to access is held in RAM.
LavishSettings files have 'levels'
Level 1 is the Master Pointer to the 'top' of the Data it's similar to naming an array.
Level 2 are Sections within the 'dataset'.
Level 3 could be sub-sections within the Sections..
For example, using the Myprices script.
I name the data as a whole as myprices.
The data has several Sections (sets).
General where the script settings are saved.
Item Where the sale item details are saved
Buy Where the Items you want to buy are saved.
I have to define reference pointers to keep track of where the sections (sets) are held in memory.
So at the top of the script outside the main function I use
I then have to create the LavishSettings template for the information to be stored in.
I then have to put the memory location of each of these into the reference pointers we defined earlier.
To do this we use the FindSet command.
This puts the location of the created Sets into the reference variables.
Adding/Updating Data into each Set.
To add a setting outside the General,Item or buy Sets you would use the AddSetting command
What you are saying here is Add to the myprices (global) set a Setting Named AutoRun and set it to the value held in variable ${autorun}
To add a 'Setting' into The General Set for example...
So to add a bool variable "MatchLowPrice" as a setting into the General Set you would use.
Assuming you had a bool variable named matchlow which held the information.
What you are saying here is Add to the General set a Setting Named MatchLowPrice and set it to the value held in variable ${matchlow}
To read that Setting from the information in the General Set you use FindSetting
What you are saying above is , Look in the General Set for a setting named MatchLowPrice and put it in the variable matchlow.
Saving your data.
To save your Sets and settings you use the command Export
So to save the myprices set (Everything including all the General , Item and Buy Sets).
This will save everything in the myprices set as a whole.
To Load your sets into memory you use the command Import
This takes your data file and slots all the information into the correct Sets ready to be read and manipulated.
Clearing the data from your RAM
When you exit the script , the data is still held in RAM , it needs to be cleared , usually this is done using the atexit atom
Hope this helps...it's not everything but should get someone started.
But I thought others might find it useful so I'm posting it here.
An introduction to Lavishsettings by Mycroft
LavishSettings don't use a variable to access a particular bit of information in a settings file.
What they use is Pointers , these pointers locate where the information you want to access is held in RAM.
LavishSettings files have 'levels'
Level 1 is the Master Pointer to the 'top' of the Data it's similar to naming an array.
Level 2 are Sections within the 'dataset'.
Level 3 could be sub-sections within the Sections..
For example, using the Myprices script.
I name the data as a whole as myprices.
The data has several Sections (sets).
General where the script settings are saved.
Item Where the sale item details are saved
Buy Where the Items you want to buy are saved.
I have to define reference pointers to keep track of where the sections (sets) are held in memory.
So at the top of the script outside the main function I use
Code:
variable settingsetref General
variable settingsetref Item
variable settingsetref Buy
I then have to create the LavishSettings template for the information to be stored in.
Code:
; Main LavishSettings Pointer
LavishSettings:AddSet[myprices]
; Pointers to Datasets inside the myprices Setting 'array'
LavishSettings[myprices]:AddSet[General]
LavishSettings[myprices]:AddSet[Item]
LavishSettings[myprices]:AddSet[Buy]
I then have to put the memory location of each of these into the reference pointers we defined earlier.
To do this we use the FindSet command.
Code:
Item:Set[${LavishSettings[myprices].FindSet[Item]}]
Buy:Set[${LavishSettings[myprices].FindSet[Buy]}]
General:Set[${LavishSettings[myprices].FindSet[General]}]
Adding/Updating Data into each Set.
To add a setting outside the General,Item or buy Sets you would use the AddSetting command
Code:
LavishSettings[myprices]:AddSetting[AutoRun,${autorun}]
To add a 'Setting' into The General Set for example...
So to add a bool variable "MatchLowPrice" as a setting into the General Set you would use.
Assuming you had a bool variable named matchlow which held the information.
Code:
General:AddSetting[MatchLowPrice,${matchlow}]
To read that Setting from the information in the General Set you use FindSetting
Code:
matchlow:Set[${General.FindSetting[MatchLowPrice]}]
Saving your data.
To save your Sets and settings you use the command Export
So to save the myprices set (Everything including all the General , Item and Buy Sets).
Code:
LavishSettings[myprices]:Export[${filepath}filename.XML]
To Load your sets into memory you use the command Import
Code:
LavishSettings[myprices]:Import[${filepath}filename.XML]
Clearing the data from your RAM
When you exit the script , the data is still held in RAM , it needs to be cleared , usually this is done using the atexit atom
Code:
atom atexit()
{
if !${ISXEQ2.IsReady}
return
LavishSettings[myprices]:Clear
}
Hope this helps...it's not everything but should get someone started.
Last edited: