SettingsItemclass | settings.t[65] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
Note that we don't make any assumptions in this base class about the type of the value associated with this setting, how it's stored, or how it's represented in the external configuration file. This means that each subclass has to provide the property or properties that store the item's value, and must also define the methods that operate on the value.
If you want to force a particular default setting for a particular preference item, overriding the setting stored in the global preferences file, you can override that SettingsItem's settingFromText() method. This is the method that interprets the information in the preferences file, so if you want to ignore the preferences file setting, override this method to set the hard-coded value of your choosing.
class
SettingsItem : object
SettingsItem
BinarySettingsItem
StringSettingsItem
exitsMode
footnoteSettingsItem
factoryDefault
includeInListing
settingDesc
settingID
restoreItem
saveItem
settingFromText
settingToText
factoryDefault | settings.t[180] |
includeInListing | settings.t[109] |
settingDesc | settings.t[101] |
settingID | settings.t[89] |
The ID should be chosen to ensure uniqueness. To reduce the chances of name collisions, we suggest a convention of using a two part name: a prefix identifying the source of the name (an abbreviated version of the name of the library, library extension, or game), followed by a period as a separator, followed by a short descriptive name for the variable. The library follows this convention by using names of the form "adv3.xxx" - the "adv3" prefix indicates the standard library.
The ID should contain only letters, numbers, and periods. Don't use spaces or punctuation marks (other than periods).
Note that the ID string is for the program's use, not the player's, so this isn't something we translate to different languages. Note, though, that the configuration file is a simple text file, so it wouldn't hurt to use a reasonably meaningful name, in case the user takes it upon herself to look at the contents of the file.
restoreItem (s) | settings.t[140] |
This implementation is suitable for any scalar type, so this won't need to be overwritten for subclasses that only need to load a single string value from the file. Subclasses that implement complex (non-scalar) datatypes can override this as needed to read multiple line items from the file.
saveItem (s) | settings.t[162] |
This implementation is suitable for any scalar type, so this won't need to be overwritten for subclasses that only need to store a single string value in the file. Subclasses that implement complex (non-scalar) datatypes can override this as needed to manipulate multiple line items in the file.
settingFromText (str) | settings.t[128] |
This is only needed if the default restoreItem() method is used.
settingToText ( ) | settings.t[119] |
Note that this is only needed if the default saveItem() method is used.