Store data on a Political World party
Store data on a Political World party
Section titled “Store data on a Political World party”Attach addon-owned state to one specific Political World party.
Before you paste the code
Section titled “Before you paste the code”You need a real Kingdom kingdom and a real Political World party object/ID from that kingdom. The snippet belongs inside the feature that already selected that party; it is not a party-discovery example.
Minimal code
Section titled “Minimal code”const string AddonId = "Example.PartyAddon";const string Key = "conference_count";
bool written = PoliticalWorldAPI.SetPartyInt( kingdom, AddonId, party.Id, Key, 3);
int count = PoliticalWorldAPI.GetPartyInt( kingdom, AddonId, party.Id, Key, 0);Use the stable party.Id. Do not persist a list index such as “second party”.
Missing party behavior
Section titled “Missing party behavior”WBML-0003 verified that a missing party ID behaves safely:
GetPartyInt/String/Bool/Float → supplied fallbackSetPartyInt/String/Bool/Float → falseInactive party behavior
Section titled “Inactive party behavior”For the tested non-ruling party, typed data remained readable while the party was inactive and was still there after reactivation.
Evidence gap
Section titled “Evidence gap”Same-kingdom party-to-party isolation was skipped in the tested save because the original target kingdom did not contain two suitable active parties. Do not silently promote that skipped branch to Verified.
Open the full party-private data reference for the exact scope.