The update of libraries is a very huge problem for the moment.
This tutorial shows you how to solve the problem with some conditions.
The difficulty of this manipulation can be rated "Medium".
The main word to resolve this problem is : XML.
Note: English is not my main language. If you can help me if some sentences are false, thank you very much! The pictures show to you the french version.
Prerequisites
Softwares
Some editor for .txt (gEdit, Notepad, Notepad + +, ...)
MPQEditor
Knowledges
Windows or Mac fluent manipulations (copy/paste/edit file).
What is the problem ?
When you want to update a library, the main problem is about you must to rewrite all triggers. If you try to delete the old version of a library, all parameters of triggers using this old library are deleted. It's a huge problem... But it can be solve if the programmer of the library has kept the main functions Id's.
How to do that ?
Note: This tutorial will be made with 2 versions of my custom library "QuestLine".
Step 1: What is my libraries ID ?
Open your project. Save as new file (to make a back-up) and go to Trigger Editor.
Import the new library update.
In this example you can see 2 libraries. The goal will be to convert all "QuestLine v1.1" functions to "QuestLine v1.11" functions.
Right click on the old library. Go to Library > Change Library ID. Note the library ID somewhere.
2 cases can appears:
1.) The first is the most common: the library ID is here and you can note this ID.
2.) The library ID is not here. If you have the problem, close this window and check the order of your library. Don't notice the natives functions (Integrated library). Only the order of your libraries without generated id. In my example, the old library don't have any library ID.
The id of this library will be "1".
Step 2: Reach Triggers XML file
Save and exit GalaxyEditor.
Open MPQEditor and open your project.
Check the file name "Trigger". Forward this file to your desktop.
Open this file with any text editor (Notepad, Notepad + +, gEdit, ...)
Your editor shows you this kind of picture:
Don't go away! Use only your eyes... and the Find window.
Step 3: Edit Triggers file
Open the Find window and search: "Library Id=" (Loop option checked).
Your editor must find this:
Check with your notes about library ID. In this example, the new library have the ID A06EFA08. All information under this tag are in the new library. This ID is the reference of your new library.
Research the next library id with the same way.
Your editor - in my example - find:
This is the old library, with no Library ID defined. All information under this tag are in the old library. This ID is the reference of your old library.
Now, search "<Root>".
All information under the "Root" tag are very important. You find here all information about the triggers of your map (libraries excluded).
To do that for all lignes, move your cursor after the
<Root>
(...)
</Root>
Open the Find and Replace window.
In the "Find" field, tape " Library="1" ". In the "Replace" field, tape " Library="A06EFA08" ".
Be carreful, before to do that, UNCHECK THE LOOP OPTION.
Save your file.
Step 4: Forward into the SC2Map file
Forward your edited file "Triggers" to the MPQEditor to replace the old file.
Close the file with MPQEditor.
Open your SC2Map file with GalaxyEditor.
Go to the Trigger Editor.
Try to save your project. The project must be saved to confirm the changes. If some functions have changed, some errors can occurs. Identify these errors and resolve it.
The End
All is done. To be sure about the modification, select a library-sided function and tape Enter. Check the name in the Action window. If the name has changed, it's fine.
You can now remove the older library and continue to coding with the new updated library :)
Introduction
The update of libraries is a very huge problem for the moment. This tutorial shows you how to solve the problem with some conditions. The difficulty of this manipulation can be rated "Medium". The main word to resolve this problem is : XML.
Note: English is not my main language. If you can help me if some sentences are false, thank you very much! The pictures show to you the french version.
Prerequisites
Softwares
Knowledges
Windows or Mac fluent manipulations (copy/paste/edit file).
What is the problem ?
When you want to update a library, the main problem is about you must to rewrite all triggers. If you try to delete the old version of a library, all parameters of triggers using this old library are deleted. It's a huge problem... But it can be solve if the programmer of the library has kept the main functions Id's.
How to do that ?
Note: This tutorial will be made with 2 versions of my custom library "QuestLine".
Step 1: What is my libraries ID ?
Open your project. Save as new file (to make a back-up) and go to Trigger Editor. Import the new library update.
In this example you can see 2 libraries. The goal will be to convert all "QuestLine v1.1" functions to "QuestLine v1.11" functions.
Right click on the old library. Go to Library > Change Library ID. Note the library ID somewhere.
2 cases can appears:
The id of this library will be "1".
Step 2: Reach Triggers XML file
Save and exit GalaxyEditor. Open MPQEditor and open your project.
Check the file name "Trigger". Forward this file to your desktop. Open this file with any text editor (Notepad, Notepad + +, gEdit, ...)
Your editor shows you this kind of picture:
Don't go away! Use only your eyes... and the Find window.
Step 3: Edit Triggers file
Open the Find window and search: "Library Id=" (Loop option checked).
Your editor must find this:
Check with your notes about library ID. In this example, the new library have the ID A06EFA08. All information under this tag are in the new library. This ID is the reference of your new library.
Research the next library id with the same way.
Your editor - in my example - find:
This is the old library, with no Library ID defined. All information under this tag are in the old library. This ID is the reference of your old library.
Now, search "<Root>".
All information under the "Root" tag are very important. You find here all information about the triggers of your map (libraries excluded).
Slide down. Check the rest of the file:
See the highlighted text.
This line is very interesting:
With updated libraries, functions already created retain their ID. The Id field is useless. The Library field is on the other side very useful.
By changing the Library field id with the new id, you can solve your problems.
The last code becomes:
To do that for all lignes, move your cursor after the
Open the Find and Replace window.
In the "Find" field, tape " Library="1" ". In the "Replace" field, tape " Library="A06EFA08" ". Be carreful, before to do that, UNCHECK THE LOOP OPTION.
Save your file.
Step 4: Forward into the SC2Map file
Forward your edited file "Triggers" to the MPQEditor to replace the old file.
Close the file with MPQEditor. Open your SC2Map file with GalaxyEditor. Go to the Trigger Editor.
Try to save your project. The project must be saved to confirm the changes. If some functions have changed, some errors can occurs. Identify these errors and resolve it.
The End
All is done. To be sure about the modification, select a library-sided function and tape Enter. Check the name in the Action window. If the name has changed, it's fine.
You can now remove the older library and continue to coding with the new updated library :)
@Doubotis:
You made a tutorial about this =D Thanks a lot!
You rock mate. :)