Page 1 of 1

New Line in mission.runScreen?

Posted: Wed Mar 29, 2017 5:47 am
by byronarn
I know I have been asking a lot of scripting questions on here lately, but I don't know where else to post them. Is this the right place, or should these questions be posted elsewhere?

Anyways, my latest question: How do you get new lines on the mission.runScreen screen? I have tried the common "\n" (as suggested here) but it does not insert any new lines, but rather shows the "\n" as literal characters.

Here is the code I'm using:

Code: Select all

mission.runScreen({
			title: "The Crown Prince",
			message: "As you leave your ship to take a shor stroll through the station, you hear somone callout, \"Hey, Commander!\"\n\nYou turn towards the voice and see a large blue feline. \"Can I help you?\" you ask politely.\n\n\"I need to get to Xeesle within the next week, but faster is even better! I will give you 100Cr upfront, and 1000Cr when we get there. What do you say?\"",
			choicesKey: "yesno_choices"
		},
		function (choice)
		{
			if (choice === "1_YES")  player.consoleMessage("Yay!");
			else if (choice === "2_NO")  player.consoleMessage("Boo.");
		});
What am I doing wrong?

Re: New Line in mission.runScreen?

Posted: Wed Mar 29, 2017 5:53 am
by phkb
Hmm, that looks OK. The only thing I can think to suggest is to check the text encoding of the script file. Make sure it's UTF-8.

Re: New Line in mission.runScreen?

Posted: Wed Mar 29, 2017 5:59 am
by byronarn
phkb wrote: Wed Mar 29, 2017 5:53 am
Hmm, that looks OK. The only thing I can think to suggest is to check the text encoding of the script file. Make sure it's UTF-8.
That solved the problem! Notepad++ was encoding it in ANSI. I changed it to UTF-8 and now it's working.

One of these days, I'll have enough experience to be able to intuitively know that I need to check the encoding. :lol:

Re: New Line in mission.runScreen?

Posted: Wed Mar 29, 2017 9:16 am
by Norby
Are the words "shor" and "somone" some kind of slang or simple typo?
If you have time you can consider using missiontext.plist as a storage of your messages.
It is possible to make some variations just use descriptions.plist and [keyname] in the text.

Re: New Line in mission.runScreen?

Posted: Wed Mar 29, 2017 10:59 am
by byronarn
Norby wrote: Wed Mar 29, 2017 9:16 am
Are the words "shor" and "somone" some kind of slang or simple typo?
Simple typos for "short" and "someone".
Norby wrote: Wed Mar 29, 2017 9:16 am
If you have time you can consider using missiontext.plist as a storage of your messages.
It is possible to make some variations just use descriptions.plist and [keyname] in the text.
I can definitely see the advantages to using descriptions.plist for variation, but what is the advantages of storing all my messages in missiontext.plist?

Re: New Line in mission.runScreen?

Posted: Wed Mar 29, 2017 2:21 pm
by Norby
byronarn wrote: Wed Mar 29, 2017 10:59 am
what is the advantages of storing all my messages in missiontext.plist?
For example:
- easier to see through the whole story over a size,
- you can use numbered messages even in cycles as expandMissionText("youroxp"+this.$number);
- stage driven mission flow is also possible like in The Collector,
- needed for translating to other languages.