The International Simutrans Forum

 

Author Topic: Carriage return discussion (split from pak128.Britain graphics to-do list)  (Read 4353 times)

0 Members and 1 Guest are viewing this topic.

Offline Reddog785

  • *
  • Posts: 68
Reddog,

see here for information on contributing graphics to Pak128.Britain. As to your first question - in what context do you ask? A line break normally simply means a break between lines of ASCII text as in:

^^ That was a line break.

But please note that nobody will be able to use your narrow gauge vehicles until somebody draws narrow gauge tracks, narrow gauge depots, narrow gauge stations, narrow gauge bridges, narrow gauge tunnels and narrow gauge crossings.

I mean in coding. Notepad apparently displays them as little boxes.
« Last Edit: May 09, 2010, 01:02:13 PM by The Hood »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18359
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: pak128.Britain - new graphics to-do list
« Reply #1 on: May 08, 2010, 06:15:24 PM »
Best use Wordpad.

Offline Reddog785

  • *
  • Posts: 68
Re: pak128.Britain - new graphics to-do list
« Reply #2 on: May 08, 2010, 06:17:08 PM »
But how do I type a linebreak?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18359
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: pak128.Britain - new graphics to-do list
« Reply #3 on: May 08, 2010, 07:52:22 PM »
 In Wordpad, you can just use an ordinary carriage return.

Offline Reddog785

  • *
  • Posts: 68
Re: pak128.Britain - new graphics to-do list
« Reply #4 on: May 08, 2010, 09:35:27 PM »
What's a carriage return?

Offline rsdworker

  • *
  • Posts: 281
Re: pak128.Britain - new graphics to-do list
« Reply #5 on: May 08, 2010, 09:38:31 PM »
its called return - its usually shown on keyboard - either enter or return button makes a icon move to next place

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: pak128.Britain - new graphics to-do list
« Reply #6 on: May 09, 2010, 09:52:26 AM »
Another explanation: it's an invisible letter that means (forced) end of one line...

Line one,
Line two.

...there's a line break between these two, just behind the comma.

thread split from http://forum.simutrans.com/index.php?topic=3009.0
« Last Edit: May 09, 2010, 12:02:21 PM by VS »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18359
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: pak128.Britain - new graphics to-do list
« Reply #7 on: May 09, 2010, 12:15:36 PM »
Maybe this should be de-stickied...?

Offline Reddog785

  • *
  • Posts: 68
Ugh...you don't understand! The article on the Simutrans Wiki about making Simutrans goodies said "Please don't use Notepad, it dosen't have linebreaks" and there is a picture of code like this:
Code: [Select]
cityrules.tab[]#[]#
As you can see, Notepad replaces the linebreaks with little boxes. What are THESE linebreaks meant to be? How do I type them?

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
If it says "doesn't have" then it's wrongly worded. Notepad has them of course, but only one kind out of three - that is the problem. You are not supposed to see them anyway. That picture just illustrates that notepad doesn't do it properly for these other two cases: Instead of ending the lines, it draws some weird boxes and goes on with the line.

But this discussion is moot. That requirement for dat files is obsolete. Newer makeobj versions handle line breaks just fine natively, so use notepad and everything will work. The only problems might be when you open older files.

If you want to be 100% on the safe side, use notepad++ or pspad or or or... there are lots of good text editors that understand line breaks of all 3 kinds. The two I named are just the most popular on Windows these days.
« Last Edit: May 09, 2010, 07:26:04 PM by VS »

Offline neroden

  • Devotees (Inactive)
  • *
  • Posts: 831
  • Nathanael Nerode
For a starter on this topic, reddog, the important thing to remember is that computers don't really know what letters are, all they know is binary.  Different computer systems have different ways of encoding text into binary.  Almost all use variants of the "ASCII" code nowadays.  This standardized the encoding of the 10 Arabic numerals, the 26 Latin alphabet characters (uppercase and lowercase), "space", and some punctuation.  Unfortunately it didn't standardize everything:  there are two different common ways of encoding a "line break", as well as two uncommon ways.

The difference between the different encodings can be seen most clearly if you open up a text file with a hex editor.

Simutrans doesn't care what encoding you use for linebreaks any more. 

Many programming tools can handle both, but notice that they're different, which is why I'm having problems with "spurious differences" -- they notice that the linebreaks are encoded differently and decide that OMG EVERY LINE IN THE FILE HAS CHANGED!  The version control systems (subversion, git) have tools for automatically ironing out the differences by making sure the linebreaks are all standardized automatically when they're checked in -- but the tools have to be *turned on*, which so far they haven't been.... but that's another topic, literally....
« Last Edit: May 09, 2010, 08:53:38 PM by neroden »

Offline Reddog785

  • *
  • Posts: 68
If it says "doesn't have" then it's wrongly worded. Notepad has them of course, but only one kind out of three - that is the problem. You are not supposed to see them anyway. That picture just illustrates that notepad doesn't do it properly for these other two cases: Instead of ending the lines, it draws some weird boxes and goes on with the line.

But this discussion is moot. That requirement for dat files is obsolete. Newer makeobj versions handle line breaks just fine natively, so use notepad and everything will work. The only problems might be when you open older files.

If you want to be 100% on the safe side, use notepad++ or pspad or or or... there are lots of good text editors that understand line breaks of all 3 kinds. The two I named are just the most popular on Windows these days.

Errmm... So, where the weird boxes are, what do I type? A space? A new line?

Offline neroden

  • Devotees (Inactive)
  • *
  • Posts: 831
  • Nathanael Nerode
Errmm... So, where the weird boxes are, what do I type? A space? A new line?

The "weird boxes" are how old versions of Notepad interpret hexadecimal 0A by itself.  Most programs interpret hexadecimal 0A as "line break".  If you are seeing weird boxes, *use a different text editor*.  If you aren't seeing weird boxes on your machine, don't worry about it.

If you replace each "weird box" with a line break in Notepad, you'll create a file with lots of hexadecimal "0D 0A" sequences in it, because that's what Notepad writes when you put in a line break.

Simutrans can handle either "0D 0A" or "0A" by itself and knows that either means "line break".

Offline wlindley us

  • Devotee
  • *
  • Posts: 958
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Historically, UNIX used 0A (ASCII line feed) as end-of-line; CP/M, its clone MS-DOS, and then Windows use 0D 0A (carriage return, line feed) as end-of-line; and old MacOS used just 0D as carriage return alone.  Let's hear it for standards!

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Reddog - just write :)

edit: removed previous text after ~2 min.

Offline neroden

  • Devotees (Inactive)
  • *
  • Posts: 831
  • Nathanael Nerode
Historically, UNIX used 0A (ASCII line feed) as end-of-line; CP/M, its clone MS-DOS, and then Windows use 0D 0A (carriage return, line feed) as end-of-line; and old MacOS used just 0D as carriage return alone.  Let's hear it for standards!


And certain mainframes, along with most actual teletype machines, used 0A 0D (notice the different order).  :)