I’m still in the process of upgrading my brain from I6 to I7, and have a quick question:
In I6, one could define a class, inside which you might define various procedures. If you instanced the class, you could override a default procedure by redefining it when you create an instanced object. So foo.describe() by default would print out the generic class description, but if I create an instance of foo and declare a new describe() routine, that would override the class describe().
Then I could step through all my foos with a for/while loop with x as the index, and call x.describe() and all would print out the way I’d want.
What would be the equivalent syntax in I7? Say I want an NPC to have a generic class routine that select instances of the class might override with something specific, and then I want to call all the NPCclass.routine() in a loop… what’s the proper way to do that?
Thanks in advance…
You could use a rulebook, which would be the more flexible option, or define a generic procedure (To describe (item - an object)…) and then overload it with the more specific ones (To describe (item - a container)…) and so on down to the most specific (To describe the clock…).
For the special case of printing stuff, I7 has the same model as I6. You can define a description property for a class (possibly with custom inclusions or [if] blocks), and then put different properties on subclasses, etc.
For general code, what Draconis said. Define a rulebook.
Draconis and Zarf…
Thanks guys. My description routine example was just that… an example. I was wondering in general what the equivalent way to do this was in I7. New rulebook makes sense now that I’ve reread the docs on rulebooks a few times over.
It’s not easy getting the old paradigms and habits out of my head. I7 is pretty unique. I’m still wrestling with it, but it’s growing on me.
Next up is trying to wrap my head around the paragraph printing algorithm and various rules as laid out in App. A. Trying to customize output (line breaks in particular) seems to be an art in itself. And from what I’ve read in old posts here and from messing around with the various formatting terms, it can be a challenge at times.
Happy New Year!