Skip to content

Subscribe to a Political World event

✅ Runtime verifiedWBML-0004PoliticalWorldAPI 1.14.0

React when Political World publishes an event instead of scanning kingdoms every update.

This assumes your addon is already registered.

Register the subscription from your addon initialization path after Political World addon registration has succeeded. Keep OnPartyRenamed as a method your mod can call back into. Do not subscribe repeatedly every update/frame.

private const string AddonId = "Example.EventAddon";
PoliticalWorldAPI.Subscribe(
AddonId,
"party.renamed",
OnPartyRenamed
);
private static void OnPartyRenamed(
PoliticalWorldAPI.PoliticalEventData data)
{
if (data == null)
return;
string oldName = data.OldValue;
string newName = data.NewValue;
}

For the tested API 1.14.0 party.renamed path, the old/new names appeared in OldValue / NewValue rather than OldName / NewName.

When your code no longer needs the callback, remove the exact subscription or all subscriptions owned by the addon:

PoliticalWorldAPI.Unsubscribe(AddonId, "party.renamed", OnPartyRenamed);
  • Do not assume every event uses the same payload fields.
  • Do not use a wildcard when one exact event ID is enough.
  • Do not rely on one callback exception to stop other subscribers. WBML verified callback isolation.

Open the Event Bus reference for wildcard, recursion, unknown-event and diagnostics behavior.