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

Trapping LookIn

 
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
Bainespal



Joined: 09 Jul 2010
Posts: 151

PostPosted: Mon Jul 25, 2011 12:39 am    Post subject: Trapping LookIn Reply with quote

The LookIn action probably presupposes a container object with nested children. The DoLookIn routine in verblib.h supports this.

I'm just trying to catch this action on a scenery window that is not a container, and I'm having more trouble than I would have thought. A simple before property on the window object won't work; when the game is run, trying to look in the window produces the text "You can't do that with (the window)." The same happens when using the before of the room. Using react_before on the window object has strange results; without an "else" condition telling it to return false for other verbs, it freezes the whole room. It still won't work with the else condition, either.

Trapping LookThrough for the same window object worked as expected. I guess it's not a big deal for the default error message to be displayed when the player tries to look in the windows, but if anyone knows a way to work with DoLookIn on an object that's not container, I'd give it a try.

Thanks, as always. If I do write a Hugo game eventually, it'll be because of this forum. :-)
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Mon Jul 25, 2011 8:38 pm    Post subject: Reply with quote

Okay, we are discussing this in the Hugo Love Bus *right now*

I have found that my ability to debug anything is awful at the moment, but I am not quite ready to ask for source code yet, Bainspiel!
_________________
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
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Mon Jul 25, 2011 8:55 pm    Post subject: Reply with quote

I think you can basically do two things-

1) declare this grammar line before verblib.g is included:
Code:

verb "look", "l", "examine", "x", "watch"
* "in"/"inside" object      DoLookIn

The downside of that is that every object can be used with "LOOK IN" now, and you may have to replace DoLookIn with something with a little extra code to give a decent answer to those other cases.

2) The other route, of course, is to just make the window a container and then disallow all of the stupid container things an evil player might try to do with it.

There isn't really a correct answer with that.

There is a third* possibility, too, where you put something in PreParse that specifically looks for every variation of >LOOK IN WINDOW and then point it to the routine you want, but that method would be dumb.

Anyhow, yeah, it's always rough when the default grammar conflicts with what you want to do (since changing the grammar seems weird), but changing it is what you have to do. Er, unless you don't.

* There are most likely more than three possibilities.
Back to top
View user's profile Send private message AIM Address
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Mon Jul 25, 2011 8:58 pm    Post subject: Reply with quote

Also, you can always get an answer on here within the day or two it takes for us to notice it (and it is nice for all of the MILLIONS of future Hugo authors who get to see the answer), but if you ever need a quicker answer, hop on to the ifMUD where I most likely am.
Back to top
View user's profile Send private message AIM Address
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Mon Jul 25, 2011 9:07 pm    Post subject: Reply with quote

The ifMud is sometimes described as the Hugo Love Bus, iirc
_________________
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
Bainespal



Joined: 09 Jul 2010
Posts: 151

PostPosted: Tue Jul 26, 2011 6:22 pm    Post subject: Reply with quote

Thanks for the advice. There really is no satisfying solution, I guess. I'll postpone the decision as to whether to do one of those work-arounds until after I'm done implementing the whole game.

Roody_Yogurt wrote:
Also, you can always get an answer on here within the day or two it takes for us to notice it (and it is nice for all of the MILLIONS of future Hugo authors who get to see the answer), but if you ever need a quicker answer, hop on to the ifMUD where I most likely am.

I made a character on the ifMUD a while ago... I wanted to attend the XYZZY awards, but I couldn't find them. I should logging in from time to time. It's a good thing that Hugo is being discussed there more than it is here, although it is good to know that my topics here will stand as a monument for future generations. ;-)
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Tue Jul 26, 2011 7:00 pm    Post subject: Reply with quote

Ok, let's try to tempt you with a couple more options.

1) You could use the window class object from Kent Tessman's Future Boy! source. It goes the window-is-a-container route but has the advantage of someone-having already written the code for you:

Code:
scenery window_object   ! base class for (physical) windows
{
   is container
   is transparent
   react_before
   {
      if verbroutine = &DoJump and not object and location is inside
      {
         "Surely you don't mean out the window."
      }
      else
         return false
   }
   before
   {
      object DoJumpOff
      {
         Perform(&DoGo, self)
      }
      object DoLookIn
      {
         Perform(&DoLookThrough, self)
      }
      object DoLookThrough
      {
         "Perhaps your voyeuristic side can wait for another time."
      }
      xobject DoPutIn
      {
         Perform(&DoThrowThrough, object, self)
      }
      object DoHit
      {
         "Have a bit of the vandal in you, do you?"
      }
      xobject DoThrowThrough
      {
         "Wouldn't seem to be a big point to that, really."
      }
      xobject DoLoop
      {
         ! >PUT X THROUGH Y grammar gets us here
         Perform(&DoThrowThrough, object, self)
      }
      object DoPush, DoPull
      {
         if self is openable
         {
            if self is open
               Perform(&DoClose, self)
            else
               Perform(&DoOpen, self)
            return true
         }
         return false
      }
   }
}


Go look here if you want more info on object classes.

2) Instead of my previous grammar suggestion, add the following before verblib.g is included:
Code:

verb "look", "l", "examine", "x", "watch"
* "in"/"inside" (objectname)      DoLookIn
 

The downside to that is that you'll have to add that line for every instance of windows in your game, but hey, if you have just one window...
Back to top
View user's profile Send private message AIM Address
Bainespal



Joined: 09 Jul 2010
Posts: 151

PostPosted: Thu Jul 28, 2011 5:44 am    Post subject: Reply with quote

Roody_Yogurt wrote:
2) Instead of my previous grammar suggestion, add the following before verblib.g is included:
Code:

verb "look", "l", "examine", "x", "watch"
* "in"/"inside" (objectname) DoLookIn


The downside to that is that you'll have to add that line for every instance of windows in your game, but hey, if you have just one window...

I do have just one window.... that's the perfect solution! :)

Thank you.
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Thu Jul 28, 2011 11:38 pm    Post subject: Reply with quote

Glad to hear it! (I need to get around to writing a page about grammar tokens for HxE)
Back to top
View user's profile Send private message AIM Address
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