====== Makeobj ======
Makeobj is a software used to compile .dat files and .png pictures. It's very easy to use it.
===== 1.Presentation =====
If you launch makeobj directly, nothing happens. Makeobj is a console program, if you want to see somthing you have to launch it from the command line of your OS ... we aren't going to do so. To use it correctly, it has to be launched by the command line with a command written with so makeobj would operate with the right command. There are two ways to do that : the most comfortable is using a graphical software to use makeobj like pakhelper, the fastest is using command files. The both are explained here.
Makeobj creates one .pak file per object but it's possible to merge multiple .pak files in only one.
===== 2.Pakhelper =====
[[http://minami-fukuoka.simutrans.net/english/pakhelper/PakHelper_3.2.zip|Download Pakhelper]]
Once downloaded, unpack it, so you have a "pakhelper" folder. Pakhelper is only a graphical interface, it needs makeobj to be used, it's in this folder. Replace it by the latest version of makeobj you have. Then lauch pakhelper :
{{ fr:tuto:makeobj:makeobj01.png }}Ajust the .pak size according to what pakset you create objects for (pak64, pak128, or another pakset so you have to define the size), then select the .dat file with the icon "open" and define the name of the final .pak file which contains all .pak created from a .dat file.
The problem with pakhelper is that it can compile only one .dat file at a time.
You'll find in the tab "Extrect" a tool to extract single .pak files from a merged .pak file, the tab "Merge" is to merge multiple .pak files in one.
===== 3.The command files =====
A faster way to compile .dat files is using command files which launch makeobj directly.
Makeobj is launched by the command line with a key word to tell makeobj what command it must use. The command files we are going to create do the same, you'll just have to launch a command file to use makeobj with the right command.
This is a list of interesting commands of makeobj
Makeobj PAK128 : creates .pak files for pak128 (you can do the same with pak64 or another one) from .dat files.
Makeobj MERGE : merge .pak files in only one.
Makeobj EXTRACT : extract single .pak files from a merged multiple one.
==== Windows ====
Put makeobj where you want in your computer. Then use notepad, write the following files and save with the extension ".bat" (format of command files). Copy the path to makeobj, for example :
C:%%\%%Users%%\%%Gauthier%%\%%Documents%%\%%Simutrans%%\%%makeobj%%\%%makeobj
This path must point the makeobj.exe, not the folder where it is.
Instead of writing the path, you can just write "makeobj" but you'll have to put a makeobj.exe in the folder where command files are.
These are the files to create (replace "makeobj" by its path).
create.batmakeobj pak128 2>err.txt
merge.batmakeobj MERGE name.pak %%*%%.pak(remplacez “name” par le nom que vous désirez pour le .pak final)
extract.batmakeobj EXTRACT
If you defined the path, you'll just have to copy your command files, plus it will be easy to update makeobj since you will just have to replace one file. Using each of these files is only for files which are in the same folder. So you can easily organize your work by creating a folder for each project for example. For create, the possibles errors are writtent the file err.txt created when you compile .dat files.
==== Linux ====
With linux, shell files are used, they look like windows'command files. Shell files use the extension ".sh".
Put makeobj in the folder you want and open a console in this folder. Write the command "pwd" which gives you the complete access path of the folder where makeobj is. For example on my computer :
/home/fefe/simutrans_travail
So majeobj is there :
/home/fefe/simutrans_travail/makeobj
Then open a text editor and write this line :
#!/bin/sh
This line defines where is the shell compiler. All your shell files must start by this line.
Here are the files to create (replace "makeobj" with its access path and don't forget the little line above).
create.shmakeobj pak128 2>err.txt
merge.shmakeobj MERGE name.pak %%*%%.pak(replace "name" by the name you want for the final .pak)
extract.shmakeobj EXTRACT
Here is the biggest difference with windows : Linux doesn't allow the use of softwares or scripts automatically. To use your file you'll have to modify the use's rights of your files. Open a console and us the chmod command :
chmod u+x //name_of_the_file.sh//
Then, to lauch the file in a console :
./name_of_the_file.sh
If you know well linux system, you can make the makeobj's call simpler by using a symbolic link.
If you use debian, ubuntu or their derived releases, there is the depots a package to install makeobj properly on your system. So the process is the same but you just have to write makeobj in the file instead of the complete access path.
===== 4.Possible graphical errors =====
==== Objects look like Christmas trees in night mode ====
Your source picture contains a lot of special colors where they're not supposed to be. You can remove them with the tool "replace colors" of photofiltre for example.
==== White stripes ====
{{ fr:tuto:makeobj:makeobj02.png }}Your source picture is saved as 32 buts .png, it may happen if you use windows 7 for example. Save your picture with another software like photofiltre.
===== 5.Other errors witheout error message in err.txt =====
==== The object doesn't appear in the game ====
There are two possibles causes : your object may have the same name as another one, so it's replaced by this other one, or the problem is in your picture : it may be of wrong dimensions : they aren't multiples of the pakset you create for (1025 instead of 1024 pixels for example) or some pictures are missing (the icon of a building for example).
===== 6.Error messages in err.txt =====
These are some error messages you can find in err.txt, some of them may have induced a makeobj crash ... don't worry.
Error:: No such file or directory\\ ERROR IN CLASS image_writer_t: cannot open ./image.png\\
The file "image.png" isn't found, check that it's in the folder, check there is no mistake in the name.
FATAL ERROR: get_waytype()\\ invalid waytype ””
A essential parameter is missing in the .dat file, here the parameter "waytype" is missing.
Here are the most frequent problems, if datas are missing in your vehicles, ALWAYS check the spelling of your parameters (for example "lenght" instead of "length"), some parameters are wrongly spelled but they have to be written as they are given in the previous tutorial. If you have vehicles which won't attach themselves correctly, check that names are correctly spelled in the constraints, you can copy and paster the names in the constraints to be sure, for graphical glitches, the error is always in your picture or in the offset you use. If your pictures aren't at the good place, take a screenshot and measure the number of pixels between the good place, move the picture on the source picture.
In case of intractable problems, ask [[http://forum.simutrans.com/index.php?board=7.0|here]].