Skip to content

CrowdControl ​

The CrowdControl singleton is available in every script. All signals are emitted on the main thread.

Properties ​

PropertyTypeUse
pausedboolWhile true, no effects start and the timers of timed effects stop.
auto_starting_sessionboolStart a session as soon as the login is done. Set it before connecting.

Connection and Login ​

MethodUse
connect_to_crowd_control() -> ErrorLoads the effects and opens the connection.
close()Stops the session and closes the connection. disconnected is emitted when done.
is_connected_to_crowd_control() -> boolWhether the connection is open.
login()Starts the login. Emits auth_code_received, then logged_in or login_failed.
logout()Stops the session, logs out, and forgets the stored login.
is_logged_in() -> boolWhether a valid login is available.
extend_token() -> boolAsks for a later expiry of the login. The plugin does this on its own before the login runs out.
ping()Sends a ping, pong_received is emitted on the reply. The plugin keeps the connection alive on its own.
SignalWhen
connectingA connection attempt started.
connectedThe connection is open.
disconnectedThe connection closed.
connection_errored(err: Error)The connection failed or dropped. The plugin reconnects on its own.
logged_inA login is available. Also emitted after every reconnect.
logged_outNo usable login: none stored, expired, revoked, or logout() was called.
auth_code_received(code: String, url: String)The streamer has to sign in at url.
login_failed(message: String)The login attempt failed.
token_refreshedThe login was extended.
pong_receivedCrowd Control answered a ping.

Sessions ​

MethodUse
start_session()Starts a game session for the configured Game Pack.
stop_session()Stops the running session.
is_session_active() -> boolWhether a session is running.
get_streamer_user() -> StreamUserThe logged in streamer, once their profile has loaded.
get_interact_link() -> StringThe link viewers use to buy effects, empty if not logged in.
launch_interact_link()Opens that link in the browser.
SignalWhen
session_startedA session is running.
session_stoppedThe session ended.
session_start_failed(message: String)The session could not be started.
session_paused(paused: bool)The streamer paused or resumed ordering.

Effects ​

MethodUse
get_effect(id: StringName) -> CCEffectThe effect with that ID, null if there is none.
test_effect(effect: CCEffect)Runs an effect locally, without contacting Crowd Control.
stop_all_effects()Ends every running timed effect and refunds every waiting request.
stop_effect(instance: CCEffectInstanceTimed)Ends a running timed effect early.
pause_effect(effect: CCEffectTimed)Pauses a running timed effect.
resume_effect(effect: CCEffectTimed)Resumes it.
reset_effect(effect: CCEffectTimed)Restarts its timer.
SignalWhen
effect_requested(effect: CCEffect)A request arrived.
effect_queued(instance: CCEffectInstance)The request is waiting to start.
effect_dequeued(id: String, result: int)The request left the queue, with its EffectResult.
effect_triggered(instance: CCEffectInstance)An effect ran successfully.
effect_started(instance: CCEffectInstanceTimed)A timed effect started.
effect_stopped(instance: CCEffectInstanceTimed)A timed effect ended.
effect_paused(instance: CCEffectInstanceTimed)A timed effect was paused through pause_effect().
effect_resumed(instance: CCEffectInstanceTimed)A timed effect was resumed through resume_effect().
effect_reset(instance: CCEffectInstanceTimed)The timer of a timed effect was reset.

Effect Menu ​

Each function returns false if nothing could be reported. The message argument is optional.

MethodUse
show_effects(effect_ids: PackedStringArray, message := "") -> boolList the effects in the menu.
hide_effects(effect_ids: PackedStringArray, message := "") -> boolRemove the effects from the menu.
enable_effects(effect_ids: PackedStringArray, message := "") -> boolAllow the effects to be bought.
disable_effects(effect_ids: PackedStringArray, message := "") -> boolKeep the effects listed but not buyable.
show_all_effects(message := "") -> boolAs above, for every effect.
hide_all_effects(message := "") -> bool
enable_all_effects(message := "") -> bool
disable_all_effects(message := "") -> bool

Events, Metadata, and Coins ​

MethodUse
trigger_event(event_id: String, args := {}) -> boolReports a game event defined in the Game Pack.
update_metadata(key: String, value: Variant) -> boolUpdates one metadata value of the Game Pack.
update_metadata_values(values: Dictionary) -> boolUpdates several at once.
SignalWhen
coins_exchanged(amount: int, exchanger: StreamUser)A viewer exchanged coins. The amount is 0 without the pubsub.private:read scope.
message_display_requested(message: String, duration: float, icon: Texture2D)The plugin has a status message for the player, such as "Started the Crowd Control session!".

Custom Effects ​

MethodUse
can_upload_custom_effects() -> boolWhether the login has the custom-effects:write scope.
upload_custom_effects(mode := CUSTOM_EFFECTS_MERGE) -> boolUploads every effect marked as custom.
delete_custom_effects(effect_ids: PackedStringArray) -> boolDeletes custom effects by ID.
delete_all_custom_effects() -> boolDeletes every custom effect of the Game Pack.
SignalWhen
custom_effects_updated(success: bool, message: String)An upload or delete finished.

Modes: CUSTOM_EFFECTS_MERGE, CUSTOM_EFFECTS_REPLACE_ALL, CUSTOM_EFFECTS_REPLACE_PARTIAL.

Project Settings ​

See Installing the Plugin.