Set property: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{ #vardefine:name|set_property}}{{ #vardefine:return_type|void}}{{ FunctionPage| name={{#var:name}}| function_category=Miscellaneous| function1={{Function| name={{#var:name}}|…' |
imported>Eliteofdelete No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 20: | Line 19: | ||
function_description=Looks for a global or appropriate user preference from the saved files (found in your "Settings" directory) and if it finds one that matches, it overrides its value with {{pspan|value}}. If a match is not found in your existing preferences for {{pspan|prop}}, it will create a property with that name and set it to {{pspan|value}}.| | function_description=Looks for a global or appropriate user preference from the saved files (found in your "Settings" directory) and if it finds one that matches, it overrides its value with {{pspan|value}}. If a match is not found in your existing preferences for {{pspan|prop}}, it will create a property with that name and set it to {{pspan|value}}.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=The following sets the choice adventures in the Castle of the Sky Top Floor before farming there.| | |||
code= | |||
<syntaxhighlight> | |||
//Castle Top floor | |||
set_property("choiceAdventure677", 4); | |||
set_property("choiceAdventure675", 1); | |||
set_property("choiceAdventure678", 4); | |||
set_property("choiceAdventure676", 1); | |||
adventure(5, $location[The Castle in the Clouds in the Sky (Top Floor)]); | |||
</syntaxhighlight>| | |||
moreinfo= | |||
For a full list of choice adventures see [http://kol.coldfront.net/thekolwiki/index.php/Choice_Adventures_by_Number Choice Adventures]. | |||
}}| | |||
see_also={{SeeAlso|get_property}}| | see_also={{SeeAlso|get_property}}| | ||
Line 26: | Line 40: | ||
special=You can set a custom property that automatically gets its value cleared each new KoL day by prefixing it with an underscore.| | special=You can set a custom property that automatically gets its value cleared each new KoL day by prefixing it with an underscore.| | ||
}} | }} | ||
[[Category:Miscellaneous Functions]] |
Latest revision as of 22:24, 21 January 2015
Function Syntax
void set_property(string prop ,string value )
- prop is the property to set
- value is the value to set the property to
Looks for a global or appropriate user preference from the saved files (found in your "Settings" directory) and if it finds one that matches, it overrides its value with value. If a match is not found in your existing preferences for prop, it will create a property with that name and set it to value.
Code Samples
The following sets the choice adventures in the Castle of the Sky Top Floor before farming there.
//Castle Top floor
set_property("choiceAdventure677", 4);
set_property("choiceAdventure675", 1);
set_property("choiceAdventure678", 4);
set_property("choiceAdventure676", 1);
adventure(5, $location[The Castle in the Clouds in the Sky (Top Floor)]);
For a full list of choice adventures see Choice Adventures.
CLI Equivalent
The CLI command "set" works similarly.
See Also
Special
You can set a custom property that automatically gets its value cleared each new KoL day by prefixing it with an underscore.