compile erorrs transitioning from adv.h to advlite.h

As a newbie TADS 3 user, I’m a bit conflicted re: adv3Lite.

Do I stay with the tried and true until I get my sea legs, or do I just plunge in and stake my fortune on a beta library?

I think I’m coming down off the fence on the side of Lite.

So, I rebuilt my ATM cash dispenser exercise using the Lite library and hit a couple of snags.

My ATM exercise dispenses $20 dollar bills.

The Dollar class is a direct copy of the Coin class in the sample.t file that I found in C:\Program Files (x86)\TADS 3\samples. In my exercise using the standard library, it works, the ATM delivers the cash.

When I use advlite.h instead of adv.h and try to compile in the Windows Workbench, I get this…

As to the first warning, Eric explained in another post there is no pcReferral property, that’s handled differently in Lite, so I can adjust to that.

That leaves the other two.

Here’s the code that the compiler chokes on with a curIobj complaint…

if(gIobj.ofKind(atm)) { say('When Harry inserts the debit card into the machine, it becomes operational. Harry enters his PIN and withdraws $100 in 20s, retrieves the card, and puts it back into his wallet. '); atm.loadWallet(); self.moveInto(wallet); }

The compiler highlights the if() statement as the offender.

For the DigitFormatGroupSep warning, the compiler highlights the <<spellIntBelowExt( … )>> line…

dollarGroup: ListGroupParen showGroupCountName(first) { "<<spellIntBelowExt(first.length(), 100, 0, DigitFormatGroupSep)>> bills"; } compareGroupItems(a, b) { return b.dollarValue - a.dollarValue; } showGroupItem(lister, obj, options, pov, info) { say(obj.dollarGroupName); } showGroupItemCount(lister, first, options, pov, infoTab) { say(first[1].countedDollarGroupName(first.length())); } ;

This code works fine when the exercise is built with adv.h (the method is a direct copy from sample.t, except for my dollar class instead of the sample’s coin class).

I confess I have just this morning downloaded Lite and started my conversion; I have not yet read the docs. If an RTFM is in order, by all means someone clue me in.

Meanwhile, for reference, I’ve zipped the ATM exercise and attached it here.

Jerry (2.75 KB)

Adv3Lite is a different library from adv3. You can’t simply take code written for the adv3 library and expect it to compile with adv3Lite, since adv3Lite does a whole lot of things differently. For example there’s no ListGroupParen class in adv3Lite so there’s no way your dollarGroup object can compile.

I’m glad you want to give adv3Lite a try, but you really will have to read the docs and make several adjustments to your code. For example, your Dollar class tries to make use of a whole lot of properties that simply don’t exist in adv3Lite. Adv3Lite doesn’t even use the vocabWords property in the same way that adv3 does; instead it uses a property called vocab which allows you to define the vocabWords and name properties together. For your money.t file to compile in adv3Lite you’d have to define the classes along the following lines:

class Dollar: Thing 'dollar bill'

class TwentyDollarBill: Dollar '20 +; twenty'      
    dollarValue = 20    

class TenDollarBill: Dollar '10 +; ten'      
    dollarValue = 10    

However, I suspect there may be something even more fundamentally amiss, unless I have misunderstood you:

If you really mean that all you’ve done is to replace #include <adv.h> with #include <advlite.h> in all your source files, then I fear you really will be getting in a mess. If that’s what you’ve done, you haven’t actually switched to the adv3Lite library at all; you’re simply trying to use adv3Lite’s header file with the adv3 library, which has absolutely no chance of working whatever you do with your source code; but from the error messages you’re getting I have a suspicion that that’s what you may have well have done.

As a first step you need to follow the instructions in the section on Starting Out — A Minimal Game Definition of the Manual (or you may find it easier to follow the instructions in Chapter 2 of the Tutorial) to set up a game that actually does use the adv3Lite library. Then you’ll have to make quite a few changes to your code to make it work with the adv3Lite library, for which you’ll need to study the docs quite carefully (Parts I and II of the Manual will at least get you started). If you’re still having difficulty when you’ve done all that, I’m quite happy to advise.