Interaction Event Types¶
Interaction Outcome Event¶
-
class
S4CLInteractionOutcomeEvent
(interaction, outcome, outcome_result)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs after a Sim has performed an interaction.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionOutcomeEvent) -> bool: # Return True from here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run. return True
Parameters: - interaction (Interaction) – The interaction that was performed.
- outcome (InteractionOutcome) – The outcome of the interaction that was performed.
- outcome_result (OutcomeResult) – The result of the interaction that was performed.
-
interaction
¶ The interaction that was performed.
Returns: The interaction that was performed. Return type: Interaction
-
is_failure
() → bool¶ Determine if the outcome was a failure.
Returns: True, if the interaction was not performed successfully. False, if the interaction was performed successfully. Return type: bool
-
is_success
() → bool¶ Determine if the outcome was a success.
Returns: True, if the interaction was performed successfully. False, if the interaction was not performed successfully. Return type: bool
-
outcome
¶ The outcome of the interaction that was performed.
Returns: The outcome of the interaction that was performed. Return type: InteractionOutcome
-
outcome_result
¶ The result of the interaction that was performed.
Returns: The result of the interaction that was performed. Return type: OutcomeResult
Interaction Queued Event¶
-
class
S4CLInteractionQueuedEvent
(interaction, interaction_queue)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs upon a Sim adding an interaction to their interaction queue.
Note
This event fires BEFORE the interaction is actually queued. Like a Pre-Queue. If False or None is returned from any of the listeners of this event, the interaction will be prevented from queuing; All subsequent listeners will still receive the event, but their return will be ignored.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionQueuedEvent) -> bool: # Return True here to allow the interaction to queue and to signify the event listener ran successfully. Return False or None here to prevent the interaction from being queued or to signify the event listener failed to run. return True
Parameters: - interaction (Interaction) – The interaction that is being queued.
- interaction_queue (InteractionQueue) – The interaction queue of the Sim.
-
interaction
¶ The interaction that is being queued.
Returns: The interaction that was queued. Return type: Interaction
-
interaction_queue
¶ The interaction queue of the Sim that is queuing the interaction.
Returns: The interaction queue of the Sim that is queuing the interaction. Return type: InteractionQueue
-
queuing_sim
¶ The Sim that is putting the interaction into their queue.
-
queuing_sim_info
¶ The SimInfo of the Sim that is putting the interaction into their queue.
Interaction Post Queued Event¶
-
class
S4CLInteractionPostQueuedEvent
(interaction, interaction_queue, queue_result)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs after a Sim adds an interaction to their interaction queue.
Note
This event fires AFTER the interaction is actually queued. Like a Post-Queue.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionPostQueuedEvent) -> bool: # Return True here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run. return True
Parameters: - interaction (Interaction) – The interaction that was queued.
- interaction_queue (InteractionQueue) – The interaction queue of the Sim.
- queue_result (CommonTestResult) – The result of the interaction being Queued.
-
interaction
¶ The interaction that was queued.
Returns: The interaction that was queued. Return type: Interaction
-
interaction_queue
¶ The interaction queue of the Sim that queued the interaction.
Returns: The interaction queue of the Sim that queued the interaction. Return type: InteractionQueue
-
queue_result
¶ The result of the interaction being Queued.
Returns: The result of the interaction being Queued. Return type: CommonTestResult
Interaction Started Event¶
-
class
S4CLInteractionStartedEvent
(interaction, sim_info, target)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs when a Sim has started an interaction.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionStartedEvent) -> bool: # Return True here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run. return True
Parameters: - interaction (Interaction) – The interaction that was run.
- sim_info (SimInfo) – The Sim doing the interaction.
- target (Any) – The Target of the interaction.
-
interaction
¶ The interaction that was run.
Returns: The interaction that was run. Return type: Interaction
-
sim_info
¶ The Sim that started the interaction.
-
target
¶ The target of the interaction.
Interaction Pre Run Event¶
-
class
S4CLInteractionPreRunEvent
(interaction, interaction_queue, timeline)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs upon a Sim running an interaction.
Note
This event fires BEFORE the interaction is actually run. Like a Pre-Run. If False or None is returned from any of the listeners of this event, the interaction will be prevented from running; All subsequent listeners will still receive the event, but their return will be ignored.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionPreRunEvent) -> bool: # Return True here to allow the interaction to run and to signify the event listener ran successfully. Return False or None here to prevent the interaction from being run or to signify the event listener failed to run. return True
Parameters: - interaction (Interaction) – The interaction that is being run.
- interaction_queue (InteractionQueue) – The interaction queue of the Sim.
- timeline (Timeline) – The timeline of the interaction.
-
interaction
¶ The interaction that is being run.
Returns: The interaction that is being run. Return type: Interaction
-
interaction_queue
¶ The interaction queue of the Sim that is running the interaction.
Returns: The interaction queue of the Sim that is running the interaction. Return type: InteractionQueue
-
timeline
¶ The timeline of the interaction.
Returns: The timeline of the interaction. Return type: Timeline
Interaction Run Event¶
-
class
S4CLInteractionRunEvent
(interaction, interaction_queue, run_result)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs after a Sim has run an interaction.
Note
This event fires AFTER the interaction is actually run. Like a Post-Run. If False or None is returned from any of the listeners of this event, the interaction will be prevented from running; All subsequent listeners will still receive the event, but their return will be ignored.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionRunEvent) -> bool: # Return True here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run. return True
Parameters: - interaction (Interaction) – The interaction that was run.
- interaction_queue (InteractionQueue) – The interaction queue of the Sim.
- run_result (bool) – The result of the interaction being run.
-
interaction
¶ The interaction that was run.
Returns: The interaction that was run. Return type: Interaction
-
interaction_queue
¶ The interaction queue of the Sim that ran the interaction.
Returns: The interaction queue of the Sim ran the interaction. Return type: InteractionQueue
-
run_result
¶ The result of the interaction being run.
Returns: True, if the interaction was run successfully. False, if not. Return type: bool
Interaction Cancelled Event¶
-
class
S4CLInteractionCancelledEvent
(interaction, finishing_type, cancel_reason, ignore_must_run=False, **kwargs)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs upon an interaction being cancelled.
Note
This event fires BEFORE the interaction is actually cancelled. Like a Pre-Cancel.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLInteractionCancelledEvent) -> bool: # Return True from here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run successfully. return True
Parameters: - interaction (Interaction) – The interaction that is being cancelled.
- finishing_type (FinishingType) – The finishing type of the interaction.
- cancel_reason_msg (str) – The reason the interaction was cancelled.
- ignore_must_run (bool, optional) – If True, interactions flagged as “Must Run” will be ignored. Default is False.
-
cancel_reason
¶ The reason the interaction was cancelled.
Returns: The reason the interaction was cancelled. Return type: str
-
finishing_type
¶ The finishing type of the interaction.
Returns: The finishing type of the interaction. Return type: FinishingType
-
ignore_must_run
¶ Whether or not interactions flagged as “Must Run” will be cancelled.
Returns: If True, interactions flagged as “Must Run” will be cancelled. If False, interactions flagged as “Must Run” will not be cancelled. Return type: bool
-
interaction
¶ The interaction that is being cancelled.
Returns: The interaction that is being cancelled. Return type: Interaction
-
keyword_arguments
¶ Keyword arguments sent to the cancelled interaction.
Returns: Keyword arguments sent to the cancelled interaction. Return type: Dict[str, Any]
Super Interaction Cancelled Event¶
-
class
S4CLSuperInteractionCancelledEvent
(interaction, finishing_type, cancel_reason_msg, **kwargs)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs upon a super interaction being cancelled.
Note
This event fires BEFORE the super interaction is actually cancelled. Like a Pre-Cancel.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLSuperInteractionCancelledEvent) -> bool: # Return True from here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run successfully. return True
Parameters: - interaction (SuperInteraction) – The super interaction that is being cancelled.
- finishing_type (FinishingType) – The finishing type of the interaction.
- cancel_reason_msg (str) – The reason the interaction was cancelled.
-
cancel_reason
¶ The reason the interaction was cancelled.
Returns: The reason the interaction was cancelled. Return type: str
-
finishing_type
¶ The finishing type of the interaction.
Returns: The finishing type of the interaction. Return type: FinishingType
-
interaction
¶ The super interaction that is being cancelled.
Returns: The super interaction that is being cancelled. Return type: SuperInteraction
-
keyword_arguments
¶ Keyword arguments sent to the cancelled interaction.
Returns: Keyword arguments sent to the cancelled interaction. Return type: Dict[str, Any]
Mixer Interaction Cancelled Event¶
-
class
S4CLMixerInteractionCancelledEvent
(interaction, finishing_type, cancel_reason_msg, **kwargs)¶ Bases:
sims4communitylib.events.event_handling.common_event.CommonEvent
An event that occurs upon a mixer interaction being cancelled.
Note
This event fires BEFORE the mixer interaction is actually cancelled. Like a Pre-Cancel.
Example usage: from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry from sims4communitylib.modinfo import ModInfo class ExampleEventListener: # In order to listen to an event, your function must match these criteria: # - The function is static (staticmethod). # - The first and only required argument has the name "event_data". # - The first and only required argument has the Type Hint for the event you are listening for. # - The argument passed to "handle_events" is the name or identity of your Mod. @staticmethod @CommonEventRegistry.handle_events(ModInfo.get_identity()) def handle_event(event_data: S4CLMixerInteractionCancelledEvent) -> bool: # Return True from here to signify the event listener ran successfully. Return False or None here to signify the event listener failed to run successfully. return True
Parameters: - interaction (MixerInteraction) – The mixer interaction that is being cancelled.
- finishing_type (FinishingType) – The finishing type of the interaction.
- cancel_reason_msg (str) – The reason the interaction was cancelled.
-
cancel_reason
¶ The reason the interaction was cancelled.
Returns: The reason the interaction was cancelled. Return type: str
-
finishing_type
¶ The finishing type of the interaction.
Returns: The finishing type of the interaction. Return type: FinishingType
-
interaction
¶ The mixer interaction that is being cancelled.
Returns: The mixer interaction that is being cancelled. Return type: MixerInteraction
-
keyword_arguments
¶ Keyword arguments sent to the cancelled interaction.
Returns: Keyword arguments sent to the cancelled interaction. Return type: Dict[str, Any]