Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture and read facts #2

Open
SilasBerger opened this issue Jan 11, 2024 · 0 comments
Open

Capture and read facts #2

SilasBerger opened this issue Jan 11, 2024 · 0 comments
Labels
feature Add or improve business functionality v1-candidate This issue is nice to have for v1

Comments

@SilasBerger
Copy link
Owner

SilasBerger commented Jan 11, 2024

Capture facts that arise during the game, such as important answers or generated / observed values, for later use.

// Provided by the library user
enum FactKeys {
  PLAYER_NAME,
  IS_STRUGGLING,
}

// At some point while processing an answer to the question "What's your name?"...
Facts.captureString(FactKeys.PLAYER_NAME, answer);

// After the third failed attempt on the same question (do we have the means to track this by question / globally?)...
Facts.captureBool(FactKeys.IS_STRUGGLING, true)

// Then later...
if (Artefacts.readBool(FactKeys.IS_STRUGGLING)) { 
  DialogLine.of(`Do you need help, ${Facts.readString(Fact.PLAYER_NAME)}`);
}

// Possibly use generics instead of captureBool() and readBool()?
@SilasBerger SilasBerger added feature Add or improve business functionality v1 This issue should be fixed for v1 v1-candidate This issue is nice to have for v1 and removed v1 This issue should be fixed for v1 labels Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Add or improve business functionality v1-candidate This issue is nice to have for v1
Projects
None yet
Development

No branches or pull requests

1 participant