FAQ Search Memberlist Usergroups
Jolt Country Forum Index
Register Profile Log in to check your private messages Log in
Log in Log in

Through the Looking Glass Tutorial

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors
View previous topic :: View next topic  
Author Message
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Wed Apr 13, 2005 11:48 am    Post subject: Through the Looking Glass Tutorial Reply with quote

Hello,

I'm trying to adapt Gareth Rees "Through the Looking Glass" Inform tutorial to Hugo and while, so far, it's been pretty easy going, because of how similar Hugo and Inform are to each other, I've run into a couple of problems.

The tutorial contains several Inform "supporters" which appear to be similar to Hugo "platforms," but the Hugo "platforms" won't allow the player-character to put anything on them because there's "no room." This message is output from line 2204 of verblib.h in library v3.1.02.0. This is in the VMessage routine which is getting called by line 1240, which is in the DoPutIn routine. I think I should be getting the behavior right above that, in line 1235 ("You put X in/on Y") and I can't see why I'm not.

The tutorial also contains an object that can only be reached if the player-character is inside/on another object and has a different description depending on which supporter the player-character is currently inside of/on top of. Rees handled this by testing to see which verb was in use and disallowing anything but "look at" if the player wasn't on the correct platform. I couldn't find a way to test which verb was in use. I think &Do[Verb] will give me a verb's address but I don't know how to access the address of the verb the player is trying to use. I ended up using AnyVerb(self) in the object's before routine, but this was pretty clunky and I had to repeat the same "You can't do that ..." message three times in the routine. (I thought about using the RemoveFromScope routine, but I couldn't see how to do that without knowing which verb the player was using either.)

The object is the mirror ...

http://www.inform-fiction.org/examples/alice2.html#Mirror

... I can post the code, if you think it would help, but it's a few hundred lines long.
Back to top
View user's profile Send private message
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Wed Apr 13, 2005 3:11 pm    Post subject: Reply with quote

<< Rees handled this by testing to see which verb was in use and disallowing anything but "look at" if the player wasn't on the correct platform. I couldn't find a way to test which verb was in use. >>

verbroutine will do it.
Back to top
View user's profile Send private message
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Wed Apr 13, 2005 3:59 pm    Post subject: Through the Looking Glass Tutorial Reply with quote

Sandsquish wrote:
verbroutine will do it.


What I should have said was, verbroutine should do it, but it didn't. The compiler doesn't seem to like the "complex property block heading: if" in a before routine.

Here's the relevant sections of the code. If you remove the mirror, so that this will compile, you'll notice that platforms won't allow the chess piece to be put on them. Help, please.

Code:

room drawingRoom "Drawing Room"
   {
      noun "snow"                     
      long_desc
        "The gentle sound of snow against the window pane suggests that
         it's cold outside, and you're glad to be here in the warmth.
         The drawing-room is reflected in the large looking-glass on the
         wall above the mantelpiece, and a very comfortable room it is
         too, with a warm hearth, a soft rug, and an arm-chair that you
         can curl up and sleep in."
   }
   
object redQueen "red queen"
   {
      noun "queen"
      adjective "red"
      article "the"
      long_desc
        "She's a fierce little chess piece."
      in drawingRoom
   }

object chessBoard "chess board"
   {
      nouns "board", "chessboard"
      adjectives "chess", "checker", "chequer"
      article "the"
      initial_desc
        "An abandoned chess board lies on the floor."
      long_desc
        "It's left here from the game you were playing just now, but the
         pieces are all missing - the kittens will insist on playing
         with them."
      is platform                      ! But you can't put anything
      in drawingRoom                   ! on it, there's "no room"
   }

attribute nearMantel                   ! Is the chair near the mantel?

object armchair "armchair"
   {
      nouns "chair", "armchair"
      adjective "arm"
      article "the"
      long_desc
        "It's a huge armchair, the perfect place for a kitten or a
         little girl to curl up in and doze."
      before
         {
            object DoMove, DoPush, DoPull
               {
                  ! Check for the kittens here
                  if self is nearMantel
                     {
                        self is not nearMantel
                       "You push the armchair away from the hearth."
                     }
                  else
                     {
                        self is nearMantel
                       "You push the armchair over to the hearth."
                     }
               }
         }
      is hidden, static, platform, enterable, not nearMantel
      in drawingRoom
   }
   
object mantelpiece "mantelpiece"
   {
      nouns "mantelpiece" "mantel"
      article "the"
      long_desc
        "It's higher off the ground than your head, but it looks wide
         enough and sturdy enough to support you."
      before
         {
            object DoEnter, DoClimb
               {
                  if player not in armchair
                    "The mantelpiece is much too high to climb
                     up onto."
                  elseif armchair is not nearMantel
                    "You can't reach the mantelpiece from here."
                  elseif WhatsIn(player) > 0
                    "Your hands are too full."
                  else
                     return false      ! The library wants the player
               }                       ! to exit the armchair first
            xobject DoPutIn, DoTakeOff
               {
                  if player not in self and
                    (player not in armchair or
                     armchair is not nearMantel)
                       "The mantelpiece is so high that you
                        can't reach."
                  else
                     return false      ! The library says "no room"
               }
         }
      is hidden, static, platform, enterable
      in drawingRoom
   }

object mirror "looking glass"
   {
      nouns "mirror" "glass"
      adjectives "looking"
      article "the"
      long_desc
         {
            if player in mantelpiece
              "Strangely, the glass is beginning to melt away, just like
               a bright silvery mist."
            elseif player in armchair
              "In the looking glass you can see the drawing room of the
               looking-glass house. What you can see is very much the
               same as this drawing room, only all reversed, left for
               right. But you are sure that out of the corners of the
               glass, where you can't see, the looking-glass world is
               quite different from yours."
            else
              "In the looking-glass you can see the ceiling of the
               drawing room of the looking-glass house. It looks much
               the same as the ceiling of your drawing room."
         }
      before
         {
            if verbRoutine ~= DoLook and player not in mantelpiece
              "You can't reach the looking glass from where you're
               standing."
            object DoTouch, DoMove, DoPush, DoPull
               {
                 "Your hand goes right through the silvery mist!"
               }
            object DoEnter
               {
                 "Your hand goes right through the silvery mist, and
                  in another moment the rest of you follows, and you
                  are through the glass ..."
                  endFlag = 1
               }
         }
      is hidden, static
      in drawingRoom
   }
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Wed Apr 13, 2005 7:51 pm    Post subject: Re: Through the Looking Glass Tutorial Reply with quote

Sandsquish wrote:
The tutorial contains several Inform "supporters" which appear to be similar to Hugo "platforms," but the Hugo "platforms" won't allow the player-character to put anything on them because there's "no room."


There is a supercontainer class that Kent wrote to allow objects that can have things in them and on them. I think it's in the library section of the Hugo portion of the IF Library. I'll check and link it to this thread once I find it.

Welcome to JC!
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Wed Apr 13, 2005 8:12 pm    Post subject: Reply with quote

Comcast has been on and off all week. Unbelievable. Who can't keep their systems up in 2005 going through a line?!? Comcast, it looks like, that's who. Garbage company.

Anyway, there should be a contain.h or equivalent in the IF archive, and that should at least solve the problem of putting things onto other things.
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Guest






PostPosted: Thu Apr 14, 2005 9:24 am    Post subject: Re: Through the Looking Glass Tutorial Reply with quote

Ice Cream Jonsey wrote:
There is a supercontainer class that Kent wrote to allow objects that can have things in them and on them.


Thanks, but I think this might be a bug in the library. The Hugo Book doesn't say that platform and enterable are mutually exclusive and the current version of the library won't allow things to be put on top of any platforms (even if the platform has no other attributes at all, like the chess board in the code I posted). It just says there's "no room."

I just tried a different version of the mirror using AnyVerb instead of an if expression. This one is less clunky than my first attempt with AnyVerb, but it crashes the 'terp.

Code:
object mirror "looking glass"
   {
   nouns "mirror" "glass"
   adjectives "looking"
   article "the"
   long_desc
      {
      if player in mantelpiece
        "Strangely, the glass is beginning to melt away, just like
         a bright silvery mist."
      elseif player in armchair
        "In the looking glass you can see the drawing room of the
         looking-glass house. What you can see is very much the same
         as this drawing room, only all reversed, left for right.
         But you are sure that out of the corners of the glass, where
         you can't see, the looking-glass world is quite different
         from yours."
      else
        "In the looking-glass you can see the ceiling of the drawing
         room of the looking-glass house. It looks much the same as
         the ceiling of your drawing room."
      }
   before
      {
      AnyVerb(self)
         {
         if player not in mantelpiece
            if verbRoutine = DoLook
               return false
            else
              "You can't reach the looking glass from where you're
               standing."
         elseif verbRoutine = DoTouch or DoMove or DoPush or DoPull
            {
           "Your hand goes right through the silvery mist!"
            }
         elseif verbRoutine = DoEnter
            {
           "Your hand goes right through the silvery mist, and in
            another moment the rest of you follows, and you are through
            the glass ..."
            endFlag = 1
            }
         else
            return false
         }
      }
   is hidden, static
   in drawingRoom
   }


Ice Cream Jonsey wrote:
Welcome to JC!


Thank you.
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001 phpBB Group

Theme by Kage Musha - RPG Garden

Copyrights and trademarks are all of the belonging company. No copyright Infringement intended