A look at TADS

Discuss text adventures here! The classics like those from Infocom, Magnetic Scrolls, Adventure International and Level 9 and the ones we're making today.

Moderators: Ice Cream Jonsey, AArdvark

User avatar
Flack
Posts: 6164
Joined: Tue Nov 18, 2008 3:02 pm
Location: Oklahoma
Contact:

Post by Flack » Fri Dec 09, 2016 7:03 am

Can we get an object or class added to TADS for signs that follow the player around?
"Jack Flack always escapes." -Davey Osborne

User avatar
Tdarcos
Posts: 5608
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos » Sun Dec 11, 2016 10:47 am

pinback wrote:Post a code snippet that isn't working that you think should be working. I have never used TADS, and I guarantee you I will be able to point out what you're doing wrong, and where the manual explains what you're doing wrong, within 15 minutes.
Not everything is in the same place in the manuals and some things are not completely clear. It's funny, when I downloaded the PDF reference manual for the MySQL datanase, and opened it, I almost swallowed my tongue to see it is a whopping 5,000+ pages. I thought that was overkill. Now I realize some things can require a lot more documentation to be comprehensive.

Here's the snippet.

Code: Select all

VerbRule(XThrow)
    'throw' singleDobj
    : XThrowAction
    verbPhrase = 'throw item'
;

VerbRule(Trip)
    'trip' singleDobj
    : XThrowAction
    verbPhrase = 'throw/trip item'
;


DefineTAction(XThrow)
    execAction()
    {
        "Xthrow exc action";
    }
;

fusebox: Fixture 'fuse meter breaker fusebox meterbox breakerbox box' 'breaker box'
    "It's a standard electrical breaker box."
    location = Meter_Room
;    
+breaker_kitchen: breaker  'breaker kitchen' 'kitchen breaker'
    target = Kitchen
        dobjFor(Throw)
    {
        verify() { }
        action() { "Throw - D Action"; }
    }
   
    iobjFor(Throw)
    {
        verify() { }
        action() { "Throw - I Action"; }
    }
   
   
;


That should at least allow me to see that if I TRIP BREAKER KITCHEN (in the room where Kitchen breaker is defined) it should show me a message. I have to call it XThrow because THROW was defined and I'm redefining it and I'm not quite sure how to replace the original definitions.
"I know what you're doing, I see it all too clear."
- Duncan Sheik, Barely Breathing

User avatar
Tdarcos
Posts: 5608
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos » Sun Dec 11, 2016 10:51 am

Sorry, forgot

Code: Select all

class breaker: Fixture
    is_breaker = 1
    location = fusebox
    tripped = nil               // user has not tripped this
    on = 1                      // thisd breaker is not off
    target = nil                // room or device it controls

    dobjFor(Throw)
    {
        verify() { }
        action() { "Throw - D Action"; }
    }
   
    iobjFor(Throw)
    {
        verify() { }
        action() { "Throw - I Action"; }
    }
   
   
;    
"I know what you're doing, I see it all too clear."
- Duncan Sheik, Barely Breathing

User avatar
Tdarcos
Posts: 5608
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos » Mon Dec 12, 2016 11:42 am

Ice Cream Jonsey wrote:
pinback wrote:
Post a code snippet that isn't working that you think should be working. I have never used TADS, and I guarantee you I will be able to point out what you're doing wrong, and where the manual explains what you're doing wrong, within 15 minutes.
If Pinner can't, I will put a $100 donation to the Blue Cross / Blue Shield in your name, Paul. That's how confident I am.
You've spent so much time complaining about me and Billy Mays that you lose. Pinback has been here, saw all the other messages, so I have to presume he saw this one, and made no response. So much for his promise of half Domino's Pizza's response time.

Can we look at this as an example that maybe all of us make mistakes and forget things?
RealNC wrote:Yes, you are correct. It's broken. It doesn't work as intended. Nobody noticed this before, weird.

Well, either that, or you didn't really RTFM.
I did read the manuals. I took a piece of code that does work for a different verb and made the modifications for the new verb and it does not work. It's clearly obvious I'm doing something wrong and I do not know what it is.

I will now reiterate what I said before. I have said repeatedly that I know I'm doing something wrong. And I don't know what it is. What I am saying is that this system frustrates me because I have to fight it every step of the way to get anything accomplished. It should not be this difficult and it should not be this restrictive.

Maybe someone can explain why it is necessary to forbid a defined object from implementing a processor for a particular verb if it is the direct or indirect object of that verb. I know the process should work because it does work for PLUG IN TV / PLUG TV IN and PLUG TV INTO SOCKET as well as where CABLE BOX is substituted for TV.

So when I tried to implement TRIP KITCHEN (with or without the word BREAKER) it's clear I'm doing something wrong because instead of executing the stub code that outputs my message (which would allow me to later fill in with the actual code to implement the action) it returns "You can't do that." which means that somewhere along the way it either is not seeing the methods I put in, it is not invoking them, or there is something else involved that I'm not seeing that also needs to be done.

Since it works in one context in theory it should work for the same context if implemented the same way but it doesn't. So either There's something I'm not seeing or I'm not doing the same thing.

I think what I will do is, since I'm banned from posting everywhere but here and the Troll room for the remainder of the time, to set up some scaffold code for fictitious words that are not implemented by copying ones straight out of either the library or some TADS3 games and see if I am doing them correctly. Then if XA KITCHEN , XA TV or XE TV, XE BREAKER works, then I know I was implementing THROW KITCHEN WRONG. But if that also fails then I'll know I don't understand the system.

Either that or maybe I'll just see what verbs TADS has built-in support for that Hugo doesn't and rewrite either the system libraries or Roodylib to add them.

I'm just really not seeing a whole lot of benefit to TADS over Hugo at this point and I thought it might be worth trying but every time I turn around it's like I have to fight the TADS system to accomplish what I want to do.

I'm starting to understand what Jonsey was complaining about.
"I know what you're doing, I see it all too clear."
- Duncan Sheik, Barely Breathing

User avatar
RealNC
Posts: 1462
Joined: Wed Mar 07, 2012 4:32 am

Post by RealNC » Tue Dec 13, 2016 6:14 am

I don't see a handler for Trip in your code.

Also, your throw action cannot possibly work. It clashes badly with the default throw action. Your new Throw is "XThrow", but in your object, instead of handling XThrow, you handle Throw... So when the command is THROW X, which throw action does that refer to? Throw or XThrow? I don't know. So don't do that.

If you want to modify the default Throw action, you can modify its VerbRule. Leave the vocabulary empty to inherit the default one (which is "('throw' | 'toss') dobjList", defined in adv3/en_us/en_us.t):

Code: Select all

modify VerbRule(Throw)
    /* vocabulary empty on purpose */
    :
    execAction()
    {
        // ...
        // your own code here.
        // ...

       // Call overridden method.
       inherited();
    }
;
Why on earth do you want to modify Throw though?

User avatar
RealNC
Posts: 1462
Joined: Wed Mar 07, 2012 4:32 am

Post by RealNC » Tue Dec 13, 2016 6:17 am

Also, you should probably switch to adv3Lite. The default library (adv3) is extremely simulationist and very complex.

User avatar
Tdarcos
Posts: 5608
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos » Tue Dec 13, 2016 4:33 pm

RealNC wrote:I don't see a handler for Trip in your code.
I did have it in the listing I posted:

Code: Select all

VerbRule(Trip)
    'trip' singleDobj
    : XThrowAction
    verbPhrase = 'throw/trip item'
; 
This is intended to make TRIP KITCHEN BREAKER and THROW KITCHEN BREAKER accomplish the same thing.
RealNC wrote:Also, your throw action cannot possibly work. It clashes badly with the default throw action. Your new Throw is "XThrow", but in your object, instead of handling XThrow, you handle Throw... So when the command is THROW X, which throw action does that refer to? Throw or XThrow? I don't know. So don't do that.
When you use the same verb sequence in another definition it uses the later one. I just couldn't figure out how exactly to override the original THROW verb handler.
RealNC wrote:If you want to modify the default Throw action, you can modify its VerbRule. Leave the vocabulary empty to inherit the default one (which is "('throw' | 'toss') dobjList", defined in adv3/en_us/en_us.t):

Code: Select all

modify VerbRule(Throw)
    /* vocabulary empty on purpose */
    :
    execAction()
    {
        // ...
        // your own code here.
        // ...

       // Call overridden method.
       inherited();
    }
;
Why on earth do you want to modify Throw though?
"THROW BATHROOM BREAKER" or"THROW BATHROOM SWITCH" or "TRIP BATHROOM BREAKER" or "TURN ON BATHROOM BREAKER" or "TRIP AIR CONDITIONER", "TURN OFF AIR CONDITIONER" etc. to indicate the person wants to change the position of the fuse box breaker switch from on to off or vice versa. This would be separate from THROW COFFEE POT AT REFRIGERATOR (which is a different and valid action elsewhere in the game).
"I know what you're doing, I see it all too clear."
- Duncan Sheik, Barely Breathing

User avatar
pinback
Posts: 13409
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post by pinback » Tue Dec 13, 2016 5:24 pm

I don't know TADS.

Could you just override the switch's "throw" action to redirect to "turn on"?

(Also nobody will ever type "throw bathroom switch", and if they did, and the response was "you can't throw that, it's attached to the wall!" then they would surely understand.)
Above all else... We shall go on... And continue!

User avatar
RealNC
Posts: 1462
Joined: Wed Mar 07, 2012 4:32 am

Post by RealNC » Tue Dec 13, 2016 6:32 pm

Do not do anything to Throw. Don't modify it, nor add an XThrow.

Just add a new Trip action, and in your class for switch-like objects, implement a Trip handler, and map Throw to Trip with:

Code: Select all

dobjFor(Throw) asDobjFor(Trip)
Do not modify default actions without a good reason. And the reason you gave is not good :-P

User avatar
pinback
Posts: 13409
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post by pinback » Tue Dec 13, 2016 8:17 pm

RealNC wrote:Just add a new Trip action, and in your class for switch-like objects, implement a Trip handler, and map Throw to Trip with:

Code: Select all

dobjFor(Throw) asDobjFor(Trip)
This is essentially what I said. So I take it back, I am a TADS expert.
Above all else... We shall go on... And continue!

Post Reply