The Basics of Inform 7:
http://inform7.com/ The Official Website
The Inform 7 program is a compiler, which source code is written into and compiled from creating a game file. The game files are played on interpreters, so make sure to use the right program for the right file.
Now onto the basics of coding:
First objects, which are sorted into kinds. The default kinds used by Inform are:
Rooms: every game requires at least one. Rooms are areas where various things are with little other detail except what the author adds.
Directions: The default directions link rooms and are used with movement commands. Twelve of these directions are created by default, eight compass directions, up and down, plus in and out.
Regions: These are basically groups of rooms, which is handy for writing code that applies to only certain regions.
Things: This is a major kind and is the parent of all other kinds. This also represents whatever inhabits the various rooms. Most objects an author creates will be various things and kinds of things.
- Doors: These link rooms via directions, sort of like a room except things can never be in a door, simply passing through. They are implemented by saying the door is one direction form a room and another direction from another room, directions that shouldn’t already link anything else. Doors can also be other things, such as bridges and arches and are typically used when needing something that can be closed and perhaps locked. Doors are also unique for being in two rooms at once.
- Container: Something that can contain other things. If enterable, the player can even get inside, such as a closet in a room or a bath tub.
- - Player’s Holdall: A kind of container, something the player can carry and store excess items in. Has special convenience behaviors that make it different form other containers.
- - Vehicle: Another kind of container, the player can get in and ride it to other rooms with special going messages.
- Supporter: Like a container, except things go on it. Typically not open/closed either. Also can be made enterable, such as a chair or bed.
- Backdrop: Basically a special type of scenery that can be in multiple rooms, regions or even every where. For instance a description of grass in a grassland region that responds to Look Ground/Grass.
- Person: Anything meant to move around and maybe do things. Can also have a gender like male/female and trigger pronouns like he/she.
- - Animal: A type of person. No seriously. Can be male/female/neuter
- - Man: A type of person, typically male.
- - Woman: A type of person, typically female.
A device: Basically something that can be switched on/off.
-----------
A new kind can be defined. For instance “A child is a kind of person. Alice is a child in the classroom.”.
For a story with various aged people where age might matter, we could define a kind of age value instead:
Maturity is a kind of value. The maturities are baby, toddler, child, teen, young adult, adult, middle aged and senior.
A person has a maturity. The maturity of a person is usually young adult.
These values are in order for a reason, because in code we could say “If the maturity of (person) is greater than teen, then etc.” (the first property is always the least and the last the greatest)
We can also code “Understand the maturity property as describing the person.” This would allow the player to refer to a character by their maturity such as ‘child’. Using 'referring to' instead of describing would allow the code to use the property, but not the player.
We could also do this:
A person has a number called age. The age of a person is usually 24. (this sets a default value, it should be the safest most common value)
Definition: A person(called brat) is underage if the age of the brat is 17 or less.
Defintion: A person(called geezer) is senior if the age of the geezer is 65 or more.
With a group of people, this way would allow us to write code that says “Let the elder be the most senior person in the location;” (which would pick the oldest person in the room).
We can also define simpler properties for code purposes.
A person can be drunk. (‘can be’ means by default a person is not drunk, code wise we would refer to the person as drunk or not drunk.).
This could also be “A person can be drunk or sober.” which provides two opposite states. Also possible is “A person can be sober, tipsy, drunk or smashed.”. This is simpler but not as useful as creating a value set because it can’t be judged by level. It simply adds more states for the code to set the person at for future code to refer to, at this point a drunkness number would probably be more effective in code.
http://inform7.com/ The Official Website
The Inform 7 program is a compiler, which source code is written into and compiled from creating a game file. The game files are played on interpreters, so make sure to use the right program for the right file.
Now onto the basics of coding:
First objects, which are sorted into kinds. The default kinds used by Inform are:
Rooms: every game requires at least one. Rooms are areas where various things are with little other detail except what the author adds.
Directions: The default directions link rooms and are used with movement commands. Twelve of these directions are created by default, eight compass directions, up and down, plus in and out.
Regions: These are basically groups of rooms, which is handy for writing code that applies to only certain regions.
Things: This is a major kind and is the parent of all other kinds. This also represents whatever inhabits the various rooms. Most objects an author creates will be various things and kinds of things.
- Doors: These link rooms via directions, sort of like a room except things can never be in a door, simply passing through. They are implemented by saying the door is one direction form a room and another direction from another room, directions that shouldn’t already link anything else. Doors can also be other things, such as bridges and arches and are typically used when needing something that can be closed and perhaps locked. Doors are also unique for being in two rooms at once.
- Container: Something that can contain other things. If enterable, the player can even get inside, such as a closet in a room or a bath tub.
- - Player’s Holdall: A kind of container, something the player can carry and store excess items in. Has special convenience behaviors that make it different form other containers.
- - Vehicle: Another kind of container, the player can get in and ride it to other rooms with special going messages.
- Supporter: Like a container, except things go on it. Typically not open/closed either. Also can be made enterable, such as a chair or bed.
- Backdrop: Basically a special type of scenery that can be in multiple rooms, regions or even every where. For instance a description of grass in a grassland region that responds to Look Ground/Grass.
- Person: Anything meant to move around and maybe do things. Can also have a gender like male/female and trigger pronouns like he/she.
- - Animal: A type of person. No seriously. Can be male/female/neuter
- - Man: A type of person, typically male.
- - Woman: A type of person, typically female.
A device: Basically something that can be switched on/off.
-----------
A new kind can be defined. For instance “A child is a kind of person. Alice is a child in the classroom.”.
For a story with various aged people where age might matter, we could define a kind of age value instead:
Maturity is a kind of value. The maturities are baby, toddler, child, teen, young adult, adult, middle aged and senior.
A person has a maturity. The maturity of a person is usually young adult.
These values are in order for a reason, because in code we could say “If the maturity of (person) is greater than teen, then etc.” (the first property is always the least and the last the greatest)
We can also code “Understand the maturity property as describing the person.” This would allow the player to refer to a character by their maturity such as ‘child’. Using 'referring to' instead of describing would allow the code to use the property, but not the player.
We could also do this:
A person has a number called age. The age of a person is usually 24. (this sets a default value, it should be the safest most common value)
Definition: A person(called brat) is underage if the age of the brat is 17 or less.
Defintion: A person(called geezer) is senior if the age of the geezer is 65 or more.
With a group of people, this way would allow us to write code that says “Let the elder be the most senior person in the location;” (which would pick the oldest person in the room).
We can also define simpler properties for code purposes.
A person can be drunk. (‘can be’ means by default a person is not drunk, code wise we would refer to the person as drunk or not drunk.).
This could also be “A person can be drunk or sober.” which provides two opposite states. Also possible is “A person can be sober, tipsy, drunk or smashed.”. This is simpler but not as useful as creating a value set because it can’t be judged by level. It simply adds more states for the code to set the person at for future code to refer to, at this point a drunkness number would probably be more effective in code.
0 comments:
Post a Comment