The below code lives in a room script, in the doVerb method of a prop. I have a text resource that contains all of my noun names, resource 1 and in this case hard-coded to index position 35 (sword). I've ripped everything out except for the code that I'm struggling with:
; On first invocation, prints "The sword won't fit in the box".
; On subsequent invocations, only prints "sword"
(method (doVerb theVerb param2 &tmp [test1 50])
(Printf "The %s won't fit in the box" (GetFarText 1 35))
)
I tried this with the same results as above:
; On first invocation, prints "The sword won't fit in the box".
; On subsequent invocations, only prints "sword"
(method (doVerb theVerb param2 &tmp [test1 50])
(StrCpy @test1 (GetFarText 1 35))
(Printf "The %s won't fit in the box" @test1)
)
The only thing that does work is this:
; On every invocation, prints "The sword won't fit in the box".
(method (doVerb theVerb param2 &tmp [test1 50])
(Printf "The %s won't fit in the box" (Format @test1 1 35))
)
Can someone help me understand what's going on here? Seems like #1 & #2 should work fine, #3 sort of makes sense (I assume a pointer to @test1 is being returned from the Format call and the Printf statement is able to use it).