So 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.
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.
The 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
the 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