intfiction.org

The Interactive Fiction Community Forum
It is currently Tue May 21, 2013 10:38 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Problem with a horse
PostPosted: Sun Jul 01, 2012 12:48 am 
Offline
User avatar

Joined: Fri Jul 15, 2011 2:46 pm
Posts: 230
Location: Cental Ohio
I'm using Graham Nelson's ridable vehicles extension to create a horse. That's fine but then I created a saddlebag, which I made "part of" the horse's saddle, which is being worn by the horse.

Then I put objects in the bag, but if I want to take anything from the bag, the parser says "that belongs to your horse" so I have to manually override the objects with "instead of taking" rules.

This is fine for the few objects I put in the bag, but I found if the player starts taking additional objects and putting them in the bag, I'm not handling them. Is there a way to do this more generically, or should I not make the saddlebag part of the horse?

Or, should i make a "instead of taking" for every object?

_________________
David Good
http://david-good.com/portfolio/interactive-fiction/
http://www.facebook.com/duodave


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 4:06 am 
Offline
User avatar

Joined: Sat May 08, 2010 9:25 pm
Posts: 959
Location: The Seattle Massive
A highly useful testing command, when you need to find the culprit for a particular behaviour, is RULES. Using it will make Inform display every rule that fires in response to each of your commands. (To show even the rules that are checked but don't apply, use RULES ALL).

If you turn this on and then try to take something from the saddlebag, you'll see that the list is pretty short and that there's an obvious culprit: the 'can't take people's possessions rule'. (In Inform, animals are a kind of person, rather than the other way around.)

Now, if the horse were the only other person in your game, you could just unlist the rule and nobody would be any the wiser. If you have other, non-saddlebagged characters, the thing to do is find that rule in the Standard Rules, copy it into your source, slightly modify it, and get your version to supersede the original:

Code:
This is the equestrians sometimes take people's possessions rule:
   let the local ceiling be the common ancestor of the actor with the noun;
   let H be the not-counting-parts holder of the noun;
   while H is not nothing and H is not the local ceiling:
      if H is a person and H is not Mighty Twinklehooves, stop the action with library message taking action number 6 for H;
      let H be the not-counting-parts holder of H;

The equestrians sometimes take people's possessions rule is listed instead of the can't take people's possessions rule in the check taking rules.


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 5:18 am 
Offline
User avatar

Joined: Sun Nov 22, 2009 12:58 pm
Posts: 399
Location: Malmö, Sweden
Code:
This is the equestrians sometimes take people's possessions rule:
   if the noun is not enclosed by Mighty Twinklehooves, abide by the can't take people's possessions rule.

The equestrians sometimes take people's possessions rule is listed instead of the can't take people's possessions rule in the check taking rules.

I could be wrong, but wouldn't this method be a lot simpler, or am I overlooking something?

_________________
~Björn Paulsen


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 5:47 am 
Offline
User avatar

Joined: Sat May 08, 2010 9:25 pm
Posts: 959
Location: The Seattle Massive
Eleas wrote:
Code:
This is the equestrians sometimes take people's possessions rule:
   if the noun is not enclosed by Mighty Twinklehooves, abide by the can't take people's possessions rule.

The equestrians sometimes take people's possessions rule is listed instead of the can't take people's possessions rule in the check taking rules.

I could be wrong, but wouldn't this method be a lot simpler, or am I overlooking something?

Yes, much better. 'Abide by' is one of those things that I theoretically know about, but never actually remember to use.

As for enclosure -- yeah, that makes more sense. (I'm trying to come up with a situation in which they'd be non-equivalent, but all I'm getting is that if poor Twinklehooves were to be half-absorbed into the body of a horrific composite alien, the enclosure rule would allow you to rifle through his saddlebags but the modified Standard Rules one wouldn't. This seems, to put it mildly, a circumstance specific enough that it doesn't need to be addressed by a general rule.)

Also: both versions will, by default, allow the player to walk off with the saddle, the saddlebags and any other tackle the horse is wearing. Easily fixed, if you don't want to allow it.


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 6:19 am 
Offline
User avatar

Joined: Sun Nov 22, 2009 12:58 pm
Posts: 399
Location: Malmö, Sweden
maga wrote:
(I'm trying to come up with a situation in which they'd be non-equivalent, but all I'm getting is that if poor Twinklehooves were to be half-absorbed into the body of a horrific composite alien,

Make a game with that premise and I will name my firstborn after you.

_________________
~Björn Paulsen


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 9:44 am 
Offline

Joined: Wed Feb 29, 2012 2:00 pm
Posts: 672
If you have many horses, you could generalise it one further like this.

Code:
A horse is a kind of rideable animal.

This is the equestrians sometimes take people's possessions rule:
   if the noun is not enclosed by a horse, anonymously abide by the can't take people's possessions rule.

The equestrians sometimes take people's possessions rule is listed instead of the can't take people's possessions rule in the check taking rules.


Hope this helps.

_________________
"Will you stop breaking the fourth wall? It's costing me an absolute fortune to replace it!"


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 4:28 pm 
Offline
User avatar

Joined: Fri Jul 15, 2011 2:46 pm
Posts: 230
Location: Cental Ohio
Eleas wrote:
Code:
This is the equestrians sometimes take people's possessions rule:
   if the noun is not enclosed by Mighty Twinklehooves, abide by the can't take people's possessions rule.

The equestrians sometimes take people's possessions rule is listed instead of the can't take people's possessions rule in the check taking rules.

I could be wrong, but wouldn't this method be a lot simpler, or am I overlooking something?


Oh thanks, that saved a lot of work. My wife had suggested making the saddlebag an object that would somehow follow the horse around instead of being worn or part of, and I considered that but it would require an "every turn" rule and that would slow the game down. Plus if I ever decided to move the saddlebag (like if the player removed it from the horse) I'd have to somehow check for that.

_________________
David Good
http://david-good.com/portfolio/interactive-fiction/
http://www.facebook.com/duodave


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Sun Jul 01, 2012 4:47 pm 
Offline
User avatar

Joined: Sat May 08, 2010 9:25 pm
Posts: 959
Location: The Seattle Massive
duodave wrote:
Oh thanks, that saved a lot of work. My wife had suggested making the saddlebag an object that would somehow follow the horse around instead of being worn or part of, and I considered that but it would require an "every turn" rule and that would slow the game down.

No, it wouldn't; or, rather, the effect would be undetectably tiny. This is in fact how backdrops work; it would be a bit of a hacky solution, I agree, but you wouldn't get any performance issues from it.

Performance issues in I7 are most likely to be caused by rules that have to check through large arrays repeatedly. Rules that involve repeatedly running through very large tables or lists, or that involve various-to-various relations applying to a common kind (such as things), are the big things to watch out for. But you could throw in a hundred move-the-saddle-to-the-location-of-the-player-type rules and still come up roses.


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Mon Jul 02, 2012 4:03 am 
Offline
User avatar

Joined: Sun Nov 22, 2009 12:58 pm
Posts: 399
Location: Malmö, Sweden
What maga said. The problem isn't a single command, or even a load of solitary commands. The problem is when you do stuff that recurses or repeats over itself. Scope can be such a thing -- every time you have a condition that asks whether something is visible, you're searching the model world. In such cases, asking several times in a row is wasteful. You're better off just asking once and storing the result in a temporary variable.

_________________
~Björn Paulsen


Top
 Profile Send private message  
 
 Post subject: Re: Problem with a horse
PostPosted: Fri Nov 09, 2012 3:56 am 
Offline
User avatar

Joined: Sat Nov 03, 2012 7:08 pm
Posts: 2
Location: Oklahoma
Just found this thread after I started writing an adventure with a (non-rideable) pack llama with saddlebags that amount to extra inventory space for the player. Knew I had to override the "can't take people's possessions" rule somehow, but the parser kept yelling at me for the syntax.
Thank you very much for already having the answer in front of me.


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: aschultz and 1 guest


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