I Need Help With Inform 7 (With changing a value in a object with a custom action) (Solved!)

#1

So… I have a problem with Inform 7. I’m trying to make a action that changes a value in a object.
Here it is: (An example of it)

Game is a kind of item.
Game can be FPS. Game is usually FPS.
Game has a number called Value1.

Memeing is an action applying to one thing. Understand "meme [game]" as Memeing.

Carry out Memeing game (called X):
	if FPS of X is true:
		if Value1 of X 0>:
			say "aaa";
			decrease Value1 of X by 1;
		else:
			say "No.";
	else:
		say "Dat game isn[']t a FPS!"
0 Likes

(matt w) #2

Hi WannabeGamer! Welcome to the forum.

So I believe there are two issues with your code:

“Value1 of X 0>” isn’t proper Inform syntax. You want to say “Value1 of X > 0”. Or you could write it out as “Value1 of X is greater than 0.”

You don’t want to say “If FPS of X is true”, but “If X is FPS”. Games can be FPS or not FPS–there isn’t an “FPS of [game]” to assess.

Adjusting those, and adding a location and a couple of games to let us try this out:

Game is a kind of thing.
Game can be FPS. Game is usually FPS.
Game has a number called Value1.

Memeing is an action applying to one thing. Understand "meme [game]" as Memeing.

Carry out Memeing game (called X):
	if X is FPS:
		if Value1 of X > 0:
			say "aaa";
			decrease Value1 of X by 1;
		else:
			say "No.";
	else:
		say "Dat game isn[']t a FPS!"

Arcade is a room. Doom is a game in Arcade. Centipede is a game in Arcade. Centipede is not FPS. Value1 of Doom is 3.

Also, you don’t have to put the apostrophe in brackets–if you have an apostrophe between two letters, Inform knows not to make it a quotation mark. It’s when you have an apostrophe at the end as in “[’]Tis the season” or “The runners[’] loneliness” that you need to do that.

Hope this helps!

By the way, when you’re posting a problem with some code, it might help to say what the problem is–like “This won’t compile” or whatever.

2 Likes

(Chris Conley) #3

Also, I assume the purpose of FPS is to be one of several genres that a game could be. As such, I’d make it a kind of value. Working in this paradigm will make it much easier to extend in the future, rather than having to keep track of several independent Boolean values.

Genre is a kind of value. The genres are FPS, shmup and IF.
Every game has a genre. The genre of a game is usually FPS.
Every game has a number called Value1.

Memeing is an action applying to one thing. Understand "meme [game]" as Memeing.

Carry out Memeing a game (called X):
	if the genre of X is FPS:
		if Value1 of X is positive:
			say "aaa";
			decrement Value1 of X;
		else:
			say "No.";
	else:
		say "Dat game isn[']t an FPS!"

Arcade is a room. Doom is a game in Arcade. Centipede is a game in Arcade. The genre of centipede is shmup. Value1 of Doom is 3.```
2 Likes

#4

Thanks for the help! (And thanks tip for saying “This won’t compile”, I’ll make sure add next time when I have another problem with Inform 7.)

1 Like