Sign up Calendar Latest Topics

  Author   Comment  
Dave Thaler

Posts: 505
Reply with quote  #1 
The mission-file-docs.txt file says:
Starting with Version 2.5.102, all text in scripts comes with built-in variable formatting.  Any place in a script, like:
<log text="This is text." />
can now have formatted variables placed inside them, using the 'escape' character, '^' (also called a carat).  Like:
<log text="This is text.  Variable Bob = ^Bob^" />

However, I haven't been able to get that to work in 2.6, it just displays the string literally without replacing it with the variable value.  I've tried with both int and float variables.  Did the escape character change?
Xavier Wise

Posts: 1,143
Reply with quote  #2 
Try and use the 'vertical bar' to bracket the variable name, e.g.

log text="This is text |variablename|"

This works in the mission script when you want to add a variable into comms messages. Perhaps it will also work here for the log text.

Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
Mike Substelny

Avatar / Picture

Posts: 2,408
Reply with quote  #3 
Dave, you have found a documentation error. In an unreleased version of Artemis 2.6 the carat was the symbol to use, but testing revealed that the carat had other uses which could not be reconciled. Thom changed it to the vertical bar and the problem was solved. Apparently the documentation didn't get that update.

The |variablename| syntax should work in log files, Comms messages, big messages on the Main Screen, and Ship_text fields for Science scans and Hailing responses. It probably works in Warning Pop-ups but I haven't used it for that myself.

"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Dave Thaler

Posts: 505
Reply with quote  #4 
Originally Posted by Mike Substelny
Dave, you have found a documentation error.

Thanks, I confirmed that '|' works and updated wiki accordingly.  Also added it to the list in the "2.6.0 Bugs and Issues" topic.

Posts: 12
Reply with quote  #5 
I know this is an old thread, but did not find this answer anywhere. Since it dealt with the topic here I just replied rather than start a new post. 

I tried to just display a Variable as a popup and then as a comms message for some testing purposes and kept getting an bad var error. 
After a while of searching and trying various spellings etc, thinking I had hit a reserved word somehow, I then put the word "test" in front of the variable and it worked perfectly.  


Posts: 168
Reply with quote  #6 
I think I've run into this before. You can't start a text message or pop-up box with a variable or a "|" character. However, if you put a normal text character in front of it, such as a space, it should work.

If it's really important to not have a space in front of a variable, I think you can edit the mission file in a text editor (I use notepad) and add "&#x9;" in front of the variable. This is the hex code for "horizontal tab". When you open the file up with the mission editor, it converts &#x9; into a non-displayable character. You can also use &#x9; as the name of a generic mesh if you want something that doesn't display a name to the Science console. 

Previous Topic | Next Topic

Quick Navigation:

Easily create a Forum Website with Website Toolbox.