• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Why |n is displayable?

Status
Not open for further replies.
Level 6
Joined
Sep 10, 2022
Messages
91
Hello, I display the message for all players, that the way of enemies is approaching, and I want it to be always through an empty line. I use "|n" for this.
In-game journal it displays correctly, but when I see the message in the left corner, it is with this "|n". How should I fix this?

1676308683971.png
1676309237339.png
 
Level 5
Joined
Dec 30, 2022
Messages
36
Either control enter or shift + enter will start a new line which transfers to in-game. The bar "|" symbol is used for coloring text in world editor as a prefix and suffix so you can't use it as indication for a new line... which is why I believe your text is showing up orange (?) unless there is something I am missing.
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,928
Either control enter or shift + enter will start a new line which transfers to in-game. The bar "|" symbol is used for coloring text in world editor as a prefix and suffix so you can't use it as indication for a new line... which is why I believe your text is showing up orange (?) unless there is something I am missing.
The colour comes after the "|n" and it's "|cffd45e19A".
 
Level 6
Joined
Sep 10, 2022
Messages
91
Well, Ctrl + Enter method does not satisfy my "Journal Appearance" Condition. I am adding "|n" exactly to see new sentence through line (more readable). But empty line with Ctrl + Enter does not work.
The method with a text editor did not help too.
In both cases, there is no indentation per line in-game journal...


1676311368406.png


In fact, this is not too important, I just wanted to clean up the journal, because there will be a lot of messages, and the indents just make everything more comfortable.
 
Last edited:
Level 12
Joined
Jan 10, 2023
Messages
191
I have at times written things in a text-editor (such as notepad) and copy-pasted it into those windows and new-lines got included. Maybe that works?

That does work, the ENTER button works fine without a shift+ or control+.

The |n is definitely bug like deepstrasz says, used to work fine (and was preferred by many).
At the least I would have rather it just not show '|n' at all, otherwise I'm getting goosebumps thinking about every older map's text getting messed up lol

For adding a blank line like Chaosium said - make sure you set the blank line text to display for the same amount of time as the real text or longer or things will get a little ugly if there are several messages on the screen.
  • the blank line if auto-timed, or mistimed will disappear before the others
  • If you set the time too long, that's the safer bet, or if you manually time everything to be exact.
  • For tooltips this should be more simple.

But I would just use normal ENTER text for line breaks, it works just fine, I haven't found it's shortcoming yet except that I wish no text in WC3 used the enter button because I want to use the ENTER button in the editor to close the text window, but hitting enter on text just adds the ENTER text!

Example of me using the normal text message:
  • Game - Display to (Player group((Player(SG_PlayerIndex)))) for 0.55 seconds the text: |cffafafffAuto-Cy...
The exact text I put in the text field:
"
|cffafafffAuto-Cycling is|r |cffffff00< OFF >|r
|cffafafff - Toggle|r |cffffff00< ON >|r |cffafafffwith|r |cffafafaf[CAPSLOCK]|r
|cffafafff - Cycle manually with|r |cffafafaf[TAAB]|r
"

Had to put a second 'A' in '[TAAB]' so that the Hive's text editior didn't add a "[/TAB]" on me..
 
Last edited:
Level 14
Joined
Feb 7, 2020
Messages
387
Leveraging custom script to set a temporary variable removes the printed |n bug.

But you use standard line breaks (\n) instead of the WC3 tag.
  • Test
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_text_string = "\nTest Break\n\n|cff00ff00Color Test|r"
      • Game - Display to (All players) the text: text_string
 

Attachments

  • test_line_break.w3m
    12.9 KB · Views: 2
Level 12
Joined
Jan 10, 2023
Messages
191
Leveraging custom script to set a temporary variable removes the printed |n bug.

But you use standard line breaks (\n) instead of the WC3 tag.
  • Test
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_text_string = "\nTest Break"
      • Game - Display to (All players) the text: text_string
That worked with backslash?!?! not a '|' (what do we call the vertical stick?)

Just tested it by setting a var (using both '/' and '|') but without using custom script using GUI (I'm guessing you did that already) and it needs it to be custom script/ code... that seems even more buggy to me lmao, come on blizzard!

EDIT: *forward slash (I was calling them all 'back-slash')
 
Level 14
Joined
Feb 7, 2020
Messages
387
That worked with backslash?!?! not a '|' (what do we call the vertical stick?)

Just tested it by setting a var (using both '/' and '|') but without using custom script using GUI (I'm guessing you did that already) and it needs it to be custom script/ code... that seems even more buggy to me lmao, come on blizzard!

EDIT: *forward slash (I was calling them all 'back-slash')
This is a good explanation. What does backslash "\" escape character really escape?

Sequences like \n are common practice between most programming languages. The devs decided to use their own tagging system, which is why it follows a similar format but with a different escape character (the pipe "|").

I don't know the history of |n in JASS/GUI, but it's possible the newline sequence \n only works in custom scripting from the implementation of Lua in Reforged, since Lua uses a few standard escape practices - and I think both a JASS and Lua environment run in unison, or something funky like that.
 
Level 6
Joined
Sep 10, 2022
Messages
91
ENTER Method does not work too. The result is still the same as in Ctrl+Enter, and with notepads...
I tried to remove the color and then add "|n" again. Nothing interesting...

1676313693211.png


Leveraging custom script to set a temporary variable removes the printed |n bug.

But you use standard line breaks (\n) instead of the WC3 tag.
  • Test
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_text_string = "\nTest Break\n\n|cff00ff00Color Test|r"
      • Game - Display to (All players) the text: text_string
Yeah, that's it! Thank you guys for your help. I will use this method for now.
 
Level 12
Joined
Jan 10, 2023
Messages
191
Glad it worked, I'm wondering what the difference is between what we're each doing.

I mean, you've got your solution so cheers, but I wonder if you were using '|r' before if it would have worked. I always do just because it feels right lol, but this works fine for me, I do a line above and below but when the two are stacked, it only shows one line: (images)

World Editor:
trigscrn.jpg

In Game:
gamescrn.jpg
menuscrn.jpg

the only difference I see is the use of '|r' ... at this point I'm just curious about the bugginess...
 
Level 6
Joined
Sep 10, 2022
Messages
91
Well, I have another minor question, but I am not sure that I need to create a new thread...
I am printing a wave number, so I am writing "Wave # " + "String(Wave Number)". My "Wave #" has a color, and how to make a second string with color too..?

Screenshot_2.png
 
Status
Not open for further replies.
Top