Formatting message log text
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Formatting message log text
This has changed in TC hasn't it?
<t id="1">\033B %s \033X</t>
Writing that to the log from the text file writes nothing. A big blank space, as opposed to the expected blue coloured text
EDIT, ANSWER FOUND:
Note to forume help searchers:
The old \033 codes do NOT work when writing text to the message log (though do work, oddly, with the menu system).
The correct method is to use, as -Duty- has indicated:
[yellow]Message Text[/yellow]
This works for all other colors too (red, blue, green, cyan, magenta, white).
<t id="1">\033B %s \033X</t>
Writing that to the log from the text file writes nothing. A big blank space, as opposed to the expected blue coloured text
EDIT, ANSWER FOUND:
Note to forume help searchers:
The old \033 codes do NOT work when writing text to the message log (though do work, oddly, with the menu system).
The correct method is to use, as -Duty- has indicated:
[yellow]Message Text[/yellow]
This works for all other colors too (red, blue, green, cyan, magenta, white).
Last edited by Litcube on Tue, 28. Oct 08, 22:00, edited 1 time in total.
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
Well this code definately works to highlight the word "Default" in yellow:
EDIT: Actually, the word is used in a 'custom menu', not the logbook. I don't know about adding colour to logbook messages...
Code: Select all
<t id="200">\033Y%s\033X</t>
<t id="403">Default</t>
. . .
$option = read text: page=$page.id id=403
$option = sprintf: pageid=$page.id textid=200, $option, null, null, null, null
Several X3R scripts definitely did wrote formatted text to logbook.
PS. AFAIK, the colour codes are changes of state machine rather than "tags". Thus,
prints:
Hello world!!
rather than:
Hello world!!
and therefore
is sufficient. For the red exclamations you would use:
It is a difference between
and
And whether you need the \033X (set colour to default gray) at the end depends on what/how the printing continues. But it is good style to set it explicitly.
PS. AFAIK, the colour codes are changes of state machine rather than "tags". Thus,
Code: Select all
\033RHello \033Bworld\033X!!\033X
Hello world!!
rather than:
Hello world!!
and therefore
Code: Select all
\033RHello \033Bworld\033X!!
Code: Select all
\033RHello \033Bworld\033R!!\033X
Code: Select all
\colour red
Hello
\colour blue
world
\colour gray
!!
Code: Select all
\begin{red}
Hello
\begin{blue}
world
\end{blue}
!!
\end{red}
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
Insanity included at no extra charge.
There is no Box. I am the sand.
Hi, guys. Thanks for your help. I've been scripting in Reunion for two years, and I'm aware of how the codes work, but it seems as though something has changed.
@ThisIsHarsh: Yes, the colour codes work in menus. I knew that prior, and have been doing it for a while.
@jlehtone: I usually close the colour code off. You're right. It's good practice.
The essence of my original post, however, is that it writes a blank message to the message log when using a colour code.
Message log.
Blank post.
Colour codes.
Does anyone know how to post colour to the message log? Not to menus, ship names, or in a letter to your mom. Message log. Writing coloured text to the message log.
Message log.
@ThisIsHarsh: Yes, the colour codes work in menus. I knew that prior, and have been doing it for a while.
@jlehtone: I usually close the colour code off. You're right. It's good practice.
The essence of my original post, however, is that it writes a blank message to the message log when using a colour code.
Message log.
Blank post.
Colour codes.
Does anyone know how to post colour to the message log? Not to menus, ship names, or in a letter to your mom. Message log. Writing coloured text to the message log.
Message log.
For messages (including the message log), you have to format your text like this:
This works for all other colors too (red, blue, green, cyan, magenta, white).
For all other texts, the old \033x format still works.
I wonder why they have changed this in Terran Conflict...
Code: Select all
[yellow]Message Text[/yellow]
For all other texts, the old \033x format still works.
I wonder why they have changed this in Terran Conflict...
Thank you!
Note to forume help searchers:
The old \033 codes do NOT work when writing text to the message log (though do work, oddly, with the menu system).
The correct method is to use, as -Duty- has indicated:
[yellow]Message Text[/yellow]
This works for all other colors too (red, blue, green, cyan, magenta, white).
Thanks, -Dusty-
Updating OP for info.
Note to forume help searchers:
The old \033 codes do NOT work when writing text to the message log (though do work, oddly, with the menu system).
The correct method is to use, as -Duty- has indicated:
[yellow]Message Text[/yellow]
This works for all other colors too (red, blue, green, cyan, magenta, white).
Thanks, -Dusty-
Updating OP for info.
I guess it is a more flexible method of inserting formatted strings into text. The menu entries probably use the old parser as they are frequently shown and the strings are short and more static. Efficiency.-Dusty- wrote:I wonder why they have changed this in Terran Conflict...
How about the ship and station names? That is a target that somebody probably wants to reformat sooner or later.
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
Insanity included at no extra charge.
There is no Box. I am the sand.
because the BBS was removed.-Dusty- wrote:For messages (including the message log), you have to format your text like this:This works for all other colors too (red, blue, green, cyan, magenta, white).Code: Select all
[yellow]Message Text[/yellow]
For all other texts, the old \033x format still works.
I wonder why they have changed this in Terran Conflict...
the incomming message formating was part of the BBS module
-
- Posts: 136
- Joined: Mon, 20. Mar 06, 20:19
-
- Posts: 136
- Joined: Mon, 20. Mar 06, 20:19
send incoming message and write to player logbook problems
So I'm playing with scripting, but for some annoyingly stupid unknown reason, send incoming message and write to player logbook wont work for me. They just come up as blank For the log book the sender is "Unknown", and for the message it's really weird and skewed (the "ok" button is way off to the side for some reason, but no message text).
However if I do write to log file, it works perfectly - as in, I could do all three commands directly after each other with the exact same input message, but only the log file works.
Are there some sort of weird limitations or format constraints for the other two?
However if I do write to log file, it works perfectly - as in, I could do all three commands directly after each other with the exact same input message, but only the log file works.
Are there some sort of weird limitations or format constraints for the other two?
to the problem this Topic started with: i have written a library, which changes the old tags (used in Ship Names or Menues) into the new Tags (uses in Incoming and Logbook Messages)
here is a Screen of the Test Run Result (write the Name of the Player Ship in the Logbook):
[ external image ]
and here the library itself
How to Use:
Input:
Argument 1: Object, which name has to be re-formatted or String to re-format
Returnvalue: Re-Formatted String, definetly free of the old Color-Tags
Version Return: Put in 'VersionCheck' vor Argument 1
DO NOT MODIFY THIS LIB-SCRIPT unless you know what you do, otherwise your game will freeze when this Script is called...
i will add some modded EGOSoft-Scripts (which are creating Logbook-Entries or send Messages to the Player) that they use this soon (but there are some Hardcoded things i cann't change..), for the modification of other Scripts which are sending Messages or Logbook entries please ask the responsible Scripter to modify it...
PS This Library has not been tested under every possible and impossible condition (for example there were some problems with long Strings in the test runs which are avoided by some changes in the Code) so if there are any problems please tell me
here is a Screen of the Test Run Result (write the Name of the Player Ship in the Logbook):
[ external image ]
and here the library itself
How to Use:
Input:
Argument 1: Object, which name has to be re-formatted or String to re-format
Returnvalue: Re-Formatted String, definetly free of the old Color-Tags
Version Return: Put in 'VersionCheck' vor Argument 1
DO NOT MODIFY THIS LIB-SCRIPT unless you know what you do, otherwise your game will freeze when this Script is called...
i will add some modded EGOSoft-Scripts (which are creating Logbook-Entries or send Messages to the Player) that they use this soon (but there are some Hardcoded things i cann't change..), for the modification of other Scripts which are sending Messages or Logbook entries please ask the responsible Scripter to modify it...
PS This Library has not been tested under every possible and impossible condition (for example there were some problems with long Strings in the test runs which are avoided by some changes in the Code) so if there are any problems please tell me
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
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
Converting Scripts - Problem with message choices
I've been trying to pull some scripts from Reunion over to TC, and while they work in game to some extent, regardless of the script I'm testing the initialization message that gives you setup options always shows like this:
http://img204.imageshack.us/my.php?imag ... agegk6.jpg
Anyone know why this is? I thought at first it was color codes, but removing those did nothing. The text file is setup correctly something like this:
<page id="1234" title="Temp" descr="0" voice="0">
<t id="1">Testing</t>
<t id="2">Select the Difficulty Level\n
[select value="1"]Easy[/Select]\n
[select value="2"]Medium[/Select]\n
[select value="3"]Hard[/Select]\n
</t>
<t id="3">Configuration</t>
and the script calls it with this command:
$Variable = sprintf: pageid=$page.id textid=1, null, null, null
it initializes the correct pageid to $page.id previously in the script, and I don't think thats related because I can pull data from that variable correctly, it just wont display it right.
This is just an example, I have tested 3 different scripts that work in game but their configuration message is messed up in the same manner. If I change the script to just dispay id=1 for instance, it will show Testing. If I change it back to show all page.id it shows this |< symbol.
{Merged to active relevant thread, which already contains the answer. jlehtone}
http://img204.imageshack.us/my.php?imag ... agegk6.jpg
Anyone know why this is? I thought at first it was color codes, but removing those did nothing. The text file is setup correctly something like this:
<page id="1234" title="Temp" descr="0" voice="0">
<t id="1">Testing</t>
<t id="2">Select the Difficulty Level\n
[select value="1"]Easy[/Select]\n
[select value="2"]Medium[/Select]\n
[select value="3"]Hard[/Select]\n
</t>
<t id="3">Configuration</t>
and the script calls it with this command:
$Variable = sprintf: pageid=$page.id textid=1, null, null, null
it initializes the correct pageid to $page.id previously in the script, and I don't think thats related because I can pull data from that variable correctly, it just wont display it right.
This is just an example, I have tested 3 different scripts that work in game but their configuration message is messed up in the same manner. If I change the script to just dispay id=1 for instance, it will show Testing. If I change it back to show all page.id it shows this |< symbol.
{Merged to active relevant thread, which already contains the answer. jlehtone}
I have no color codes in the text file though, its just as shown and it still displays that odd symbol.
Its like this in the script (1234 is just for example)
$page.id=1234
load text: id= $page.id
$var = sprintf: pageid = $page.id textid = 2, null, null, null
send incomming question $var to player: callback al.temp.config
I know its reading from the text file because if I change textid = 2 to textid = 1 it displays Testing. If I use 2 I get this problem.
I tried changing the read input to
$var = read text: page = $page.id id=2
like I saw on page 1 but that didn't do anything different.
Its like this in the script (1234 is just for example)
$page.id=1234
load text: id= $page.id
$var = sprintf: pageid = $page.id textid = 2, null, null, null
send incomming question $var to player: callback al.temp.config
I know its reading from the text file because if I change textid = 2 to textid = 1 it displays Testing. If I use 2 I get this problem.
I tried changing the read input to
$var = read text: page = $page.id id=2
like I saw on page 1 but that didn't do anything different.
it is no direct Solution for your problem, but why are you not using the new custom menus??
(dont wonder about the Line Numbers, i have copied a bit from one of my Scripts ^^)
102 $menu.arr = create custom menu array
104 add custom menu item to array $menu.arr: text='Easy' returnvalue=1
106 add custom menu item to array $menu.arr: text='Medium' returnvalue=2
108 add custom menu item to array $menu.arr: text='Hard' returnvalue=3
114 $difficulty = open custom menu: title='Select Difficulty' description='Select the Difficulty for the ***-Script' option array=$menu.arr
115 skip if not $area == -1
116 ║return null
(dont wonder about the Line Numbers, i have copied a bit from one of my Scripts ^^)
102 $menu.arr = create custom menu array
104 add custom menu item to array $menu.arr: text='Easy' returnvalue=1
106 add custom menu item to array $menu.arr: text='Medium' returnvalue=2
108 add custom menu item to array $menu.arr: text='Hard' returnvalue=3
114 $difficulty = open custom menu: title='Select Difficulty' description='Select the Difficulty for the ***-Script' option array=$menu.arr
115 skip if not $area == -1
116 ║return null
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
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