(settings)
| 112 | |
| 113 | |
| 114 | def script_load(settings): |
| 115 | # Register an example action |
| 116 | advss_register_action("My simple Python action", my_python_action) |
| 117 | |
| 118 | # Register an example action with settings |
| 119 | advss_register_action( |
| 120 | "My Python action with settings", |
| 121 | my_python_settings_action, |
| 122 | get_action_properties, |
| 123 | get_action_defaults(), |
| 124 | ) |
| 125 | |
| 126 | # This example action demonstrates how to interact with variables |
| 127 | advss_register_action("My variable Python action", variable_python_action) |
| 128 | |
| 129 | # Register an example condition |
| 130 | advss_register_condition( |
| 131 | "My Python condition", |
| 132 | my_python_condition, |
| 133 | get_condition_properties, |
| 134 | get_condition_defaults(), |
| 135 | ) |
| 136 | |
| 137 | # Register an example condition which registers and sets macro properties |
| 138 | advss_register_condition( |
| 139 | "My Python condition (Macro properties)", |
| 140 | my_temp_var_python_condition, |
| 141 | macro_properties=[ |
| 142 | MacroProperty( |
| 143 | "random_int", |
| 144 | "Random number", |
| 145 | "A random number generated in the range from 0 to 100", |
| 146 | ), |
| 147 | MacroProperty("some_other_value", "Another value", ""), |
| 148 | ], |
| 149 | ) |
| 150 | |
| 151 | # Other signals and procedures, which might be useful |
| 152 | def plugin_stop_handler(data): |
| 153 | obs.script_log(obs.LOG_INFO, "Hello from stop handler!") |
| 154 | get_running_status() |
| 155 | |
| 156 | def plugin_start_handler(data): |
| 157 | obs.script_log(obs.LOG_INFO, "Hello from start handler!") |
| 158 | get_running_status() |
| 159 | |
| 160 | def get_running_status(): |
| 161 | proc_handler = obs.obs_get_proc_handler() |
| 162 | data = obs.calldata_create() |
| 163 | obs.proc_handler_call(proc_handler, "advss_plugin_running", data) |
| 164 | success = obs.calldata_bool(data, "is_running") |
| 165 | obs.script_log( |
| 166 | obs.LOG_INFO, f"The advanced scene switcher is currently running: {success}" |
| 167 | ) |
| 168 | obs.calldata_destroy(data) |
| 169 | |
| 170 | def interval_reset_handler(data): |
| 171 | obs.script_log(obs.LOG_INFO, "Hello from reset handler!") |
nothing calls this directly
no test coverage detected