doType horrors

I’m attempting to write a game in TADS 2; I started years ago, and have only just picked it up again. It was going well… until I needed a keypad. It’s a simple keypad, a single object; all I need is to be able to say “type 1234 on keypad”. However, try as I might, I can’t figure out how to do so. Once the number is type, it compares it to the ‘code’ number, and unlocks a door it it matches, or otherwise clicks and does nothing.

I know it’s just my grasp of the language - I’ve gotten pretty far using guides, looking at code, and just using common sense, but this has got me stumped. If I could figure out how to use the typeOn verb, that would probably pull me through…

Also, this is my first post here, so, hi! :slight_smile:

numObj:basicNumObj  // This definition is probably already present in your standard std.t file
Keypad: fixeditem
ioTypeOn(actor, dobj)={if(dobj.value=1234)
                         {"You have won!";
                         {"The number you typed is incorrect.";

This should work. The calling sequence for indirect/direct object methods is as follows:

direct object.verDoTypeOn(actor, indirect object)
indirect object.verIoTypeOn(actor)
indirect object.ioTypeOn(actor, direct object)

For the command “type 1234 on keypad”, the direct object is the so-called numObj - a special class that handles numbers. value (which is checked in the if operator) is a special property of this class that contains the actual value of the number.

Aha! ioTypeOn, instead of doTypeOn… that makes sense. And it works perfectly! Thanks for that :smiley: