property_exists

From Kolmafia
Revision as of 10:25, 23 December 2020 by Philmasterplus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

boolean property_existsstring name, boolean? global )

Checks whether a property exists.
  • name: Name of the property
  • global: If true, only checks global properties. If false, only checks user-specific properties. If omitted, checks both global and user properties.

The following properties are built-in and always return true:

  • Choice adventure properties (Those that start with choiceAdventure)
  • Skill use priority during MP burning (Those that start with skillBurn)
  • Positions of various windows (AnnouncementFrame, CakeArenaFrame, ...)
  • Position of the main window (KoLDesktop)

This function was added in r17892.

Code Samples

The following sample checks if a custom property named my_pref exists, and deletes it.

if ( property_exists( "my_pref" ) )
{
   remove_property( "my_pref" );
}

See Also

get_all_properties() | property_exists() | property_has_default() | property_default_value() | get_property() | set_property() | remove_property() | rename_property()