Hi all,
I am experimenting with Inform 7, and seeing about creating RPG-type game mechanics.
I am trying to create a situation where you can become friends with an NPC, and their opinon of you is dependant on your reputation and on your personal history with them.
So, i have defined three numbers:
…and I want to set it up so that “NPC’s familiarity = player’s reputation + NPC’s howmuchtheylikeyou”. The game mechanic that i have in mind involves using all three numbers separately depending on the situation, thus it would be useful to define “reputation” and “howmuchtheylikeyou” separately, and then use a combined value (“familiarity”) in some situations. I could just add them together when i need them, without bothering to have a combined value called “familiarity”, but i think that would just lead to the exact same problem later on - i mean, compare “if familiarity of the noun > 20” to “if reputation of the player plus howmuchtheylikeyou of the noun > 20” - the latter option seems much more prone to ambiguity (and frustration) further down the track, especially since Inform doesn’t seem to use brackets in the way mathematicians use them (inform only seems to allow statements like “a + b > 20”, not “(a+ b) > 20”, if you get my drift). For the sake of argument, i’d like to know how to define a third value that encapsulates that concept from the beginning, without needing to think about it further down the track. I’d like to know how to solve this problem, and if it’s unsolvable, i’d like to know that as well, if only for the sake of working out how Inform reads things.
I started with:
… which returns the error:
Another try:
returns…
…and…
gives me…
I could go on and on like this! I’ve tried about a dozen more different ways of attempting to add two number together to create the third number, but unfortunately i only discovered this forum a few minutes ago, so i haven’t saved all the different formulations i’ve tried.
Consistent problems seem to be that Inform doesn’t actually recognise the bracketed “(NPC - a person)” in this context, or that it doesn’t realise that “reputation” and “howmuchtheylikeyou” are actually supposed to be numbers, and thus can be added together (even though that’s explicitly defined, it often seems to treat them as values that contain text).
I’m pretty sure there’s some fundamental kind of syntax that i am not understanding, that mathematical words like “plus” and “minus”, and things like “(NPC - a person)” actually only have meaning to Inform under certain specific conditions, and can’t simply be used wherever you want. But i can’t figure out what those conditions are, and it’s really not clear to me at all in the manual.
So, how do you add together numbers that belong to people (whether player or NPC) in the gameworld? How do you make Inform understand a general statement like “a = b + c” - where b and c could have different numerical values depending on which characters are involved?
How do you do algebra in Inform?