New Python API: getSetting() and setSetting()

New python functions have been added to the API, and will be available in the next OCTGN update (3.1.56).  Games now have their own dedicated Game Settings, which can be accessed and edited by the Python scripts.  This allows for greater customization of the gameplay experience for the users.

Some examples of these API functions in use.  The first parameter is the name of the game setting, which should be a string but can be named whatever you wish.

setSetting(“MaleGender”, True)

This example will store a game setting for the player’s gender, representing a boolean value.  I arbitrarily chose male to be the True condition.

male = getSetting(“MaleGender”, True)

getSetting() will return the stored game setting with the “MaleGender” name.  If the setting has not been created yet, it will return the default value instead (the second parameter).

Leave a Reply

Your email address will not be published. Required fields are marked *