Difference between revisions of "Set property"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
m
imported>Eliteofdelete
 
Line 19: 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}}.|
  
needscode=yes|
+
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}}|

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

get_property()

Special

You can set a custom property that automatically gets its value cleared each new KoL day by prefixing it with an underscore.