Are there escape characters in MCSI?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
NewtSoup
Posts: 1405
Joined: Wed, 16. Nov 05, 13:33
x4

Are there escape characters in MCSI?

Post by NewtSoup » Wed, 29. Oct 14, 21:07

Such as in other languages for example /n for a newline carriage return?

If so can someone point me at the correct reference?

thanks

** edit

What I want to do is pull data on a sector and output it on multiple lines on a single write to log file operation.

I can of course do a write to log file for each line of data I want to write but I consider that inelegant.
I am a rock in the wind, watch how I plummet!
Gamer Girl since 1981 Mistress of Heavy Landings since 1984 (BBC-B Elite)

Corei7 7700, 16GB Ram, MSI RX6700XT, Sidewinder FFB2, Kubuntu 22.04

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Wed, 29. Oct 14, 21:51

\n

NewtSoup
Posts: 1405
Joined: Wed, 16. Nov 05, 13:33
x4

Post by NewtSoup » Wed, 29. Oct 14, 22:32

See that doesn't work,

If you do

Code: Select all

$test = "This is \n a test"
write to log file # 1972 append=[false] value=$test
return null
What gets output to the logfile is:

This is \n a test

rather than:

This is
a test

as you might expect.

But thanks for the input.
I am a rock in the wind, watch how I plummet!
Gamer Girl since 1981 Mistress of Heavy Landings since 1984 (BBC-B Elite)

Corei7 7700, 16GB Ram, MSI RX6700XT, Sidewinder FFB2, Kubuntu 22.04

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Wed, 29. Oct 14, 22:39

read the newline char from a t-file instead of writing it directly in the script, because the newline is parsed then (it is possible to add iit directly into a script, but tricky)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

NewtSoup
Posts: 1405
Joined: Wed, 16. Nov 05, 13:33
x4

Post by NewtSoup » Wed, 29. Oct 14, 23:25

OK. So I have the following script:

Code: Select all


$newline = read text: page=1971 id=1
$test = 'This is' + $newline + 'a test'
write to log file 1971 append=[FALSE] value=$test
return null

and the following file "1971.xml" in the t directory

Code: Select all


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated using X-Studio -->
<language id="44">

	<page id="1" title="Title" desc="Description" voice="no">
		<t id="1">\n</t>
	</page>
</language>

the output to my test logfile is :

Code: Select all


This isReadText1971-1a test

Where am I going wrong?
I am a rock in the wind, watch how I plummet!
Gamer Girl since 1981 Mistress of Heavy Landings since 1984 (BBC-B Elite)

Corei7 7700, 16GB Ram, MSI RX6700XT, Sidewinder FFB2, Kubuntu 22.04

User avatar
jack775544
Posts: 1277
Joined: Tue, 13. Dec 11, 08:27
x4

Post by jack775544 » Thu, 30. Oct 14, 01:27

You have to load the text file first.
1940s - Various "computers" are "programmed" using direct wiring and switches. Engineers do this in order to avoid the tabs vs spaces debate.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 30. Oct 14, 10:03

I highly recommend to put all your texts into your t file. Here is an example :

Code: Select all

$Text.Page = 7321
load text: id=$Text.Page

$Greetings = read text: page=$Text.Page id=100

$MySector = [SECTOR]
$Author = 'Big Daddy'
$Text.f = sprintf: fmt=$Greetings, $Author, $MySector, $Value, $Value, $Value

write to player logbook $Text.f
In the t file :

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<language id="44">

<page id="7321" title="Title" descr="Desc">

<t id="100">[author]%s[author]Hello,\n\nWelcome to \033Y%s\033X !</t>

</page>
</language>
The name of the sector will be displayed in yellow (Y). Other colors : White, Silver (A), Green, Orange, Red, Default (X), Magenta, Blue and Cyan.

Refer to this to not use a t file already used by another mod.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 30. Oct 14, 14:54

Luke Skyscraper wrote:OK. So I have the following script:

Code: Select all


$newline = read text: page=1971 id=1
$test = 'This is' + $newline + 'a test'
write to log file 1971 append=[FALSE] value=$test
return null

and the following file "1971.xml" in the t directory

Code: Select all


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated using X-Studio -->
<language id="44">

	<page id="1" title="Title" desc="Description" voice="no">
		<t id="1">\n</t>
	</page>
</language>

the output to my test logfile is :

Code: Select all


This isReadText1971-1a test

Where am I going wrong?
You test file is not correct. You are looking for test in page 1971, but in your text file you put it in page 1

you need to make the page id from the text file match the one you are using in the script.

you also need to load in the text file, using the load text:id= command

NewtSoup
Posts: 1405
Joined: Wed, 16. Nov 05, 13:33
x4

Post by NewtSoup » Thu, 30. Oct 14, 15:33

Cycrow wrote: You test file is not correct. You are looking for test in page 1971, but in your text file you put it in page 1

you need to make the page id from the text file match the one you are using in the script.

you also need to load in the text file, using the load text:id= command
Yoush! Got it. Thanks Cycrow - Just this little thing has been a valuable lesson in how t files work.

My output to the logfile is now

This is
a test

Just as I wanted. Now I can use that newline char to build better log messages.
I am a rock in the wind, watch how I plummet!
Gamer Girl since 1981 Mistress of Heavy Landings since 1984 (BBC-B Elite)

Corei7 7700, 16GB Ram, MSI RX6700XT, Sidewinder FFB2, Kubuntu 22.04

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”