SO. I have been trying to make a kind which allows all torches to behave the same, and all broken torches behave the same as well. I also want to be able to have multiple (of the same) containers to hold them. I just keep having troubles with it, can someone give me a hand?
The player is carrying the Lighter. The lighter is a device.
The Broken Lighter is in Stockpile.
In the Entrance is 2 Holster. Holster is a kind of container.
A Lantern is a Torch.
A Broken Lantern is a Broken Torch.
Carry out switching on a Torch:
if the Torch being switched on is switched off and the player is carrying the Lighter begin;
say "Using your lighter, you light it. The light clears the haze. ";
now the Torch is lit;
say "Your lighter is broken… ";
Carry out switching off a Torch:
if the Torch is switched on begin;
say "You desperately wave the torch around. After much blood and a few tears, it goes out. ";
now the Torch is not lit;
say "It’s already off, genius. ";
Instead of switching on a Broken Torch: say "[once] Trying to light it with the lighter, you only manage to puncture the fuel case; all the gas dribbles out. [but later] Your lighter is broken… [end once] ";
Remove lighter from play.
Now the Broken Lighter is carried.[[/code]
This probably belongs in a different forum. I find myself knowing how to give beginner player advice, but not how to help you write Inform7
You need to have “A torch is a kind of thing.” You could also have “A broken torch is a kind of torch” but it might be nicer to have “A torch can be unbroken or broken. A torch is usually unbroken.”
Then you wouldn’t need “A lantern is a torch” or “A broken lantern is a broken torch.” If you leave those in, then at best you’ll wind up creating one lantern and one broken lantern which is probably not what you’re trying to do. If you don’t declare “A torch is a kind of thing” then I think “A lantern is a torch” won’t compile – Inform thinks you’re trying to create two different things “A lantern” and “a torch” and declare them to be identical, which is a no-no.
Instead of saying "[once] Trying to light it with the lighter, you only manage to puncture the fuel case; all the gas dribbles out. [but later] Your lighter is broken… [end once] " you could say “[one of]Trying to light it with the lighter, you only manage to puncture the fuel case; all the gas dribbles out.[or]Your lighter is broken…[stopping]”; but it might be better to break this down into cases, so that an appropriate message prints depending on whether you’re carrying the lighter, the broken lighter, or neither. (You might also want to do the same thing in your “Carry out switching on a torch” rule; it’ll say “Your lighter is broken” if the player isn’t carrying the lighter, or for that matter if the torch is already on.)
Instead of “The torch being switched on” you should just say “the noun” – that’s the phrase for the object of whatever action you’re performing.
Your last line should say “Now the player carries the broken lighter.” Also, the line before it should end with a semicolon rather than a period, so Inform knows they’re all part of the same rule.
(I’m not sure if your ifs and otherwises are formatted/punctuated properly, because I don’t use the “end if.”)
I haven’t tested this out myself, but I think if you make these fixes you might be able to compile your code and see if it works – if there’s any trouble, feel free to post it and explain what errors you’ve got! Hope this is helpful.
You could also make the torch a kind of device. This will allow all torches to automatically be allowed to be switched on and off.
I do and strongly recommend using it. The punctuation is correct and it will work as is. However, I’d suggest you either unindent the “end if” so it matches the indentation of the "if and “otherwise” or you go without indentation altogether.
Oh, and I also want to be able to have lighter fluid (gas or whatever) spill out into the room that the player is currently in. I have no idea how to do this…
And yes, climbingstars’ comment would probably help.
How about something like this!
The First Room is A Room. The Second Room is A Room. The Third Room is A Room. The Fourth Room is A Room. The Second Room is east of The First Room. The Third Room is south of The Second Room. The Fourth Room is west of The Third Room. The First Room is north of The Fourth Room.
When play begins: move the fuel backdrop to all fuelled rooms.
A room is either fuelled or unfuelled. A room is always unfuelled.
Some fuel is a not scenery backdrop. The initial appearance of the fuel is “The room is filled with fuel!”. The description of the fuel is “Big potential for big boom!”.
A torch is a device in the first room. The description of the torch is “Big torch, full of fuel!”.
Every turn when the location of the torch is unfuelled and the torch is switched on:
now the location of the torch is fuelled;
update backdrop positions;
say “[The location of the torch] starts to fill with fuel from the lit torch!”.
Test me with “x torch / e / s / w / n / take torch / turn on torch / e / s / w / n / x fuel”.[/code]
Here the fuel is a backdrop and its presence is controlled by the fuelled or unfuelled property.
Hope this helps.