using variables in object links

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?


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.


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.")

thisobj = lion
msg ("The " + ProcessText("{object:" + thisobj.name + "}") + " has a golden mane.")

(mrangel's genius)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums