Columns in missionText

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Columns in missionText

Post by phkb »

Is it possible to format the missionText of a mission screen into columns, using (for instance) tab characters? I know I can insert spaces, but missionText is proportionally spaced, isn't it? So using spaces would result in ragged columns.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Columns in missionText

Post by cim »

Tabs don't work (yet - it's been requested) but the String.fromCharCode(31) character is an extremely narrow space which can be used (together with normal spaces) for alignment.

This is how the columns on the contract offer screens are lined up. The _paddingText function in oolite-contracts-helpers.js does most of the work, and you could use that from your own scripts.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Columns in missionText

Post by phkb »

Thanks, cim. Wonderful help, as usual!
Post Reply