Hello! I’m learning TADS 3, trying to create a simple IF, following the official documentation (which is huge!)
I noticed a strange behavior that I’m unable to explain why it’s happening. I defined the action BreakWith
in this way:
DefineTIAction(BreakWith)
execAction()
{
"{You/He} break {that dobj/he}. ";
}
;
VerbRule(BreakWith)
('break' | 'destroy') dobjList 'with' singleIobj
: BreakWithAction
verbPhrase = 'break/breaking (what) (with what)'
;
and then I’m trying to override its default behavior in this way:
+ x: Thing 'x' 'x'
"x is a thing"
dobjFor(BreakWith)
{
preCond = [touchObj]
verify() { }
action(){
"test 1";
}
}
;
+ y: Thing 'y' 'y'
"y is a thing"
iobjFor(BreakWith)
{
preCond = [touchObj]
verify() { }
action(){
"test 2";
}
}
;
I’m expecting that break x with y
will print “test 2test1”, but instead You break that.
is printed (the default action, not the overriden action)
bonus strange thing, If I try to override an existing action, like CutWith
, it works as I expect:
+ x: Thing 'x' 'x'
"x is a thing"
dobjFor(CutWith)
{
preCond = [touchObj]
verify() { }
action(){
"test 1";
}
}
;
+ y: Thing 'y' 'y'
"y is a thing"
iobjFor(CutWith)
{
preCond = [touchObj]
verify() { }
action(){
"test 2";
}
}
;
cut x with y
correctly prints “test 2test 1”. Why is this happening? am I defining the action in the wrong way? I copied the code from the official documentation, I read that chapter like 5 times, but still I can’t find any error. any help?
thanks in advance guys!