Property exists: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
Created page with "<onlyinclude>{{{{{format|Function2}}} |name=property_exists |function1.return_type=boolean |function1.description=Checks whether a property exists. |function1.param1=name |fun..."
 
No edit summary
 
Line 30: Line 30:
   |moreinfo=
   |moreinfo=
}}
}}
|see_also={{SeeAlso|}}
|see_also={{SeeAlso/Property Functions}}
|cli_equiv=
|cli_equiv=
|more_info=
|more_info=

Latest revision as of 10:25, 23 December 2020

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()