using variables in object links

Doug Egan
08 Dec 2018, 15:41
msg ("The {object:lion} is jumping")
thisobj=lion
msg ("The {object:thisobj} has a golden mane.")
thatobj=GetObject("bobcat")
msg ("The {object:thatobj} has spots.")

In the code shown, only the first message displays a correctly formatted object links.
The other two lines print literal

The {object:thisobj} has a golden mane.
The {object:thatobj} has spots.

How can I get all three lines to print formatted object links?


Doug Egan
08 Dec 2018, 16:34

OK, I just found the recent thread titled "Text Processor Object Link Nesting Bug" which provides some insights into this problem. Thanks to members who replied in that thread.


mrangel
09 Dec 2018, 09:46
msg ("The {object:lion} is jumping")
game.text_processor_variables = QuickParams ("thisobj", lion, "thatobj", bobcat)
msg ("The {object:thisobj} has a golden mane.")
msg ("The {object:thatobj} has spots.")

Dcoder
09 Dec 2018, 10:56
thisobj = lion
msg ("The " + ProcessText("{object:" + thisobj.name + "}") + " has a golden mane.")

(mrangel's genius)