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

Looking in a Direction

 
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
Cryptonomic



Joined: 05 May 2004
Posts: 55
Location: Chicago, IL

PostPosted: Wed Nov 17, 2004 5:26 am    Post subject: Looking in a Direction Reply with quote

Does anyone have an idea of how I might go about setting up the ability to look in a given direction? For example, if the player were to type "LOOK NORTH", they could be given a description of that. My guess is I would want some property that just displayed a string, like:

north_look = "You see stuff that is to the north."

But I am not certain yet how to go about actually implementing that. I will go through the library files as well and see if I can ferret out an answer for myself but I figured I would try to cover all my bases just in case this is a problem someone ran into before.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Wed Nov 17, 2004 8:02 am    Post subject: Reply with quote

Right now >LOOK WEST will get you something like "You see nothing special to the west", which is generated in objlib.h by the direction class's long_desc property.

You could either handle this specially in a given location's before property as in:

Code:
before
{
     location DoLook
     {
          if object = w_obj
               "...Your description here..."
          else
               return false
     }
}

or, if you wanted to do this throughout the game, you could derive a class from the basic room class and use that to build all your locations. Your derived class could have special handling to do more or less the above for any existing west_desc, etc. properties for the location. Something like:

Code:
room myroom
{
     before
     {
          location DoLook
          {
               if object = n_obj
                    return self.north_desc
               if object = ne_obj
                    return self.northeast_desc
               ...
               else
                    return false
          }
     }
}

(Please note that all this code is untested.)

Note that if, for instance, self.north_desc doesn't exist on the location object, it's the same as returning false in the above code. Your north_desc property, then, would look like:

Code:
north_desc
     "You see stuff that is to the north."

Hopefully that's sort of clear, or at least a start.
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