New action problems.

I’m trying to make a lantern which can be turned on by using the verb “light” so it would be written as “light lantern”, the problem is I can’t seem to get the action set up right. I’m an extreem noob but this is what I have.

[code]The Bedroom is a room.

A thing can be lightable or nonlightable. A thing is usually nonlightable.

Lighting is an action applying to one thing. understand “light [something]” as lighting.
Check lighting:
if the noun is nonlightable, say “I just wanted to light it on fire, but decided against it.” instead.

The lantern is in the Bedroom. The lantern is lightable. The description of the lantern is “The lantern was nothing special, simply a glass gas lamp made by the local smith and bolted to the wall.”
Instead of lighting the lantern: if the lantern is unlit, now the lantern is lit; say “I reached up to the nob which controlled the gas flow, giving it a slight twist. After a quick tap on the starter the flame burst into life.”
[/code]

unfortunately when I type “light lantern” I get the message, “This dangerous act would achieve little” I mean it seems like inform already has a rule for lighting, though I cant find it in the documentation, but if I delete the rule for lighting I get the error “You wrote ‘Instead of lighting the lantern’ , which seems to introduce a rule taking effect only if the action is ‘lighting the lantern’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.” I am at a complete loss.

In this sort of situation, the manual isn’t the right place to find what you need. You want the Index tab and the testing commands.

For actions, the most useful commands are ACTIONS and RULES. Enter those commands, then try your action:

So we now know two things: the action is called ‘burning’, and it fails because of the ‘block burning rule.’

There are lots of ways around this - you could tell the game to understand ‘light’ as something new, for instance, or you could replace the block burning rule with something that allowed lanterns. An Instead rule won’t work here, because Instead kicks in after Before. Let’s go with the something-new approach, but we’ll redirect it to the burning action most of the time:

[code]Understand the command “light” as something new.

(define your lighting action)

Instead of lighting something (called foo): try burning foo.

Instead of lighting the lantern…[/code]

Are you sure you don’t want to just make the lantern a “device” so that it can be "switch"ed on and off? :slight_smile:

Just adding the Understand line seemed to fix the problem, thx. I want to have them use the verb light, though I’ll probably use and understand to add switch in there too.

Edit: nevermind now it wont change the lit status, so could you give me some advice on this device stuff, super noob.

From the documentation in I7:

after you make a device, you can then specify what happens in the switched on and off positions. :slight_smile:

What manuals do u have for I7? There are some great ones out there. I’m currently reading Aaron Reed’s “Creating Interactive Fiction With Inform 7”.

just the built in one, I’d get aaron reeds if I had money :stuck_out_tongue:, sorry for asking about the device I should have just done a quick search.

Ain’t no problem to me. I’m a noob, too. I just happened to have at least one solution for ya, I’m sure there are more (better) out there. But yeah, check the documentation, and do google searches, and don’t be afraid to ask. Most of us here are cool, I think. :smiley:

Ok, so after quiete a while messing with the device I got it to do pretty much what I want using

[code]Understand the command “light” as something new.
Understand “light [something]” as switching on.

The Bedroom is a room

The lantern is a switched off device in the Bedroom. The description of the lantern is “The lantern was nothing special, simply a glass gas lamp made by the local smith and bolted to the wall.”
Carry out switching on the lantern: if the lantern is switched off, say "I reached up to the nob which controlled the gas flow, giving it a slight twist. After a quick tap on the starter the flame burst into life. "; otherwise say “blah”[/code] But I have 2 problems with what this displays. First I don’t want the output to say “You switch the lantern on” and second I would like a way to make the “light” command also turn the lantern off.

I’d be more comfortable waiting for a more experienced person to help give you advice on all that.

Well glad to know it’s not an easy fix :stuck_out_tongue:

Well, it’s probably easy enough. It’s just that Hell’s Kitchen is on, so I gotta go for a bit, lol. :laughing:

An after rule by default overrides the standard reports of successful actions.
I’d chop up your carry out rule into one instead and one after rule:

[code]Instead of switching on the lantern when the lantern is switched on: say “Blah blah.” [This prevents switching the lantern on and instead produces the “blah blah” response.]

After switching on the lantern: say "I reached up to the nob which controlled the gas flow, giving it a slight twist. After a quick tap on the starter the flame burst into life. " [This rule only fires if the action succeeds, and it prevents the report rule of the action from running.][/code]

Though since you wanted “light” to mean ‘switch off’ when the lantern is already on perhaps you should rather try this:

[code]After switching on the lantern: say "I reached up to the nob which controlled the gas flow, giving it a slight twist. After a quick tap on the starter the flame burst into life. "

Instead of switching on the lantern when the lantern is switched on: try switching off the lantern.

After switching off the lantern: say "I twisted the nob of the gas lantern. The flame dwindled and died. "[/code]

Thanks so much, that worked perfectly