WML: message / print
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
WML: message / print
It looks like variables work in the "message"-command, but not in "print":
The message-statement shows "Monster: Merman.", which is ok.
But the print-statement shows "Monster: $monster.", i.e. it does not expand the variable.
Code: Select all
[event]
name=start
[set_variable]
name=monster
value="Merman"
[/set_variable]
# ok:
[message]
speaker=narrator
caption= "Test"
message= "Monster: $monster."
[/message]
# Bug:
[print]
text="Monster: $monster."
size=20
duration=100
red,green,blue=255,255,255
[/print]
[/event]
But the print-statement shows "Monster: $monster.", i.e. it does not expand the variable.
-HaJo
Re: WML: message / print
It's not a bug, it's a documented feature. Dollar signs don't get expanded in every context - it's one of the awkward things about WML. Variables and $-signs are always expressed in the [set_variable] format key.HaJo wrote:The message-statement shows "Monster: Merman.", which is ok.
But the print-statement shows "Monster: $monster.", i.e. it does not expand the variable.
Try this:
Code: Select all
[set_variable]
name=print_message
format="Monster: $monster"
[/set_variable]
[print]
text=$print_message
[/print]
Try some Multiplayer Scenarios / Campaigns
Re: WML: message / print
It works - Thanks !Rhuvaen wrote:Try this:HaJo wrote:The message-statement shows "Monster: Merman.", which is ok.
But the print-statement shows "Monster: $monster.", i.e. it does not expand the variable.Code: Select all
[print] text=$print_message [/print]
It would be nice if WML were more 'regular', i.e. less special cases such as this.it's one of the awkward things about WML
-HaJo