intfiction.org

The Interactive Fiction Community Forum
It is currently Thu May 23, 2013 3:28 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Breaking objects
PostPosted: Tue Feb 14, 2012 1:37 am 
Offline

Joined: Tue Feb 14, 2012 12:52 am
Posts: 2
I need a way to break/split objects. I think I have it down, but when I try the command ">break Kyoketsu-shogei"
Violence isn't the answer to this one.


Code:
Understand "break [something]" as breaking. breaking is an action applying to one thing. Breaking is allowed.
Before breaking the Kyoketsu-shogei:
   say "you break it back into its original parts, a chain and your shiv.";
   move the Kyoketsu-shogei to Davy Jones' Locker;
   move the chain to player;
   move the shiv to player.


Can someone help meh?


Top
 Profile Send private message  
 
 Post subject: Re: Breaking objects
PostPosted: Tue Feb 14, 2012 2:03 am 
Online

Joined: Sat Dec 22, 2007 11:52 pm
Posts: 766
The problem is that there is a default command break that's a synonym for attack, and Inform thinks that your breaking command is the same as attacking, which gives the default response ("violence isn't the answer"). A simple solution is to define break as something new.

Code:
Cage is a room.

Kyoketsu-shogei is a thing in Cage.
chain is a thing.
shiv is a thing.

Understand the command "break" as something new.
breaking is an action applying to one thing.
Understand "break [something]" as breaking.

After breaking the Kyoketsu-shogei:
   say "you break it back into its original parts, a chain and your shiv.";
   remove the Kyoketsu-shogei from play;
   move the chain to player;
   move the shiv to player.
   
test me with "break kyoketsu-shogei / i "


Also, I'm guessing you just want to remove the weapon from play, and an after routine made more sense to me than a before. Your 'is allowed' wasn't doing what I guess you thought it was doing -- it was just creating a property called 'allowed' that didn't affect the game.

When you compile a game with just one room you can go to the Index / Actions tab in the IDE and see all the commands available in the game. If you do that you'll see the break synonym I'm talking about. Also when you see a response you want to get rid of (like the 'violence isn't') you can do the rules and actions commands, and get a better picture of what's going on. For example with this code,

Code:
Cage is a room.

Kyoketsu-shogei is a thing in Cage.

   
test me with "break kyoketsu-shogei / actions / break kyoketsu-shogei / rules / break kyoketsu-shogei"


You get this

Quote:
Welcome
An Interactive Fiction
Release 1 / Serial number 120213 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Cage
You can see Kyoketsu-shogei here.

>test me
(Testing.)

>[1] break kyoketsu-shogei
Violence isn't the answer to this one.

>[2] actions
Actions listing on.

>[3] break kyoketsu-shogei
[attacking Kyoketsu-shogei]
Violence isn't the answer to this one.
[attacking Kyoketsu-shogei - failed the block attacking rule]

>[4] rules
Rules tracing now switched on. Type "rules off" to switch it off again, or "rules all" to include even rules which do not apply.

>[5] break kyoketsu-shogei
[attacking Kyoketsu-shogei]
[Rule "block attacking rule" applies.]
Violence isn't the answer to this one.
[attacking Kyoketsu-shogei - failed the block attacking rule]

>


Top
 Profile Send private message  
 
 Post subject: Re: Breaking objects
PostPosted: Tue Feb 14, 2012 3:39 pm 
Offline

Joined: Sat Dec 22, 2007 9:44 pm
Posts: 180
I suggest moving the chain and shive to the part of the Kyoketsu-shogei, then remove the K-s from play. That gives correct results if the player isn't holding the K-s.


Top
 Profile Send private message  
 
 Post subject: Re: Breaking objects
PostPosted: Wed Feb 15, 2012 8:36 pm 
Offline

Joined: Wed Jan 19, 2011 3:36 pm
Posts: 99
Although you can just unlist all of the attack verbs (understand them as "something new"), it may be simpler to do this:
Code:
A thing can be breakable.  A thing is usually not breakable.

Instead of attacking a breakable thing, try breaking it.


Top
 Profile Send private message  
 
 Post subject: Re: Breaking objects
PostPosted: Wed Feb 15, 2012 11:59 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2085
If you're going to do that, you might as well dispense with the breaking action and write

Instead of attacking a breakable thing: [...the actual disassembly code]


Top
 Profile Send private message  
 
 Post subject: Re: Breaking objects
PostPosted: Thu Feb 16, 2012 11:52 am 
Offline

Joined: Fri Jul 16, 2010 2:09 pm
Posts: 1950
zarf wrote:
If you're going to do that, you might as well dispense with the breaking action and write

Instead of attacking a breakable thing: [...the actual disassembly code]

But only if you're not going to add any alternative grammars like "disassemble" or "take apart," etc.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: DavidC, George, Shadow Wolf and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group