intfiction.org

The Interactive Fiction Community Forum
It is currently Thu May 23, 2013 5:52 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Mar 09, 2012 8:34 pm 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
I'm once again out of my depth, this time in creating a two-object PLAY verb that'll take RPS as one possible gaem to play.

This requires that the dObj (the Gaem instantiation) and the iObj (the (N)PC) each qualify themselves for reference via check(), and that they coordinate with each other somehow to get the gaem code going.

It also requires that the gaem object have some kind of vocabwords or topic part, that talks to the parser, and that the verb rule somehow hook into the code there. -- I don't know how to begin this process.

I'm pretty confident I can handle it once I know how to structure it. I don't have an approach. Any thoughts?


Conrad.

PS - this is the code I've got so far.


Rant: show
Code:
DefineTIAction(playGaem);

VerbRule(play)
   'play' singleDobj 'with' singleIobj        // <-- I don't know what singleDobj should hook into!
   : playGaemAction
   verbPhrase = 'play/playing (what) (with whom)'
;

/////////////////////////////////////////////////////////////////////////////////////////////

modify Thing
   iobjFor(playGaem) {
      verify() { illogical('{The iobj/he} would be a pretty dull counterpart. '); }
   }
;

modify Person
 
    // ... various Person jazz

    iobjFor(playGaem) {
      verify() {}

      check() {
          // ... all that jazz, for which we'll now say
         return (true);
         }
      }
       
      action() {
            dObj.p1 = gActor;     //<-- as you can see, I tried bluffing and it didn't work
            dObj.p2 = self;
            dObj.mainLoop;
       }
       
    }

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sat Mar 10, 2012 1:14 am 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
I have no idea what the symbol dObj is. If it's the object that actually does the game-playing, then what you're doing appears, at first glance, to be fairly sensible.

On the other hand, it's possible that what you mean is gDobj, not dObj.


Top
 Profile Send private message  
 
PostPosted: Sat Mar 10, 2012 7:05 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
Ok, that's fair...

But even before that, how do I create a parser word for an abstract object like a gaem?

There's nothing for gDobj to hook into.


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sat Mar 10, 2012 10:09 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
--I've just realized this can be considered the same problem that Jim helped me to solve, in creating the THINK command (where I created Unthing objects that were always in scope). I'm going to try to apply that approach.


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sat Mar 10, 2012 10:36 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
--and in the end I'm having the same problem with this I had with THINK: I can't adjust scope.


Code:
DefineTIAction(playGaem)
    objInScope(obj) { return true } ;
;


Returns "You don't see that here."

Nor does

Code:
DefineTIAction(playGaem)
        return ( ( obj.ofKind(GaemThing) )  && obj == gDobj )
                || ( obj.ofKind(Actor) )) && obj == gIobj ) ) ;
;       


, which tries to put game objects in scope if they're the dobj, and actors if they're the iobj. Actors would need to be further specified to be in sensory range, but I'm not even able to get these objects in scope anywhere...

(Maybe I should build them into the Actor class?)


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sat Mar 10, 2012 12:17 pm 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
The code below works. Perhaps you could start with it and refine it.

Code:
boudoir: Room 'The Boudoir'
    "Wow, look at that red plush wallpaper! You can go north. "
    north = porch
;

+ me: Actor
;

porch: Room 'The Porch'
    "Ah, the spacious porch! You can go south. "
    south = boudoir
;

+ bob: Person 'bob/guy/man' 'Bob'
    "He looks quite intelligent. "
    isHim = true
    isProperName = true
    iobjFor(PlayWith) {
        verify() {}
        check() {}
        action() {
            "\"Okay, dude. Ready when you are. Got the board with you?\"" ;
        }
    }
;

boardGame: Thing 'checkers/chess/monopoly/go/game' 'board game'
    dobjFor(PlayWith) {
        verify() {}
        check() {}
    }
;

DefineTIAction(PlayWith)
    objInScope(obj) { return true; }
;
VerbRule(PlayWith)
    'play' singleDobj 'with' singleIobj
    : PlayWithAction
    verbPhrase = 'play/playing (what) (with what)'
;


Note that the boardGame object is not anywhere in the game world; it's placed in scope by objInScope. (Bob, however, isn't. You have to be in the room with him to play a game.)

You can test it with 'play chess with bob / n / play chess with bob'.


Top
 Profile Send private message  
 
PostPosted: Sat Mar 10, 2012 12:49 pm 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
Sweet -- Thank you, Jim!


Conrad.

_________________
http://tiltedcandle.wordpress.com


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users 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