Events reference
What this page is for
Section titled “What this page is for”The names of Intrigues events do not follow one pattern. IM.onActorDeath takes an actor, Actor.onActorDeath takes nothing, Actor.OnTrigger has a capital O, IM.keyHandler has no on. Copy the names from here. This page lists the events of IM, Actor and DialogueManager in full, and the names of the public events of other types.
When you come here
Section titled “When you come here”- You subscribe to something and the compiler says the name does not exist.
- You need to know which arguments an event gives you.
- You wonder whether a thing is announced on
IM, on the actor, or both.
Every IM event is public static. Each listener runs in its own try / catch, so one that throws does not stop the others. Remove your handler when your object goes away. Every static event of IM starts empty in each Play session, so a subscription made before Play is dropped. Subscribe from a component, or from [RuntimeInitializeOnLoadMethod(AfterAssembliesLoaded)] or later.
Events on IM
Section titled “Events on IM”Declared in Manager/. Where a file is not named, the event is in IM.Events.cs.
| Signature | Raised when |
|---|---|
Action<int> onDayPassed (IM.Clock.cs) |
A game day ends, with the number of the day that begins. |
Action<int> onMonthBegan |
A month begins, with its number. |
Action<int> onYearBegan |
A year begins, with its number. |
Action<string> onSeasonChanged |
The season changes, with the ID of the season that begins. |
The three calendar events are not raised when the day is set from code, on a load or on a restart. For a passing day the order is year, month, season, then the day.
Schemes and signals
Section titled “Schemes and signals”| Signature | Raised when |
|---|---|
Action<Scheme> onSchemeStarted (IM.Schemes.cs) |
Any scheme started. Not for one restored from a save. |
Action<Scheme, SchemeResult> onSchemeEnded (IM.Schemes.cs) |
Any scheme ended with a result. |
Action<Scheme, SchemeChange> onSchemeChanged (IM.Schemes.cs) |
A run changed: started, paused, resumed, new objective, cast change, ended. |
Action<Scheme, string, bool> onTrigger |
A scheme trigger was fired. |
Action<Signal> onSignalReceive |
A signal was sent. |
Action<GiveUpInfo> onSchemeGivenUp (IM.Mind.cs) |
A running scheme is given up, before it ends. |
Variables
Section titled “Variables”| Signature | Raised when |
|---|---|
Action<Variable> onVariableChanged |
Any variable value changed, in any scope. |
Action<object, Variable, int, int> onVariableLevelChanged |
A number with named levels moved to another level: owner, variable, level before, level now (-1 is no level). |
Actors, clans and families
Section titled “Actors, clans and families”| Signature | Raised when |
|---|---|
Action<Actor> onActorDeath |
Any actor dies, before its roles pass on. |
Action<Actor, GameObject> onRuntimeActorCreated |
A runtime actor was created. |
Action<Actor, GameObject, GameObject> onActorBodyChanged |
A body was made, swapped or removed: actor, old body, new body. When the actor is destroyed, the old body may already be destroyed: compare it with null. |
Action<Actor> onActorAway (IM.ActorHome.cs) |
An actor is parked. |
Action<Actor> onActorBack (IM.ActorHome.cs) |
A parked actor is back in its scene. |
Action<Actor, ActorChange> onActorChanged (IM.Changes.cs) |
Something a view may show changed about an actor. One call can carry several flags. |
Action<Clan, GroupChange> onClanChanged (IM.Changes.cs) |
Something about a clan changed: name, members, policies, laws, attitudes, ties, hierarchy and more. GroupChange holds the flags. |
Action<Family, GroupChange> onFamilyChanged (IM.Changes.cs) |
The same for a family. |
Action<SuccessionInfo> onRoleInherited (IM.Changes.cs) |
A role passed on. |
Action<SuccessionInfo> onRoleVacant (IM.Changes.cs) |
A seat became empty. |
Action<MarriageInfo> onMarried (IM.Changes.cs) |
After a wedding. |
Action<MarriageInfo> onDivorced (IM.Changes.cs) |
After a divorce. |
Action<MarriageInfo> onWidowed (IM.Changes.cs) |
A marriage became a widowhood. |
Action<BirthInfo> onChildBorn (IM.Changes.cs) |
After a birth. |
onActorChanged, onClanChanged and onFamilyChanged are raised on the main thread, and only when a value really changed. The succession and marriage events are raised on the main thread too.
Clans and families, host only
Section titled “Clans and families, host only”| Signature | Raised when |
|---|---|
Action<Clan> onClanFounded |
A clan was founded. |
Action<Clan> onClanDisbanded |
A clan was disbanded. Not for a merge. |
Action<Clan> onClanReformed |
A disbanded clan got a living member again. |
Action<Clan, Clan> onClanMerged |
A clan ended by merging: the clan that ended, the clan it went into. |
Action<Clan> onClanExtinct |
The last living member died or left. |
Action<Clan, Clan, Clan> onClanOverlordChanged |
The clan a clan stands under changed: clan, before, now. |
Action<Family, Family, Family> onFamilyBranchChanged |
The family a family is a branch of changed: family, before, now. |
Action<ClanRelationInfo> onClanRelationStarted |
A relation between two clans began. |
Action<ClanRelationInfo> onClanRelationEnded |
A relation between two clans ended. |
Mind, where the game’s mind runs (the host)
Section titled “Mind, where the game’s mind runs (the host)”| Signature | Raised when |
|---|---|
Action<DecisionInfo> onDecisionMade |
A character took a decision. |
Action<MemoryInfo> onMemoryChanged |
One memory changed. |
Action<TieInfo> onTieChanged |
One tie changed. |
Action<AmbitionInfo> onAmbitionChanged |
A character’s ambitions changed. |
Action<AttitudeInfo> onAttitudeChanged |
The attitude one clan holds toward another changed. |
Players, texts, input, world
Section titled “Players, texts, input, world”| Signature | Raised when |
|---|---|
Action<Actor, Actor> onPlayerIsChanged (IM.Players.cs) |
This machine’s player changed: old, new. |
Action<Actor, bool> onPlayersChanged (IM.Players.cs) |
A human started (true) or stopped (false) playing an actor. |
Action<ChronicleEntry> onChronicleEntry (IM.Chronicle.cs) |
A chronicle line was stored. |
Action<string> onLanguageChanged |
The language changed, with its code. |
Action onTextsChanged |
Texts were read again; the language did not change. |
Action<Culture> onCultureDefinitionChanged |
A culture’s definition changed while the game runs. |
Action<KeyCode, KeyType, float> keyHandler |
A key went down or up. Keys are read only while someone listens. |
Action onReplicaReady (IM.Replica.cs) |
IM.ReplicaReady becomes true: this machine’s world is complete and can be read. Single-player and host: once, after the first new game or load. |
Message flags
Section titled “Message flags”These sit on a nested class, so you write IM.MessageFlags.onRaised. All four are Action<MessageFlag>, in IM.Messages.cs.
| Name | Raised when |
|---|---|
onRaised |
A flag is raised for this machine’s player. |
onOpened |
A flag was opened. |
onClosed |
A flag left its tray without being opened. |
onChanged |
A waiting flag changed (an identical announcement merged into it). |
Events on Actor
Section titled “Events on Actor”These are instance events: actor.onJoinedClan += .... Declared in Actors/Actor.Events.cs, except onBodyChanged (Actor.Body.cs).
| Signature | Raised when |
|---|---|
Action<Scheme> onSchemeStarted |
The actor started a scheme. |
Action<Scheme> onSchemeLoaded |
A scheme of the actor was loaded from the save system. |
Action<Scheme, SchemeResult> onSchemeEnded |
A scheme of the actor ended, for every result. |
Action<Scheme> onJoinedScheme |
The actor became an accomplice. |
Action<Scheme, AccompliceExit> onLeftScheme |
The actor stopped being an accomplice, with the reason. |
Action onActorDeath |
The actor died. |
Action<Actor> onDestroy |
The actor was destroyed. |
Action<Culture> onCultureChanged |
The culture changed. |
Action<Role> onRoleChanged |
A court role was given or taken; the argument is the previous one. |
Action<Role> onPersonalRoleChanged |
The personal role changed; the argument is the previous one. |
Action<Clan> onJoinedClan, Action<Clan> onLeftClan |
A clan was joined or left. |
Action<Family> onJoinedFamily, Action<Family> onLeftFamily |
A family was joined or left. |
Action<Actor> onInherited |
A role was inherited; the argument is the previous holder. |
Action<Actor, Actor, bool> onActorIsMarried |
After a wedding: this actor, the spouse, true for the actor the wedding was called on. |
Action<Actor, Actor> onActorDivorced |
After a divorce: this actor, the former spouse. |
Action<Actor> onWidowed |
A spouse died; the argument is the partner who died. |
Action<Actor> onChildBorn |
A child was born to this actor; the argument is the child. |
Action<Actor, int> onAgeChanged |
The age changed. |
Action<Actor, AgeGroup> onAgeGroupChanged |
The actor moved to another age group; the argument is the group they left. |
Action<string, bool> OnTrigger |
A trigger was activated for the actor. |
Action<GameObject, GameObject> onBodyChanged |
The body changed: old, new. |
The code comment on onActorDeath says it fires when the player-character dies. The code in Actors/Actor.State.cs raises it for any actor that died, so treat it as the death of this actor.
Most actor events are followed by the matching IM event (onMarried after onActorIsMarried, for example). A death is the other way round: IM.onActorDeath comes first, then succession, then the actor’s own onActorDeath, which already sees the heir in the seat (Actors/Actor.State.cs).
Events on DialogueManager
Section titled “Events on DialogueManager”Static, in Dialogue/DialogueManager.cs. All take a DialogueContext. They are cleared when Play mode starts, so subscribe from code that runs in Play mode.
| Signature | Raised when |
|---|---|
Action<DialogueContext> Opening |
A dialogue is complete and about to be shown. Listeners may change its style, picture, title and text. |
Action<DialogueContext> Opened |
A window shows a dialogue. |
Action<DialogueContext, string> Cue |
A text reached a {cue Name} mark. |
Action<DialogueContext> TextRevealed |
The whole text is written. |
Action<DialogueContext, ChoiceRequest> ChoicePicked |
The player picked a choice, before the window closes. |
Action<DialogueContext, DialogueCloseReason> Closed |
A dialogue closed, for any reason. |
DialogueManager also has an instance event Action<Dialogue> onDialogueClose_Ignore, raised after every close. See Dialogues and announcements from code.
Events elsewhere
Section titled “Events elsewhere”Public events of other types. Names only; read their XML comments before you use them.
| Type | Events |
|---|---|
SchemeRunner (static) |
onConspiratorChanged, onTargetChanged, onAccompliceJoined, onAccompliceLeft |
Clan |
onPolicyAccepted, onPolicyUnaccepted, onClanNameChanged, onClanIconChanged, onClanCultureChanged, onMemberJoin, onMemberLeave, onActorRoleChanged |
Family |
onPolicyAccepted, onPolicyUnaccepted, onFamilyNameChanged, onFamilyIconChanged, onFamilyCultureChanged, onMemberJoin, onMemberLeave |
WorldClock (static) |
DayPassed, Restarted, SettingsChanged, MonthBegan, YearBegan, SeasonChanged, SpeedChanged |
IntrigueSaveSystem (static) |
onRuntimeActorsLoaded, onSave, onLoad, onActorPlaced |
Variable, VariableSet, ActorList |
Changed (Variable.Changed also fires when a bonus of traits or modifiers changes what a number reads as) |
Mind (static) |
onSchemeGivenUp (same as IM.onSchemeGivenUp), SimulationStarted, SimulationEnded |
IntrigueSave.State (static) |
Saving, Saved, Loading, Loaded, Failed, WorldReady, UnsavedActorLeft |
LoadOperation |
Completed |
Role |
onRoleNameChanged |
Policy |
onPolicyNameChanged |
Culture |
onCultureNameChanged, onCultureIconChanged |
Dialogue |
onTimeout, onDialogueClose, onDialogueShow, onDialogueHide, onTextRevealed, onCue |
MessageHandle |
Closed |
DialogueModel |
ChoicesChanged, Changed, TopChanged, SkipRequested, Closed |
IntrigueUI (static) |
Updated, SelectionChanged, ScreenRequested, OpenRequested, BackRequested, CloseRequested |
IntrigueUI.Saves (static) |
Changed, Preparing |
SubjectWindow (static) |
AnyOpened, AllClosed |
SubjectSource |
Changed, ContentChanged |
BoundList, SchemeOfferSection |
Changed |
SchemeOffer |
AccomplicesChanged |
PixelCanvasScale |
ScaleChanged |
Some static events are Func hooks that can refuse an action: Succession.CanInherit, Mind.CanDecide, FamilyLaw.CanMarry, CanDivorce, CanHaveChild.
Mistakes and messages
Section titled “Mistakes and messages”- Subscribing to
Actor.onActorDeathexpecting an actor argument. It has none; useIM.onActorDeathfor that. - Forgetting
-=. A staticIMevent keeps your object alive. - Writing
IM.onDayPassedfor the clock class. The clock’s own name isWorldClock.DayPassed;IM.onDayPassedis the same event.
How it connects
Section titled “How it connects”- Variables from code covers
onVariableChangedandChanged. - Schemes from code and Actor from code use the scheme and actor events.
- Signals explains
onSignalReceiveandonTriggerfrom the scheme side.