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

Peer Review of "Through the Looking Glass"

 
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: Mon May 02, 2005 4:15 pm    Post subject: Peer Review of "Through the Looking Glass" Reply with quote

Hello,

I've finished the port of Gareth Rees "Through the Looking Glass" tutorial game and would appreciate it if you would take a look at the code and post any suggestions you might have to improve the code.

There are a couple of odd problems that I can't track down here. The script for the white kitten stops running after anything in the game is picked up by the player and the game will only display monospaced type in the Carbon version of Hugo v3.1.02, but it uses proportional type in the GLK Mac version.

I plan to alter the tutorial to make it applicable to Hugo and then ask Gareth Rees for permission to upload it to the IF Archive shortly, but I'd rather wait until I've heard from other Hugo programmers before I start on that. This is my first Hugo project, so I'm sure there are some things I could have handled better here.

Code:

! #set DEBUG
#ifset DEBUG
#switches -d
#endif

verb "untangle", "roll", "wind"
   * "up" held    DoUntangle
   *  held "up"   DoUntangle
   *  held        DoUntangle

verb "look", "l", "examine", "x", "watch"
   * "at" object "in" (mirror)   DoReflect
   *  object "in" (mirror)       DoReflect

#set USE_PLURAL_OBJECTS
#set VERBSTUBS
#include "verblib.g"
#include "hugolib.h"
#include "resource.h"

routine DoUntangle
   {
  "What curious ideas you have!"
   }

routine DoReflect
   {
   if (object = mirror, hearth) or
      (player not in mantelpiece and player not in armchair)
      "You can't see that in the looking glass."
   else
      {
     "The looking-glass ";
      print object.name;
      if player in mantelpiece
       " looks very misty and blurred."
      else
         {
       " looks just like the real ";
         print object.name;
       " only all reversed, left for right."
         }
      }
   }

attribute male

replace AssignPronoun(obj)
   {
#ifclear OLD_STYLE_PRONOUNS
   if obj >= it_object and obj <= them_object
      return
#endif
   if parser_data[PARSER_STATUS] & PRONOUNS_SET
      return
   if obj = player
      return
   if not obj.#noun and not obj.#adjective
      return
   if obj is plural
      them_obj = obj
   elseif obj is female
      her_obj = obj
   elseif obj is male
      him_obj = obj
   else
      it_obj = obj
   }

routine init
   {
   counter = -1

   STATUSTYPE = 0                   
   TEXTCOLOR = BLACK
   BGCOLOR = BRIGHT_WHITE
   SL_TEXTCOLOR = BRIGHT_WHITE
   SL_BGCOLOR = BLACK
   
   prompt = ">"
   color TEXTCOLOR, BGCOLOR

   cls
   
  "It's a cold winter day outside, but in the looking-glass house
   it's summer. All you need to do is pretend there's a way of getting
   through into it somehow ...\n"
   
   pause
   LoadPicture("alice", "alice1")
   
   Font(BOLD_ON | DEFAULT_FONT)
  "Through the Looking Glass"
   Font(BOLD_OFF)
  "An Interactive Tutorial"
   print BANNER

   player = you
   location = drawing_room
   old_location = location
   
   move player to location
   FindLight(location)
   DescribePlace(location)
   location is visited
   CalculateHolding(player)
   setscript[Script(white_kitten, 2)] = &PlayfulKittens, nothing,
      &LoopScript, nothing
   setscript[Script(black_kitten, 2)] = &PlayfulKittens, nothing,
      &LoopScript, nothing

#ifset USE_PLURAL_OBJECTS
   InitPluralObjects
#endif
   }

routine main
   {
   counter = counter + 1
   PrintStatusLine
   run location.each_turn
   runevents
   RunScripts
   if parent(speaking)~=location
      speaking = 0
   }

player_character you "you"
   {
   size 55
   }

room drawing_room "Drawing Room"
   {
   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 armchair that you
      can curl up and sleep in."
   before
      {
      location DoGo
         {
         if object = d_obj, out_obj
            {
            if player in mantelpiece
               {
              "You drop down into the warm and comfortable armchair."
               move player to armchair
               }
            elseif player in armchair
               {
              "You hop down from the armchair."
               move player to drawing_room
               }
            else
               return false
            }
         elseif object = u_obj
            {
            if player in armchair and armchair is near_mantel
               {
              "You clamber up onto the mantelpiece."
               move player to mantelpiece
               }
            else
               return false
            }
         else
            return false
         }
      }
   }

scenery window_pane "window"
   {
   nouns "window", "pane", "snow"
   adjectives "window"
   article "the"
   long_desc
     "Outside the window it's snowing gently, and you're glad to be
      in here in the warmth."
   before
      {
      object DoOpen
         {
        "You wouldn't want to catch a chill, would you? Better leave
         the window shut."
         }
      }
   is openable
   in drawing_room
   }

object red_queen "red queen"
   {
   nouns "queen", "piece"
   adjectives "red", "black", "chess"
   article "the"
   long_desc
     "She's a fierce little chess piece."
   after
      {
      object DoGet
         {
         if white_kitten.currently = PLAYING_WITH_QUEEN
            {
            white_kitten.currently = PLAYING_WITH_CHAIR
            red_queen is not hidden
            return false
            }
         elseif black_kitten.currently = PLAYING_WITH_QUEEN
            {
            black_kitten.currently = PLAYING_WITH_CHAIR
            red_queen is not hidden
            return false
            }
         else
            return false
         }
      object DoPutIn
         {
         if xobject = chess_board
           "Alone on the chess board, the red queen is monarch of all     
            she surveys."
         else
            return false
         }
      }
   size 1
   is female
   }
   
plural_class missing_pieces
   {
   nouns "pawns", "rooks", "castles", "knights", "horses", \
     "bishops", "queens", "kings", "pieces"
   adjectives "missing", "red", "white", "black", "chess"
   article "the"
   plural_of pawn, rook, knight, bishop, queen, king
   before
      {
      object
         {
        "Alas, the chess pieces seem to be missing. Those naughty
         kittens!"
         }
      }
   }
   
class missing_piece
   {
   noun "piece"
   adjectives "missing", "white", "chess"
   article "the"
   plural_is missing_pieces
   before
      {
      object
         {
        "Alas, that chess piece seems to be missing. Those naughty
         kittens!"
         }
      }
   is hidden, static
   }

missing_piece pawn "pawn"
   {
   noun "pawn"
   adjectives "red", "black"
   in drawing_room
   }

missing_piece rook "rook"
   {
   nouns "rook", "castle"
   adjectives "red", "black"
   in drawing_room
   }
   
missing_piece knight "knight"
   {
   nouns "knight", "horse"
   adjectives "red", "black"
   in drawing_room
   }
   
missing_piece bishop "bishop"
   {
   noun "bishop"
   adjectives "red", "black"
   in drawing_room
   }
   
missing_piece queen "queen"
   {
   noun "queen"
   in drawing_room
   }
   
missing_piece king "king"
   {
   noun "king"
   adjectives "red", "black"
   in drawing_room
   }

object chess_board "chess board"
   {
   nouns "board", "board"
   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."
   size 3
   capacity 5
   holding 0
   is platform
   in drawing_room
   }

scenery hearth "hearth"
   {
   nouns "hearth", "fireplace", "place"
   adjective "fire"
   article "the"
   long_desc
     "Looking at the hearth, you wonder if they have a hearth in the
      looking-glass house. You can never tell by looking, unless your
      fire smokes, and then smoke comes up in the looking-glass room
      too--but that may be only pretense, just to make it look as if
      they had a fire."
   in drawing_room
   }

attribute hiding_queen

object rug "rug"
   {
   nouns "rug", "hearthrug", "carpet"
   adjectives "hearth", "indian", "arabian", "soft", "beautiful"
   article "the"
   long_desc
     "It's a beautiful rug, made in some far off country, perhaps
      India or Araby, wherever those might be."
   before
      {
      object DoLookUnder
         {
         if player in self
           "You try to lift up a corner of the rug, but fail. After
            a while, you realize that this is because you are standing
            on it. How curious the world is!"
         elseif player in mantelpiece or player in armchair
           "You're unable to reach the rug from here."
         elseif self is hiding_queen
            {
           "You lift up a corner of the rug and, peering underneath,
            discover the red queen from the chess set."
            move red_queen to player
            self is not hiding_queen
            }
         else
            return false
         } 
      object DoGet
         {
        "The rug is much too large and heavy for you to carry."
         }
      object DoMove, DoPull, DoPush
         {
        "But a hearth rug is meant to be next to the hearth!"
         }
      }
      capacity 987
      holding 0
      is hidden, static, platform, enterable, hiding_queen
      in drawing_room
   }
   
attribute near_mantel

object armchair "armchair"
   {
   nouns "chair", "armchair"
   adjective "arm", "huge"
   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. It has been pushed over
      to the ";
         {
         if self is near_mantel
           "fireplace."
         else
           "window."
         }
      }
   before
      {
      object DoMove, DoPush, DoPull
         {
         if white_kitten.currently = PLAYING_WITH_ALICE or
            black_kitten.currently = PLAYING_WITH_ALICE
           "Not with a kitten in your arms!"
         elseif white_kitten.currently = PLAYING_WITH_CHAIR or
            black_kitten.currently = PLAYING_WITH_CHAIR
            {
            local this_kitten
            if white_kitten.currently = PLAYING_WITH_CHAIR
               this_kitten = white_kitten
            else
               this_kitten = black_kitten
           "You are about to start moving the chair when you
            notice that ";
            print The(this_kitten);
          " is right in the way. It's a good thing you spotted it, or
            you would have squashed flat the poor little thing."
            }
         elseif player not in drawing_room
            {
           "You'll have to get off ";
            print The(parent(player));
          " first."
            }
         elseif self is near_mantel
            {
           "You push the armchair away from the hearth."
            self is not near_mantel
            }
         else
            {
           "You push the armchair over to the hearth."
            self is near_mantel
            }
         }
      object DoClimb, DoEnter
         {
        "You jump into the warm and comfortable armchair."
         move player to armchair
         }
      }
      capacity 233
      holding 0
      reach mantelpiece
      is hidden, static, platform, enterable, not near_mantel
      in drawing_room
   }
   
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 and armchair is not near_mantel
           "You can't reach the mantelpiece from here."
         elseif WhatsIn(player) > 0
           "Your hands are too full."
         else
            {
           "You scramble up onto the mantelpiece."
            move player to mantelpiece
            }
         }
      object DoExit
         {
        "You jump into the warm and comfortable armchair."
         move player to armchair
         }
      xobject DoPutIn, DoTakeOff
         {
         if player not in self and
           (player not in armchair or armchair is not near_mantel)
           "The mantelpiece is so high that you can't reach."
         else
            return false
         }
      }
      capacity 144
      holding 0
      reach armchair, mirror
      is hidden, static, platform, enterable
      in drawing_room
   }

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
      {
      object
         {
         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, &DoMove, &DoPush, &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 ..."
            LoadPicture("alice", "alice3")
            endflag = true
            }
         else
            return false
         }
      xobject DoThrowAt
         {
        "You don't want seven years of bad luck, do you?"
         }
      }
   is hidden, static
   in drawing_room
   }

attribute tangled

object worsted "ball of worsted"
   {
   nouns "ball", "wool", "worsted"
   adjectives "blue", "fine", "ball"
   article "a"
   initial_desc
     "A discarded ball of worsted lies on the floor here." 
   long_desc
      {
      if self is tangled
        "It's in a terrible tangle. All that time you spent rolling
         it up, and now look at it!"
      else
        "It's a ball of fine blue wool, all rolled up in preparation
         for some embroidery."
      }
   before
      {
      object DoUntangle
         {
         if self is tangled
            {
           "You're as quick as can be at rolling up balls of wool,
            though you say so yourself! Soon it's neat and tidy again."
            self is not tangled
            }
         else
           "But someone already has! The ball of wool is neat and tidy."
         }
      }
   after
      {
      object DoGet
         {
         if white_kitten.currently = PLAYING_WITH_BALL
            {
            worsted is not hidden
            white_kitten.currently = PLAYING_WITH_CHAIR
            return false
            }
         elseif black_kitten.currently = PLAYING_WITH_BALL
            {
            worsted is not hidden
            black_kitten.currently = PLAYING_WITH_CHAIR
            return false
            }
         else
            return false
         }
      }
   size 1
   is not tangled
   in drawing_room
   }

attribute playing
property  other_kitten
property  currently
enumerate
   {
   PLAYING_WITH_CHAIR, PLAYING_WITH_ALICE, PLAYING_WITH_QUEEN,
      PLAYING_WITH_BALL
   }

class kitten
   {
   nouns "kitten", "kitty", "cat"
   article "a"
   short_desc
      {
      if self.currently = PLAYING_WITH_QUEEN
         {
         print CArt(self);
       " is playing with the red queen."
         }
      elseif self.currently = PLAYING_WITH_BALL
         {
         print CArt(self);
       " is playing with a ball of worsted."
         }
      elseif self.currently = PLAYING_WITH_CHAIR
         {
         if self.other_kitten.currently = PLAYING_WITH_CHAIR
            {
           "Two kittens, one white and one black, are playing together
            by the armchair."
            self.other_kitten is already_listed
            }
         else
            {
            print CArt(self);
          " is playing by the armchair."
            }
         }
      else
         return false
      }
   long_desc
      {
     "What a beautiful kitten ";
      print The(self);
    " is. Why, it's quite definitely your favorite of the pair, and
      much prettier than that naughty ";
      print self.other_kitten.name; "."
      }
   ignore_response
      {
      print CThe(self);
    " twitches its whiskers and looks at you with such a clever
      expression that you are certain it understands every word you
      are saying."
      }
   before
      {
      object DoGet
         {
         if self.other_kitten in player
           "You can't hold two kittens at once!"
         else
            {
            self.currently = PLAYING_WITH_ALICE
            move self to player
           "You pick up ";
            print The(self);
         ". What a beautiful creature it is!"
            }
         }
      xobject DoThrowAt
         {
         if object ~= red_queen, worsted
            {
            move object to drawing_room
           "You toss ";
            print The(object);
          " onto the floor. "
            Perform(&DoGive, object, self)
            }
         else
            Perform(&DoGive, object, self)
         }
      }
   after
      {
      object DoDrop, DoPutOnGround
         {
         self.currently = PLAYING_WITH_CHAIR
         move self to drawing_room
         print CThe(self);
       " squirms out of your arms and scampers away."
         }
      object DoPutIn
         {
         self.currently = PLAYING_WITH_CHAIR
         print CThe(self);
       " jumps off ";
         print The(parent(self));
      ", landing lightly on the floor before scampering away."
         move self to drawing_room
         }
      object DoKiss
         {
        "You give ";
         print The(self);
       " a little kiss on its nose, and it looks sweetly and demurely
         at you."
         }
      object DoHit
         {
        "You would never do such a beastly thing to such a defenseless
         little animal!"
         }
      xobject DoShow
         {
         print CThe(self);
       " bats a paw at ";
         print The(object); "."
         }
      xobject DoGive
         {
         if object ~= red_queen, worsted
            {
            print CThe(self);
          " just examines ";
            print The(object);
          " with a quizzical expression."
            }
         else
            {
            move object to drawing_room
           "You toss ";
            print The(object);
          " onto the floor and ";
            print The(self);
            if self in player
               {
               move self to drawing_room
             " squirms out of your grasp and";
               }
          " scampers after it";
            if object = worsted
               {
               self.currently = PLAYING_WITH_BALL
               worsted is hidden
               worsted is tangled
            ", quickly turning the neat ball into a tangle";
               }
            else
               self.currently = PLAYING_WITH_QUEEN
               red_queen is hidden
           "."
            if object = worsted
               LoadPicture("alice", "alice2")
           }
         }
      }
   currently PLAYING_WITH_CHAIR
   size 5
   is living
   }

plural_class kittens
   {
   nouns "kittens", "kitties", "cats"
   single_noun "kitten"
   plural_of white_kitten, black_kitten
   }

kitten white_kitten "white kitten"
   {
   adjective "white"
   plural_is kittens
   other_kitten black_kitten
   is playing
   in drawing_room
   }

kitten black_kitten "black kitten"
   {
   adjective "black"
   plural_is kittens
   other_kitten white_kitten
   is not playing
   in drawing_room
   }

routine PlayfulKittens
   {
   local this_kitten, activity
   activity = random(5)
   if this_kitten is playing
      {
      this_kitten is not playing
      if random(3) = 3
         return false
      else
         {
         indent
         print CThe(this_kitten);
         select this_kitten.currently
            case PLAYING_WITH_ALICE
               {
               select activity
                  case 1
                   " mews plaintively."
                  case 2
                   " purrs quietly to itself."
                  case 3
                   " purrs contentedly to itself."
                  case 4
                   " rubs its ears against you."
                  case 5
                     {
                     move this_kitten to drawing_room
                     this_kitten.currently = PLAYING_WITH_CHAIR
                   " squirms out of your arms and scampers away."
                     }
               }
            case PLAYING_WITH_QUEEN
               {
               select activity
                  case 1
                   " bats at the red queen with its paw."
                  case 2
                   " stops playing and sits up, pretending to be 
                     innocent of any kittenish tendencies."
                  case 3
                   " knocks the red queen across the floor and chases
                     after it."
                  case 4
                   " stops to wash itself."
                  case 5
                   " bites the red queen and shakes it to make sure that
                     it's dead."
               }
            case PLAYING_WITH_BALL
               {
               select activity
                  case 1
                   " bats at the ball of worsted with its paw."
                  case 2
                   " pushes the ball of worsted across the floor and 
                     chases after it."
                  case 3
                   " leaps onto the ball of worsted and grapples bravely
                     with it."
                  case 4
                   " jumps into the ball of worsted and gets tangled up
                     in a mess of threads."
                  case 5
                   " stops playing and scratches its ears."
               }
            case PLAYING_WITH_CHAIR
               {
               if this_kitten.other_kitten.currently = \
                  PLAYING_WITH_CHAIR and random(2) = 2
                  {
                  select activity
                     case 1
                      " chases after ";
                     case 2
                      " jumps on top of ";
                     case 3
                      " washes ";
                     case 4
                      " scampers around the armchair and ";
                     case 5
                      " bats at ";
                  print The(this_kitten.other_kitten);
                  select activity
                     case 1, 3
                      "."
                     case 2
                      " and they roll around on the floor."
                     case 4
                      " chases after it."
                     case 5
                      " with its paw."
                  }
               else
                  select activity
                     case 1
                      " scampers after a speck of dust."               
                     case 2
                      " rolls around on the floor."                 
                     case 3
                      " sits up and washes its tail."               
                     case 4
                      " scratches its head on the armchair."                 
                     case 5
                      " chases its tail."
               }
         }
      }
   else
      {
      this_kitten is playing     
      return false
      }
   }
   
resource "alice"
   {
  "alice1.jpg"
  "alice2.jpg"
  "alice3.jpg"
   }
Back to top
View user's profile Send private message
Vitriola



Joined: 10 Mar 2003
Posts: 2426

PostPosted: Mon May 02, 2005 4:31 pm    Post subject: Reply with quote

Does it ask me for my bank account information somewhere in there?
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Mon May 02, 2005 4:41 pm    Post subject: Reply with quote

Hey, this is really cool. Good work, man.

I am swamped with work, but I'll see if I can track down the problems that you specifically noted and see if I can see what's causing them.

Good job!
_________________
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
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Mon May 02, 2005 6:44 pm    Post subject: Reply with quote

Vitriola wrote:
Does it ask me for my bank account information somewhere in there?


No, that would be the Hugo port of Douglas Adams' "Bureaucracy." :-)
Back to top
View user's profile Send private message
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Mon May 02, 2005 6:49 pm    Post subject: Peer Review of "Through the Looking Glass" Reply with quote

Ice Cream Jonsey wrote:
Good work, man.

Thanks.
Ice Cream Jonsey wrote:
I'll see if I can track down the problems that you specifically noted

That'd be great. They're both pretty baffling bugs.
Back to top
View user's profile Send private message
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Tue May 03, 2005 6:49 am    Post subject: Reply with quote

For the font problem, try adding

Code:
DEFAULT_FONT = PROP_ON

before

Code:
Font(BOLD_ON | DEFAULT_FONT)

in the init routine.

As for the kittens, I'll have to look at this some more when I get a chance. I'm puzzled by the PlayfulKittens routine, since

Code:
   local this_kitten, activity
   activity = random(5)
   if this_kitten is playing

means that the uninitialized this_kitten local is always 0 when the routine runs. And 0 (i.e., the nothing object) should never have the 'playing' attribute.

Ah, wait. I see. Later in the routine you do set 'this_kitten is playing', which if this_kitten is 0 translates to 'nothing is playing'.

You're going to have to make sure your script sets up this_kitten as an argument to PlayfulKittens instead of just a local, is all.

At least I think that should fix it.
Back to top
View user's profile Send private message
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Tue May 03, 2005 9:03 am    Post subject: Reply with quote

Kent wrote:
For the font problem, try adding DEFAULT_FONT = PROP_ON before Font(BOLD_ON | DEFAULT_FONT) in the init routine.


Thanks. (Font(DEFAULT_FONT) needed to be added before the introductory text too.)

Kent wrote:
the uninitialized this_kitten local is always 0 when the routine runs. [...] You're going to have to make sure your script sets up this_kitten as an argument to PlayfulKittens instead of just a local, is all. At least I think that should fix it.


"The Vault of Hugo" also appears to have a routine with a couple of uninitialized local variables that seem to take the values of the parameters passed to the routine. (CharShakeHead). But, maybe I misunderstood it.

I tried changing the first few lines of the routine to

Code:

routine PlayfulKittens(this_kitten)
   {
   local activity
   activity = random(5)


But that doesn't seem to change anything. Here's what the script monitor is saying ...

>z
Time passes...
[Script for obj. 52 (white kitten), step 1: $F12, obj. 0 (nothing)]
[Script for obj. 53 (black kitten), step 1: $F12, obj. 0 (nothing)]
The black kitten scampers after a speck of dust.
[Script for obj. 52 (white kitten), step 2: $6AF, obj. 0 (nothing)]
[Looping script for obj. 52 (white kitten)]
[Script for obj. 53 (black kitten), step 2: $6AF, obj. 0 (nothing)]
[Looping script for obj. 53 (black kitten)]
[Script for obj. 52 (white kitten), step 1: $F12, obj. 0 (nothing)]
The white kitten jumps on top of the black kitten and they roll around on the
floor.
[Script for obj. 53 (black kitten), step 1: $F12, obj. 0 (nothing)]

>Take the ball of wool.
Taken.
[Script for obj. 53 (black kitten), step 2: $6AF, obj. 0 (nothing)]
[Looping script for obj. 53 (black kitten)]

>z
Time passes...
[Script for obj. 53 (black kitten), step 1: $F12, obj. 0 (nothing)]
The black kitten bats at the white kitten with its paw.
[Script for obj. 53 (black kitten), step 2: $6AF, obj. 0 (nothing)]
[Looping script for obj. 53 (black kitten)]
[Script for obj. 53 (black kitten), step 1: $F12, obj. 0 (nothing)]
Back to top
View user's profile Send private message
bruce



Joined: 04 Jun 2002
Posts: 2547

PostPosted: Tue May 03, 2005 11:31 am    Post subject: Reply with quote

Speaking of kittens,

http://www.burstfilms.com/kitten.html

Bruce

EDIT: Except it's down at the moment. Crap.
Back to top
View user's profile Send private message
Guest






PostPosted: Tue May 03, 2005 6:50 pm    Post subject: Reply with quote

Sandsquish wrote:
"The Vault of Hugo" also appears to have a routine with a couple of uninitialized local variables that seem to take the values of the parameters passed to the routine. (CharShakeHead). But, maybe I misunderstood it.

Whoops. That's actually a leftover, probably, from when Hugo's routine definitions looked more Inform-like. Truth is, arguments are just the first local variables in a routine, so

Code:
routine MyRoutine(first_arg)
{
     ...

is the same as

Code:
routine MyRoutine
{
     local first_arg
     ...

since either can be called as MyRoutine(value) and have first_arg = value.

Now, for your purposes, note that the first two arguments of the character script routine examples in sample.hug are

Code:
local char, obj

In other words, the character the routine is being called for, and the object (if any) to be acted on. Try making your first initialization

Code:
local this_kitten, obj

or change the routine to

Code:
routine PlayfulKittens(this_kitten, obj)


(I haven't tested this yet; I'll try to get the time to do it if it doesn't work for you.)
[/code]
Back to top
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Wed May 04, 2005 7:54 am    Post subject: Reply with quote

Anonymous wrote:
note that the first two arguments [...] are [...] the character the routine is being called for, and the object (if any) to be acted on. [...] change the routine to routine PlayfulKittens(this_kitten, obj)


The routine only makes use of the first argument but I tried adding the second one, just in case something odd was going on. The results were the same, though. The second kitten's script stops whenever something is picked up by the player character.
Back to top
View user's profile Send private message
Guest






PostPosted: Thu May 05, 2005 6:57 pm    Post subject: Reply with quote

Ah, dammit. Mea culpa. Sorry for not getting on the trail of this sooner. As Hugo has become more and more stable I'm less and less likely in the last few years to suspect a problem in the library, etc. But it turns out that something I "fixed" as recently (I think) as Future Boy!'s post-release was screwing up character scripting.

Try: http://www.generalcoffee.com/hugo/beta/hugolib.zip

I found this by investigating what was going on with the 'setscript' array and found that some bad code was setting something it wasn't supposed to. Yay debugger, I guess. Once I actually traced through what was going on (after my eyeball debugging of your code didn't work), it was pretty quick to figure out.

Again, sorry for not nailing this one sooner. Let me know if this solves it for you.
Back to top
Sandsquish



Joined: 13 Apr 2005
Posts: 12

PostPosted: Fri May 06, 2005 9:06 am    Post subject: Reply with quote

Anonymous wrote:
Let me know if this solves it for you.


That works. Thanks.

Anonymous wrote:
Yay debugger, I guess.


The hdhelp.hlp file is missing from the Mac (Darwin) version at the archive. I grabbed a copy of it from the Linux version, but I'm still not sure how to use the debugger.
Back to top
View user's profile Send private message
Guest






PostPosted: Fri May 06, 2005 1:10 pm    Post subject: Reply with quote

Whoops. I'll fix that package to include the help file.

The debugger is a pretty handy tool, I find, for figuring out what's going wrong in a program. Any debugger, that is. The Hugo Debugger has a fairly comprehensive set of standard debugger functions for stepping line-by-line through a program, setting breakpoints on lines or values, watching variables or objects, etc. It's probably worth experimenting with. If you need some help, ask away.
Back to top
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Fri May 06, 2005 1:11 pm    Post subject: Reply with quote

I swear, everytime I hit Submit I realize goddammit I didn't log in again.

And now I realize goddammit I didn't check the log me in every time checkbox when I logged in this time.
Back to top
View user's profile Send private message
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