[Help] Hybrid Choices and variables

Hi, I’m trying to use AW Freyr’s Hybrid Choices to change a variable. The function is to change certain parts of some of the game text based on what choice the player makes. For example:

Setting: “adult”
Result: “Adult” is used to refer to the player. Some text in the game reference activities adults do, such as driving, drinking, or working.

Setting: “child”
Result: “Child” is used to refer to the player. Some text in the game reference activities children do, such as playing, imagining, or going to school.

This would be accomplished through a CYOA setting that occurs before the game begins. I’m not completely sure how to use variables effectively yet, so I’ve tried using “value properties”, which appear as if they can only apply to a certain thing. It seems very convoluted, and regardless it doesn’t work.

player has some text called age. player has some text called activity.

age selection is a page. "You are...".

when play begins:
	switch to cyoa at age selection.
	
child is a page.
	"A small and happy little kid.".
	the cdesc is "a child.". it is for age selection.
	now the age of player is "child".
	now the activity of player is "playing".
	
adult is a page.
	"An adult, trekking through the daily slog.".
	the cdesc is "an adult.". it is for age selection.
	now the age of player is "adult".
	now the activity of player is "working".

Can anyone help me figure out how I could get this to work? Also, what are the if/else predicates used with variables/values (so if I want something to happen only if the player is an adult, for instance, how would I code that)?

1 Like

Hi, I’m the author of the Hybrid Choices extension, but bear in mind it’s been years since I’ve actually used it.
To use a page to change a variable, use the page-toggle rules.
This isn’t tested, but your code might look something like this:

adult is a page.
	"An adult, trekking through the daily slog.".
	the cdesc is "an adult.". it is for age selection.

A page-toggle rule for adult:
	now the age of player is "adult";
	now the activity of player is "working".

The page-toggle rules are the best way to influence the model world. This should be in the documentation.

Inform 7 as far as I remember doesn’t support changing state outside of rules. You can only initialize things. If you want to change the model world you have to encapsulate it in a rule of some kind.

2 Likes

Thanks! I read that part of the documentation but wasn’t sure how to implement it. Glad to see that it is an ability in Inform.

1 Like