adv3Lite: Crawling under a Table

I need the PC to be able to crawl under a table. I’ve implemented the CrawlUnder action and created tableUnderside as a separate room. (This seemed more straightforward than trying to make a remapUnder subcomponent into a Booth.) Here’s the basic code:

[code]dobjFor(CrawlUnder) {
verify() {}
action() {
"Moving with care, you get down on your knees and crawl under the table.

";
gPlayerChar.moveInto(tableUnderside);
tableUnderside.lookAroundWithin();
}
}
;

tableUnderside: Room ‘Beneath the Table’
"Not much is to be seen down here, other than bits of trash… "[/code]
This almost works. But note that “

” at the end of the movement description. If it’s not there, there’s not enough vertical linespace between the output “Moving with care…” and the following room name (“Beneath the Table”). But with the “

”, there’s too much space. So how do I get the standard vertical spacing between the line describing the action and the following room name?

If I don’t use lookAroundWithin, the room name and description are not printed at all. It appears adv3Lite lacks a moveIntoForTravel method…

Have you experimented with <.p> (rather than just

), \n and \b? I’m not at home right now so once again I don’t have a computer to try it out on, but if I get back before you reply, I shall experiment and edit this message accordingly.

EDIT: Now back home: a quick test suggests that using <.p> (rather than just

) does the trick.

Adv3Lite’s moveInto() is pretty much equivalent to adv3’s moveIntoForTravel(), and I’m 99.99% certain you wouldn’t get a room description with adv3’s moveIntoForTravel() either. If you want to move the playerCharacter and show the new room description with a single statement you could use:

   tableUnderside.travelVia(gActor);

EDIT: Combining the two we get:

dobjFor(CrawlUnder)
    {
        verify() {}
        action()
        {
            "Moving with care, you get down on your knees and crawl under the
            table.<.p> ";            
            tableUnderside.travelVia(gActor);
        }
    }

This seems to do what you want.

Thanks – travelVia solves the problem.

I did something a little like this for a “hide and seek” type mini-game though quite a bit differently than above using Postures instead. Just make custom postures of (hiding behind, hiding under and hiding in), then it will show in the room description something more interesting. ex:

Foyer (hiding under the table)

It takes a bit more work though:


hidingUnderTable: Posture
  postureDesc = "hiding under the table"
  tryMakingPosture(loc) { return tryImplicitAction(SitOn, loc); }
  setActorToPosuture(actr, loc) { nestedActorAction(actr, SitOn, loc); }
  msgVerbIPresent = 'hide{s} under'
  msgVerbIPast = 'hid under'
  msgVerbTPresent = 'hide{s} under'
  msgVerbTPast = 'hid under'
  participle = 'hiding under'
;

DefineTAction(HideUnder)
;
// Copied from SitOn verbrule in: en_us.t
VerbRule(HideUnder)
  'hide' ('under') singleDobj
  : HideUnderAction
  verbPhrase = 'hide/hiding (under what)'
  askDobjResponseProd = singleNoun
;
modify Thing
   dobjFor(HideUnder){
      verify(){ illogical('{You/he} can\'t hide under {that dobj/him}. '); }       
   }
;

modify playerActionMessages
  cannotHideUnderMsg = '{That dobj/he} {is}n&rsquo;t something {you/he} {can} hide under. '
  alreadyHidingUnderMsg = '{You\'re} already hiding {under dobj}. '
  /* default report for standing/sitting/lying in/on something */
  roomOkayPostureChangeMsg(posture, obj) { 
        gMessageParams(obj);
        if(posture == nil){
             if(gAction.tokenList != nil){
                if((gAction.tokenList.length >= 2)){
                     local iLength = gAction.tokenList.length;
                     for(local i = 1;i <= iLength;i++){
                         foreach(local obj in gAction.tokenList[i]){
                            if(obj == 'hide') posture = hidingUnderTable;
                         }
                     }
                }
             }
        }
        return 'Okay, {you\'re} now ' + posture.participle + ' {on obj}. ';        
  }
;

… and here’s a table you can hide under:


+ dayRoomTable: Surface
    bulk = 10000 // make it too bulky to carry vs. too heavy
    isListed = nil
    name = 'kids table'
    vocabWords = '(tiny) (little) (pink) (plastic) (kid) (sized) (kids) (girl\'s) (girls) (girl) (kid\'s) table'
    desc = "A little pink plastic table. It\'s kid sized. There\'s a <a href=\"hide under table\">hiding spot</a> beneith it."
    specialDescOrder = 50 
  dobjFor(LookUnder) remapTo(LookUnder, underTable) 
  iobjFor(PutUnder) remapTo(PutUnder, DirectObject, underTable) 
    dobjFor(HideUnder){
    preCond = [touchObj]
        verify() { }
        check(){
            if(gPlayerChar.isIn(underTheTable)){
                "You are already there! ";
                exit;
            }
        }
        action(){
             gActor.moveIntoForTravel(underTheTable);
             "You are now hiding under the table. ";
              gPlayerChar.posture = hidingUnderTable;
        }
    }
; 
++ underTable : NameAsOther, Underside, Component
    targetObj = dayRoomTable
    dobjFor(Enter) remapTo(Enter,underTheTable)
    dobjFor(Board) remapTo(Enter,underTheTable)
;

That’s a nifty idea, Draxxar. Presumably if the PC has the hidingUnderTable posture, an NPC would ignore him or her, but the PC would still be able to see the room. Of course, by default adv3Lite omits postures. I think there’s an extension for restoring them, but I haven’t needed it yet.