Greetings, I’m completely new to writing in TADS 3 and mostly programming in general. I’ve (very slowly) been making my way through Eric Eve’s Learning T3 tutorial and trying things along the way and I hit a snag at getting a simple method to work
The first example of method in the tutorial deals with how to create a method to change the name propriety of an item. I tried to do it with the ‘desc’ propriety instead, as follows:
Mike: Person 'man/guy/mike' 'Mike' @SecondRoom
"A man”
;
+tattoo: Component 'mike\'s tattoo' 'tattoo'
desc = "A tattoo"
changeDesc(newDesc)
{
desc = newDesc;
}
;
This ‘tattoo’ being a component of the NPC Mike. The tutorial goes on to explain how to make a hidden item (a ring in this case) appear by looking for it, so I decided to hijack the setting of the ‘discovered’ propriety of the ring to also serve as the call for changing the description of the tattoo, like this:
[code]
- ring: Hidden, Wearable ‘ring’ ‘gold ring’
“A golden ring”
; - rock: Immovable ‘grey rock’ ‘rock’
“A big grey rock”
dobjFor(LookUnder)
{
action()
{
tattoo.changeDesc(‘A dragon tattoo’);
{
if(ring.discovered)
“There is nothing else.”;
else
{
ring.discover();
“You find a ring”;
}
}
}
}
;[/code]
All the code here deals with making the ring show up if I look under the rock, which works perfectly, except for the line that I added “tattoo.changeDesc(‘A dragon tattoo’);” that is also supposed to change the ‘desc’ propriety of the tattoo.
Now, something works here, just not all of it. When I run the game, I can examine the tattoo and get the first description (“A tattoo”) just fine, but once I find the ring, examining the tattoo makes the game return the default “Nothing obvious happens” response, meaning that SOMETHING happened to the ‘desc’ propriety, but it was not correctly replaced by ‘A dragon tattoo’ like I wanted.
I’ve been scratching my head for a good while and I can’t figure out what’s wrong, and I really don’t want to keep reading until I can sort out something as basic as this. Any help would be really appreciated.