Monday, September 17, 2012

new debugging verb

The last time I was looking over roodylib's comments and documentation, I was reminded that I had added a new debugging verb (and had failed to mention it). Anyhow, it's called "verbtest", and it's pretty much a ripoff of something I saw that Juhana Leinonen wrote for Inform 7 the other year. Basically, you use it on an object, and it shows you the response to a ton of default verbs.

Here is an example transcript from a game I'm working on:
>verbtest house
Getting object:
You can't take that.

Wearing object:
You can't wear the house.

Listening to object:
The house is not making a sound.

Eating object:
You can't eat the house.

Drinking object:
You can't drink the house.

Hitting object:
Venting your frustrations on the house won't accomplish much.

Hello-ing object:
That doesn't make any sense.

Examining object:
Dark and silent.

Looking through object:
You can't see through that.

Looking under object:
You don't find anything under the house.

Go-ing object:
No, it's time to go home.

Entering object:
No, it's time to go home.

Sitting on object:
No, it's time to go home.

Exiting object:
You're not in the house.

Moving object:
You can't move the house.

Searching object:
You don't find anything new.

Smelling object:
You don't smell anything unusual.

>
The intent is that it'll remind authors of obvious commands that should have better responses.

Maybe I'll incorporate it into HugoFix at some point (giving it a $vt command or something), but that seems a bit presumptuous for now.

4 comments:

  1. This is one of the most useful things I've seen and it should definitely find it's way into HogoFix. I found an embarrassing bug in my game the first time I tried it.

    I did notice one small thing. I didn't have verb stubs set and noticed that the verbs DoSearch and DoSmell were in the standard verb section as opposed to being checked with all the other verb stubs. This is with Roodylib version 1.8.

    ReplyDelete
    Replies
    1. I actually forgot why I did this just the other day and had to remind myself. It's actually not a mistake, as Roodylib adds DoSmell and DoSearch support, regardless. I don't remember my exact reasons, but it was something along the lines that I figured those specific commands were common enough that they should be accepted in every game (well, DoSmell partly got thrown in since DoListen already is standard and, as of Roodylib, they now work the same way).

      I'm at a point where I just need to write a bunch of descriptions and things for rooms and objects in a WIP that I'm finishing up, so I've been using DoVerbTest a lot. One issue that I ran into is, since DoVerbTest is a verb routine, objects with "mostly closed" before routines (like an object that returns false for DoLook but prints a message and returns true for everything else), DoVerbTest is not properly run.

      So, I ended having my routine-that-runs-DoVerbTest-on-every-object-in-scope-in-the-game (so I can dump the text to a transcript and work on my responses in a word processor) treat DoVerbTest as a regular routine (and not call it with Perform, which would check before routines):

      routine DoVerbTestAll
      {
      local a, b, c
      print "Total objects: "; number objects
      print "Highest object number: "; number (objects - 1)
      a = player
      do
      {
      if a.type = room
      {
      c = 0
      print ""
      MovePlayer(a, 1, 1)
      print "Room: "; a.name
      for (b=player ; b< objects ; b=b+1)
      {
      if b.type ~= room and b~= player
      {
      if FindObject(b,a) and b is not done
      {
      FONT(BOLD_ON)
      print "Object: "; b.name
      Font(BOLD_OFF)
      object = b
      DoVerbTest
      ""
      c++
      }
      }
      }
      }
      a++
      }
      while a< objects
      }

      Oh yeah, the above code also expects an attribute called "done", which I'm adding to objects as I get through ones I am satisfied with.

      Delete
  2. I think you're right that "smell" and "search" should be a part of every IF game. I hadn't noticed that you made those verbs a standard part of Roodylib because of my two pronged approach to learning it.

    On the one hand, I have one game file where I've included Roodylib in it's entirety. I haven't done a great deal with this since I found Roodylib to be a bit too much to take in one big bite.

    This led to the second approach, which was to break it down into parts and include those parts seperately into various projects. The one drawback is that everything is so interconnected that I can't add one thing, but many. That isn't a criticism, by the way, since I consider such interconnectedness a mark of good design. But it does increase the challenge. It's also led to discoveries I might not have made otherwise so, overall it's a plus. In fact, I've considered starting a thread at the JC Hugo base titled something like "Adventures in Roodylib" to discuss all the good that's there.

    Your DoVerbTestAll routine is pretty freakin awesome. I tried it and it's sort of like getting a complete transcript of your game from a very thourough beta tester. I guess the version of DoVebTest that you use with it is different from the one in Roodylib? I assume this is the case since you wanted to avoid "Perform". I wouldn't mind seeing the modified version, if it is different.

    ReplyDelete
    Replies
    1. (First off, I think the style format features for comment replying really leaves a lot to be desired. I haven't found a place to change that yet.)

      "This led to the second approach, which was to break it down into parts and include those parts seperately into various projects. The one drawback is that everything is so interconnected that I can't add one thing, but many."

      For whatever reason, I was going to reply to this bit with an example of an often-called routine and explain it. I was going to use InitScreen, which is RoodyLib's default clearing-the-screen program. My thinking was that even clearing-the-screen can be perfected. Of course, as I was about to write about it yesterday, I noticed that it still had a lot of code that I never ended up using (from back when I was thinking of incorporating "cheap" functionality into RoodyLib, I think). It has since been trimmed down.

      My point is, I can imagine how frustrating it is trying to learn something that is still subject to change. Anyhow, a thread where RoodyLib is discussed would be a good place to debate the usefulness of its components, and I'd love to elaborate my thinking on this or that part, as needed.

      My DoVerbTestAll routine should use the regular DoVerbTest just fine. I avoid Perform so object before routines can't stop it from testing the full gamut of commands. Because I don't use Perform, though, DoVerbTestAll has to set the object global each time (since Perform would normally do that).

      I sometimes think I should move DoLook to be the first-verb-routine-tested, but I keep putting that off.

      Delete