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

Suitcase

 
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
Lysander



Joined: 08 Jul 2003
Posts: 1694
Location: East Bay, California.

PostPosted: Fri Mar 11, 2005 5:49 pm    Post subject: Suitcase Reply with quote

Here's what I want ot do.

I want to make a suitcase that contains a handle. Therefore, I want the following actions to result in the following reactions:

-player starts out with handle in inventory, and suitcase in the starting location
-when player holds the handle, he does not in fact hold the suitcase but in fact only holds the handle, whereas the suitcase remains in the current room of the player.
-The player cannot walk away from the suitcase while he holds the handle; wherever he goes while holding the handle, the suitcase will follow
-when the player types "get suitcase," the handle disappears as part of the suitcase and can be examined and whatnot but is not referred to in the inventory list (I.E: "you are carrying a suitcase, attached to which is a handle.")
-make the act of opening the suitcase while the suitcase is not in the player's inventory cause the handle to disappear inside the suitcase again.
-make the suitcase unopenable while the suitcase is in the player's inventory.

What code could I use to make this work?
_________________
paidforbythegivedrewbetterblowjobsfundandthelibertyconventionforastupidfreeamerica
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Fri Mar 11, 2005 6:04 pm    Post subject: Reply with quote

I'm actually just quickly passing through, but until I get a chance to look at or think about this in more depth, one thing I might suggest is to implement this with a handle object based on the 'attachable' class. The attachable class should look after pulling the suitcase object after you, etc. You will have to write some custom code however to handle things like the opening-prevention, hiding the handle upon picking up the suitcase, etc.
Back to top
View user's profile Send private message
Lysander



Joined: 08 Jul 2003
Posts: 1694
Location: East Bay, California.

PostPosted: Fri Mar 11, 2005 11:34 pm    Post subject: Reply with quote

That's what I figured, but I couldn't get the attach code to work. I assume I need to do something in routine init or routine main to "activate" the attachable class? Or is there a third library file I need to include? Or possibly a mutant combination!?!
_________________
paidforbythegivedrewbetterblowjobsfundandthelibertyconventionforastupidfreeamerica
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Cryptonomic



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

PostPosted: Sat Mar 12, 2005 10:14 am    Post subject: Re: Suitcase Reply with quote

This is interesting. Please note that I think I found a few discrepancies in the Hugo Manual about attachables. (Check objlib.h if you want to make sure of things.)

Lysander wrote:
Here's what I want ot do.
-player starts out with handle in inventory, and suitcase in the starting location


Okay, so that is simple enough. You can just code the handle object as being in the player object at the start and the suitcase in the starting location.

Quote:
-when player holds the handle, he does not in fact hold the suitcase but in fact only holds the handle, whereas the suitcase remains in the current room of the player.


Having the handle as a separate object from the suitcase handles this.

Quote:
-The player cannot walk away from the suitcase while he holds the handle; wherever he goes while holding the handle, the suitcase will follow


You could use attachables, it seems. Here is another example (without using attachables):

Code:
class newLocation
{
  inherits room
  after
  {
    location DoGo
    {
      if (handle in player and suitcase in old_location)
      {
        move suitcase to location
      }
    }
  }
}


So here I have set things up such that if the player moves from any room that is of type newLocation, then a check will be made: (1) do they have the handle in their possession and (2) is the suitcase in the location they moved from.

If so, move the suitecase to the new location that they moved to.

That is just one possible way. (I think. I tried this out and it seems to work for at least up to this level of what you want to do.) Let me try working with the other specifics that you gave.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Cryptonomic



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

PostPosted: Sat Mar 12, 2005 10:31 am    Post subject: Re: Suitcase Reply with quote

Lysander wrote:
-when the player types "get suitcase," the handle disappears as part of the suitcase and can be examined and whatnot but is not referred to in the inventory list (I.E: "you are carrying a suitcase, attached to which is a handle.")


Okay, so for this, how about something like this:

Code:
object suitcase "suitcase"
{
  in emptyroom
  noun "suitcase"
  long_desc { "A basic suitcase." }
  inv_desc { "a suitcase" }

  before
  {
    object DoGet
    {
      move handle to suitcase
      return false
    }
  }

  after
  {
    object DoDrop
    {
      move handle to player
      return false
    }
  }
}


The inv_desc property can make sure that the handle does not get listed as part of the suitcase. The after routine then just makes sure that we return the situation to normal. By the way, I am returning false to make sure that Hugo knows that whatever it would normally do still needs to be carried out.

I think the before/after properties could help you with the other elements on your list as well. In other words, you can dictate how the suitcase will respond to being opened, for example, or when it is allowed to be opened.

I am not sure if this is all the "best" way to do this (probably not) but does it help? A little? Sorta?
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Lysander



Joined: 08 Jul 2003
Posts: 1694
Location: East Bay, California.

PostPosted: Mon Mar 21, 2005 3:59 pm    Post subject: Reply with quote

Yes. Much. Thank you. I'll add this in... er... whenever I get a chance, which probably won't be for a little while, and see what else needs doing. Basically i'm trying to make everything act as "real-y" as possible for hte purposes of learning the various ins and outs of the language.
_________________
paidforbythegivedrewbetterblowjobsfundandthelibertyconventionforastupidfreeamerica
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
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