Function Parameter in msg
wooterslw
22 Jan 2018, 16:13So I have a function and I want to print a msg inside that function and print one of the parameters I passed that function. I tried using the {} but that doesn't work.
For example: I call function -> combat ("Bad Guy", 5, 4)
Function is -> <function name="combat" parameters="mname, mskill, mstamina">
How do I print the mname in a msg function?
I tried - > msg ("The monster name is {mname}.") and it prints {mname} instead of the name I passed it.

K.V.
22 Jan 2018, 16:21The text processor knows not of local variables.
Try this:
msg ("The monster name is " + mname + ".")
wooterslw
22 Jan 2018, 17:22Awesome. Thanks.

K.V.
22 Jan 2018, 17:33Yayuh!
PS
If you use the GUI, be sure to make it an "expression" in the drop-down:
Curt A. P.
22 Jan 2018, 22:12K.V.
The text processor knows not of local variables.
What's the meaning of that?
I know the text processor...a bit, but have only two uses for it.

K.V.
22 Jan 2018, 23:35The text processor can read attributes which are set on objects, but not a local variable from a script.
So, if you have the local variable mname
in your script, you could do this:
// Set the local variable 'mname':
mname = "J. Belushi"
// Create a temporary attribute on the game object, set to mname:
game.temp_mname = mname
// Print the text:
msg("{game.temp_mname}")
// Delete the temporary attribute:
game.temp_mname = null
hegemonkhan
23 Jan 2018, 03:11the text processor uses 'Attribute' VARIABLES (VARIABLES contained within an Object):
NAME_OF_OBJECT.NAME_OF_ATTRIBUTE
NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION
http://docs.textadventures.co.uk/quest/text_processor.html
the text processor can't use local 'Variable' VARIABLES (the local Variables are deleted upon its containing scripting ending/completing):
NAME_OF_Variable
NAME_OF_Variable = VALUE_OR_EXPRESSION