New to Inform. I’m mostly a programmer, not really a fiction writer. I was going to write a text adventure from scratch, and demoed a little 5 room starting shell, but a person suggested I try out Inform. I like the idea of having a game that can work on as many platforms as Inform can end up running on, but I’m not sure if Inform will work for the game idea.
The biggest thing is that I want the player to not be a “person”, bur rather a “persona” that projects into one of several controlable units which can then do the action taking. And when you leave each unit it can continue to do its thing (hold open a door, say). Sorta like the Elegy of Emptiness from Majora’s Mask, if you happen to have played that game. I think it could be really cool, but I think that it also sounds pretty outside the norm of what Inform intends to support. I’ve skimmed a little of the tutorial book’s information about kinds, and maybe it could be done with a variation on a vehicle? A vehicle that you can’t “get out of”, for one. Also, the inventory wouldn’t quite work right. You can get and use items, but when you drop them inside a vehicle they go into the vehicle instead of into the room.
So my question is: does this sound like something that can be reasonably overcome in Inform? Or should I stick with the custom code solution and just pick over Inform for ideas about where to possibly build the custom code base?
This seems like it should be pretty easy to do out of the box in Inform. You can define several persons and then switch the player between them with “Now the player is Zelda,” “Now the player is Link,” etc. etc. at the appropriate point of your code. You’d have to figure out exactly what you want for the individual avatars to keep doing their thing, but one way to implement that could be by giving each of them a stored action and then have them keep trying that stored action every turn while not controlled by the player, if relevant (you might not want them to try dropping the same rock every turn if that’s the last thing the player tried). Or if you’re talking about inanimate statues standing on buttons, that would be even easier; if the button is an enterable supporter, just write a check for whether there’s a person on the supporter; if you have the player stand on the button and then switch to another avatar, the old avatar will still be a person on the button.
All this is not very helpful right now, before you’ve read the manual and seen how to code this; it’s just meant to show what you can do in Inform, and how you can do what you seem to want with people instead of trying to hack the vehicle kind. (I think there’s a section on switching the player character that you might want to look at.)
If it helps when looking for specific things, the manuals are also available in web-browsable form. Here’s a link to the section jrb was talking about. (Though I don’t know how phone-friendly these are.)
However, when I run it, the player’s perspective shifts without it reporting that the perspective has shifted. You end up in the second room like you should, it just doesn’t do the “say” line. Am I misunderstanding how Carry Out and Report interact with a newly defined command?
This is a strange corner case, and then there are some more complications.
I think what is going on is this: When a rule is written “Report inhabiting:” or “Report going:” or something like that, it only applies to actions by the player. But in this case, by the time the Report stage rolls around, the action isn’t an action by the player anymore–it’s an action by the “yourself” object, which is known in the game as “your former self,” but that’s not the player anymore! So the rule isn’t firing. (By the way, try “inhabit avatar/look/inhabit your former self/look” and you can see that you switch to Deflector Control and back to Disconnected Void.)
A way to make the rule run is to write the rule as follows:
Report an actor inhabiting:
say "You shift your senses, and now inhabit [the noun]."
See Writing with Inform §12.14 on “Actions for any actor.” (We could write “Report someone inhabiting,” but then that would not run for an action performed by the actor… which means that if you type “inhabit avatar” when you’re already the avatar, it wouldn’t run, because Inform does recognize that as an action performed by the player.)
However, once we get this up and running, we see another problem: The message says “You shift your senses, and now inhabit yourself.” The thing is, when the game prints the name of the player, it doesn’t print the name of the player-object if it has one; it prints “yourself” (or “You” at the beginning of a sentence). This is because we don’t want the game to print messages like “Avatar goes west” when you’re the avatar and you go west; you want it to print “You go west.” (Or maybe you do want “Avatar goes west”! Then we can try to work out something for that…)
So, at the time the Report rule runs, since the player is Avatar, when it prints “You shift your senses, and now inhabit [the noun],” and the noun is Avatar, it prints “yourself” where the noun is.
One way to get around this is to print the message before changing the player’s identity. We can do this by wrapping both the message and the effect into an Instead rule, and printing the message first:
Instead of inhabiting:
say "You shift your senses, and now inhabit [the noun].";
now the player is the noun.
OK, more details coming. The thing about the Instead rule is that it will run before any check rules, so in theory the check rule would be ignored. In practice, however, your check rule doesn’t do anything anyway given the rest of your code; since the grammar line for inhabiting is “inhabit [any person]”, Inform will refuse to understand the command “inhabit grid” with the message “That noun does not make sense in that context,” and your check rule won’t run. (BTW, I put in the grid as an inanimate object to make sure this works.) So we might want to change the grammar line to “Inhabit [any thing]”–and then we have to change the check rule to an Instead or Before to make sure it runs before our Instead rule.
Also, I added a rule that blocks the player from inhabiting a person that they’re already inhabiting… and to do that I had to bypass the “yourself” problem. This time I chose to use the property “printed name of the player”–the printed name is a text that every object has, and the printed name of the Avatar is still “Avatar” even when the player is the Avatar–it’s just that ordinarily the game prints “You/yourself” instead and ignores the printed name property. So when we invoke the printed name property we bypass the machinery that prints “yourself.” Truth be told, we could’ve just made this change to the Report rule, but I didn’t think of it till I’d changed the code.
And let’s add “try looking” after the player changes, so they get a report of their new surroundings.
So we have:
[code]“Galaxy Break: Recovery” by Lokathor
Use American dialect. Use the serial comma. Use undo prevention.
The Disconnected Void is a room. The description is "You are alone to yourself, disconnected from all other things.[if unvisited]
bangbangbang a… sound? Coming from outside? Outside of the world? It’s like someone is slamming your head, though you can see nothing. Then, a distant voice,
‘You in there… wake up. Wake… you have to wake up. I’m just outside your casing. I’ve managed to get at least one Avatar working, use it to come find me. I’m nearly out of power now… must sleep… It’s up to you.’
(use ‘inhabit avatar’ to project yourself into the avatar)."
The player is in The Disconnected Void.
Deflector Control is a room. The description is “Someone once said that this place is not a ‘vital system’, but since it manages the primary defense grid of the ship, it seems pretty vital.”
In Deflector Control is a man called Avatar. In Deflector Control is a defense grid.
Understand “inhabit [any thing]” as inhabiting.
Inhabiting is an action applying to one visible thing.
Instead of inhabiting when the noun is not a person:
say “[The noun] isn’t a thing you can project your senses into!”
Instead of inhabiting:
say “You shift your senses, and now inhabit [the noun].”;
now the player is the noun;
Instead of inhabiting the player:
say “You are already [printed name of the player].”[/code]
and we get:
(The more specific “instead of inhabiting” rules run before the general one, which is why the code blocks the cases we want blocked.)
So after telling you Inform can do this simply, that’s a lot of things to look out for! There are some tricks here, but I do think that the number of things Inform handles automatically here outweigh the tricksy bits.