Announcement

Collapse
No announcement yet.

How do I send a newline character to GFxMovie?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I send a newline character to GFxMovie?

    I can't seem to ask this question. Is the forum broken? Does it not like the characters I'm entering? Does it think I'm trying to do some kind of code insertion? Will it let me ask my question if I put it here as a picture?

    Click image for larger version

Name:	QuestionText.png
Views:	1
Size:	36.6 KB
ID:	1212943
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

  • #2
    Huh. It worked that time. TIL either you cannot put forward slashes in your title, or you cannot put too many regexes into your question. Let me see if I can copy/paste the text back in here. If this works, then I guess you just can't put forward slashes in the title.


    I have some text that I set in the Unreal Editor. I want that text to contain newline characters, or \n, that will show up in the GFxMovie as a new line. When I set some test text inside Flash Pro, the newlines print correctly. But when I put "\n" in my text in Unreal Editor, the GFxMovie actually displays the text "\n" as though I had written it with an escape like \\n.

    I figured this was because either Unreal or Flash was sanitizing the string input. I figured the easiest way to try getting around this specific problem would be by writing an ActionScript function to replace all \\n instances with \n. But I think something is broken with how the Scaleform plugin handles regular expressions.

    I try just the simple example from the ActionScript website...
    Code:
    		var str:String = "She sells seashells by the seashore."; 
    		var pattern:RegExp = /sh/gi; 
    		trace(str.replace(pattern, "sch")); 
    			//sche sells seaschells by the seaschore.
    ...and I get this error:
    Code:
    		Error: Error: Error #1001
    Has anyone ever tried using regular expressions in ActionScript while also the Scaleform plugin? How did you get it to work?
    Last edited by Nathaniel3W; 03-13-2017, 02:50 AM.
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

    Comment


    • #3
      Code:
      function formatNewLines(inString:String):String
      {
      	var index:int = inString.indexOf("\\n");
      	while(index != -1)
      	{
      		inString = inString.slice(0, index) + "\n" + inString.slice(index + 2, inString.length);
      		index = inString.indexOf("\\n");
      	}
      	return inString;
      }
      Well, that seems kind of ugly and unnecessary, but I just send my text through that function, and it puts proper newline characters where they're supposed to be.
      Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

      Comment


      • #4
        I made the same as above, but I used html characters. so I pass newlines as <br>
        not ideal to do such string operations but my game is light on the GUI so for me it's fine
        Help me back! follow me on Twitter

        Developer of Elium - Prison Escape

        Comment

        Working...
        X