How to open train.dat file?

Post your questions about object, route and train development here. Be sure to have consulted the documentation first.

How to open train.dat file?

Postby bomba on Fri, 19th Jun 2009, 22:18

My system shows the train.dat file as a video CD and tries to run a media player. What is the proper method for editing this file?
bomba
 
Posts: 12
Joined: Wed, 22nd Oct 2008, 03:33

Re: How to open train.dat file?

Postby velaro on Fri, 19th Jun 2009, 23:56

If you look at the developing section of the openBVE homepage, you'll find a train editor and a text editor, both of which can be used to edit a train.dat file, but you'll probably want the former until you really know what you are doing. Note that the developing section also explains what a train.dat file is and what the numbers in it mean.
Juergen H
User avatar
velaro
 
Posts: 201
Joined: Mon, 14th Apr 2008, 23:11
Location: The Holy City of the Hot Dog

Re: How to open train.dat file?

Postby bomba on Sat, 27th Jun 2009, 21:00

Thanks Velaro!
bomba
 
Posts: 12
Joined: Wed, 22nd Oct 2008, 03:33

Re: How to open train.dat file?

Postby Daniel Beardsmore on Sat, 18th Jul 2009, 01:31

As a larger issue in general -- there are three ways to deal with this. One is to simply re-associate .dat with your text editor, for example right-click > Open With > Choose Program, select your text editor, then tick "Always use ...".

You can also add a shortcut to your text editor into C:\Documents and Settings\you\SendTo (or C:\Users\you\SendTo in Vista) which means that you can select any file and Send To > Notepad (or another editor) for rapid access regardless of whether or not the file extension is registered and to what. I use JujuEdit which is quirky and buggy but is a combined ASCII/UTF/hex editor that will switch to the best mode for any file I select.

Also, for a bit more speed, you can set something like the following in the Registry:

Code: Select all
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]
@="open"

[HKEY_CLASSES_ROOT\*\shell\zJujuEdit]
@="JujuEdit"

[HKEY_CLASSES_ROOT\*\shell\zJujuEdit\Command]
@="\"C:\\Program Files\\JujuSoft\\JujuEdit\\JujuEdit.exe\" \"%1\""


The use of 'z' pushes it to the bottom of the actions list -- actions are sorted first by primary command and then by key name, so a key of "zJujuEdit" (or "zNotepad") drops the action to the bottom despite the human-readable name given as the default value.

This is a submenu-free way to toss any file into your favourite editor. As I said, I like JujuEdit here for its dual capability as a text and hex editor, although it is buggy; no idea if there's another good text/hex editor out there (with regex, highlighting, UTF-8 and UTF-16 big/little endian, etc).
User avatar
Daniel Beardsmore
 
Posts: 34
Joined: Wed, 27th Aug 2008, 21:24
Location: Hertfordshire, England

Re: How to open train.dat file?

Postby Jan on Sat, 18th Jul 2009, 11:00

Thanks for your registry code, it works like a charm, and saves me having to wait for the "Send to..." menu to list its contents.

For those who don't know what to do with Daniel's code:
- Create a new text file, and rename its extension to .reg
- Right click on it, select "edit" and copy Daniel's code into the editor window and hit save
- Double click on it and select "Yes" in the dialog that pops up
- Finished...

@Daniel:
Have you tried PSPad yet? It has a lot of features - though admittedly I only use few of them - , supports different encodings, has some sort of built-in hex editor, syntax highlighting for different file formats (if that's what you mean), and its search apparently supports regex.
Jan
 
Posts: 132
Joined: Wed, 16th Apr 2008, 12:37
Location: Germany

Re: How to open train.dat file?

Postby Daniel Beardsmore on Sat, 18th Jul 2009, 15:57

Just looked at PSPad -- it's a jack of all trades application. The syntax highlight system is horrible -- you're forced to have an exact number of system and an exact number of user syntaxes, and user syntaxes are only capable of highlighting words. JujuEdit's system is too buggy to use, and too strange to understand, but with help from the developer and perseverance I've succeeded in creating some nice custom rulesets including nesting one language inside another using static conditionals.

PSPad has integrated FTP, but it can't do binary files? So basically I still need another FTP program open to upload images; the screenshots also show that the integrated FTP panel can't do file information or type icons.

If I really wanted to learn something decent, I'd be better off learning gVim, as it's a proper professional tool ;-) It also should have a proper context sensitive syntax highlighting grammar -- JujuEdit relies on customed regular expressions that are context insensitive and make sequences like heredocs very hard to detect. Actually, recognising a set of heredocs would be very hard to do, as this is valid in Perl:

Code: Select all
print <<ONE, ' ', <<TWO;
all text here
is part of heredoc ONE
ONE
all text here
is part of heredoc TWO
TWO


gVim may also have a dedicated nester, such that you could something like:

  • HTML.highlight
  • CSS.highlight
  • JavaScript.highlight

HTML.highlight could then have:

Code: Select all
[inject]
<script>*</script> := JavaScript.highlight
<style>*</style> := CSS.highlight


However, it's not that straightforward, because there's more than one scripting language. So you'd need to find <script> tags, pull out their language= and type= tags and select the appropriate highlight file.

What's more important still is that this is all transparent. BBEdit on the Mac, for example, has a very advanced highlighting engine, but the rules are neither viewable nor editable, so I can't manually add new PHP constants that have been introduced since my copy was built. PSPad appears to have first and second class rules -- first class for itself, second class for the user. The user is limited to a small number of active rules and very simple syntax, for example no control over which words are to be spell checked, nested constructs, language embedding or anything else.

This first class–second class design is very typical in IT and especially language design. C is one of the few languages where you're given first class access: the entire C library is written in C. JujuEdit only has one syntax highlight system that both presupplied and user rules follow, so I'm at liberty to reprogram and learn from the built-in rules as I see fit. All of gVim's rules ship as editable text files.

The reason I chose JujuEdit incidentally is that my previous PC was a PII 333, and most editors won't run on that. The quality of coding these days is so awful that they grind to a halt. JujuEdit was remarkable in that, on a PII 333, I could open a file up to 20-30 k before it would grid down. BBEdit on a 200 MHz Mac will reack 100 k (with highlighting off) before it grinds down.

And frankly, I'm very happy with it. Though, I note that PSPad has at least two of its features -- highlight-and-tab to indent, and home obeys indenting.

Thanks though.
User avatar
Daniel Beardsmore
 
Posts: 34
Joined: Wed, 27th Aug 2008, 21:24
Location: Hertfordshire, England

Re: How to open train.dat file?

Postby alvinwong on Sun, 19th Jul 2009, 05:26

I suggest to use openBve Train Editor found on the Developing for openBve pages.
Problems, solutions, problems, solutions...
Tired on these, and trying to make openBVE train Exterior, then...
Problems... ###again### Crazy...
Please visit http://www.hochun.nets.hk/discuz/index.php
User avatar
alvinwong
 
Posts: 240
Joined: Sat, 24th Jan 2009, 05:16
Location: Hong Kong


Return to Developing for openBVE

Who is online

Users browsing this forum: No registered users and 0 guests