Vehicle Help - Lawn Mower

#1

I am trying to make a vehicle that behaves in such a way that when the player “takes” the lawn mower they become in a state where they are pushing it around.
It works great but there is one piece I can’t figure out. The status when you are in the vehicle is (standing in the lawn mower)
I want to change this to (pushing the lawn mower)
I have gotten pretty far searching the manuals but I’m lost here.

This is my code for it
// #lawnMower This is the object seen in the room

  • lawnMower : Vehicle, Fixture ‘electric lawn mower’ ‘electric lawn mower’
    "This lime green electric lawn mower looks pretty awesome. "
    ;
    // #lawnMowerHandle This is the object from inside the lawn mower for “drop mower” or “drop handle”
    ++ lawnMowerHandle : Thing ‘electric lawn mower/handle’ ‘mower handle’
    "This lime green electric lawn mower looks pretty awesome. "
    isListed = nil
    dobjFor(Board) asDobjFor(Take)
    dobjFor(Take)
    {
    verify() {}
    check() {}
    action()
    {
    "You grab the handle of the lawn mower, ready to push it wherever you go. ";
    gPlayerChar.moveInto(lawnMower);
    inherited;
    }
    }
    dobjFor(Drop)
    {
    verify() {}
    check() {}
    action()
    {
    "You let go of the handle, no longer pushing the lawn mower. ";
    gPlayerChar.moveInto(lawnMower.location);
    inherited;
    }
    }
    ;
0 Likes

(Michel Nizette) #2

I had to deal with a similar problem to change the status from “sitting on your bike” to “riding your bike”. Let me see.

(rummages in old code)

Here is the relevant code snippet (plus related customisations). See if you can adapt it.

   /* Room description addendum */
    roomActorStatus(actor)
    {
        if (bikeEngine.isOn) " (riding your bike)";
        else inherited(actor);
    }
    
    /* Bike description of an actor riding it. */
    roomListActorPosture(actor)
    {
        if (bikeEngine.isOn) "\^<<actor.nameIs>> riding your bike. ";
        else inherited(actor);
    }

    /* Report for sitting on the bike. */
    roomOkayPostureChangeMsg(posture, obj)
    {
        if (bikeEngine.isOn && posture == sitting && obj == self
            && gActor.isPlayerChar)
                return '''Okay, {you're} now riding your bike. ''';
        else return inherited(posture, obj);
    }
0 Likes