A better understanding of {=code}

Brian5757
24 Feb 2020, 13:01

An example of using the command {=code} in the help section is this:
You look out the window: {=LookOutWindow}

Is the LookOutWindow the name of a command?
I have tried it on a name of a command I created for Quest eg TestRoom but it does not work.


Pertex
24 Feb 2020, 15:12

I think LookOutWindow is the name of a function


mrangel
24 Feb 2020, 15:27

The = text processor command is a short form of eval.

So the expression inside it can be any Quest expression that returns a string.

This could be the name of a function (in which case () will automatically be added to the end, or anything else that generates a string (for example {=ToWords(player.health) + " HP"}


Brian5757
24 Feb 2020, 22:25

Thanks mranel and Pertex.
So the word "function" was missing in the help file when it attempted to explain how this command works.
I have not looked at functions yet so I'll return to this =code command later.


mrangel
24 Feb 2020, 22:43

The word is probably "expression".

You can use pretty much anything that you could put in a

msg (expression here)