Gambit. 84 Posted June 4, 2014 (edited) Gambit Database Organizer Current Version: 1.50 Introduction: I hope I'm not the only one who gets frustrated by how difficult it is to reorder and organize the databases after you've started working on your project. If you're like me and like to group similar objects together, the editor makes it very difficult to add new objects. If you try to move around objects, all of the old references to objects will be broken and will instead refer to the object that currently has the ID that it is referring to. So you either have to settle for having an arguably disorganized database or plan all your databases all in advance. This script fixes this dilemma. An example of the problem this script solves: You have an event that gives the player one Potion. You later decide to cut and paste the Potion with the Antidote to swap them in the database. Now, anything that referred to the Potion will refer to the Antidote (and vice versa) since they were tied to the item ID, not the item. The event I mentioned will now give the player one Antidote instead of one Potion. This script allows you to swap the Potion with the Antidote while preserving all of the references you've made to both items in your project. This script allows you to move around items while preserving all of their references in your project. When using this script, be patient, especially if you have large databases, as some tasks can take longer to complete than others. Since this script modifies databases, you should either make a backup of your Data folder or use a copy of your project to test with. And, of course, use this at your own risk. I take no responsibility for any damage that may result from the use of this script. Please let me know how it works for you if you decide to give this a try. In case I've missed anything, I've made a list of every reference the script should redirect and update. If you spot anything I've missed, let me know! Otherwise, it should preserve references for everything on this list in the current version: ---Actors--- Troops: Battle Test, Battle Event Conditions System: Initial Party Map Events: Conditions Map Events, Troop Battle Events, Common Events: Show Text Show Scrolling Text Control Variables Conditional Branch Change Party Member Change HP Change MP Change State Recover All Change EXP Change Level Change Parameters Change Skills Change Equipment Change Name Change Class Change Nickname Name Input Processing Change Actor Graphic Force Action ---Animations--- Skills: Animation Items: Animation Weapons: Animation Map Events, Troop Battle Events, Common Events: Show Animation Show Battle Animation ---Armors--- Actors: Starting Equipment Enemies: Drop Items Troops: Battle Test Map Events, Troop Battle Events, Common Events: Conditional Branch Change Armor Change Equipment Shop Processing ---Classes--- Actors: Class Map Events, Troop Battle Events, Common Events: Conditional Branch Change Class ---Common Events--- Skill, Item Effects: Common Event Map Events, Troop Battle Events, Common Events: Call Common Event ---Enemies--- Troops: Members Map Events, Troop Battle Events, Common Events: Enemy Transform ---Items--- Enemies: Drop Items Map Events: Conditions Map Events, Troop Battle Events, Common Events: Control Variables Conditional Branch Change Items Shop Processing ---Self Switches--- Map Events: Conditions Control Self Switch Conditional Branch ---Skills--- Enemies: Actions Actor, Class, Weapon, Armor, Enemy, State Features: Add Skill, Seal Skill Skill, Item Effects: Learn Skill Map Events, Troop Battle Events, Common Events: Conditional Branch Change Skills Force Action ---States--- Classes: Learnings Enemies: Action Conditions Actor, Class, Weapon, Armor, Enemy, State Features: State Rate, State Resist, Atk State Skill, Item Effects: Add State, Remove State Map Events, Troop Battle Events, Common Events: Conditional Branch Change State Change Enemy State ---Switches--- Enemies: Action Conditions Troops: Battle Event Conditions Common Events: Condition Switch Map Events: Conditions, Move Route (Switch On, Switch Off) Map Events, Troop Battle Events, Common Events: Control Switches Conditional Branch Set Move Route (Switch On, Switch Off) ---Tilesets--- Maps: Tileset Map Events, Troop Battle Events, Common Events: Change Tileset ---Troops--- Maps: Encounters Map Events, Troop Battle Events, Common Events: Battle Processing ---Variables--- Skills: Formulas Items: Formulas Map Events: Conditions Map Events, Troop Battle Events, Common Events: Show Text Input Number Select Key Item Show Scrolling Text Control Variables Conditional Branch Change Gold Change Items Change Weapons Change Armor Change HP Change MP Change State Recover All Change EXP Change Level Change Parameters Change Skills Transfer Player Set Vehicle Location Set Event Location Show Picture Move Picture Battle Processing Get Location Info Change Enemy HP Change Enemy MP ---Weapons--- Actors: Starting Equipment Enemies: Drop Items Troops: Battle Test Map Events, Troop Battle Events, Common Events: Conditional Branch Change Weapons Change Equipment Shop Processing Description: This script allows a user to modify the order of objects in most databases while preserving all game references to the original objects. In the project editor, if you attempt to swap two Items by cutting and pasting, all references to the items would be reversed. The references are tied to the ID instead of the object itself. This script allows you to manipulate the databases while preserving all references to the original objects. A message will appear when the tasks you have specified are completed successfully. CLOSE AND REOPEN THE PROJECT for the changes to finalize and appear in the editor. If you save the project after running the script but before closing and reopening it, the Organizer tasks will be REVERTED. The script will print out a note to the console as each task is completed. If you encounter an error and would like to revert all the tasks that were performed prior to the error, just save your project. Again, saving the project after running the script will revert the changes. To finalize the changes, you must close the project after running the script then reopen it. Features: Swap, move, insert, and delete database objects without ruining all of the references in your game Update and redirect object references User-friendly Database Organizer scene to facilitate organization Optional task queue is available which will automatically perform the specified tasks in the order they are provided Most objects are supported: Actors Animations Armors Classes Common Events Enemies Items Self Switches Skills States Switches Tilesets Troops Variables Weapons Required Scripts: None Screenshots: Credits: Gambit Changelog: v 1.50 - June 6, 2014 Added support for variables Added support for self switches v 1.15 - June 5, 2014 Significant performance improvements Added support for switches v 1.10 - June 4, 2014 Added Database Organizer scene v 1.00 - June 4, 2014 Initial release Script: Script: Gambit Database Organizer Script v1.50.txt Old versions: Gambit Database Organizer Script v1.15.txt Gambit Database Organizer Script v1.10.txt Gambit Database Organizer Script v1.00.txt Edited June 7, 2014 by Gambit. 8 Share this post Link to post Share on other sites
TheoAllen 830 Posted June 4, 2014 Cool! Gambit, it's Cool! It's like my Database Manager with no WYSIWYG because mine uses Scene to organize database. But yours also fix the references which mine are not. It's great if we could combine both. Would you mind?Also ... *added to master script list* 1 Share this post Link to post Share on other sites
Gambit. 84 Posted June 4, 2014 Wow after looking at your Database Manager, I think that's a great idea. Yours is much nicer to use since it allows the user to see the changes immediately so instead of queuing tasks based on their predicted IDs (what mine does) they can just do one then the next. That would be amazing. Let me know how you want to do it. We can either write up a compatibility patch to let them work together or actually combine the scripts into one. Either way is fine with me! 2 Share this post Link to post Share on other sites
TheoAllen 830 Posted June 4, 2014 Hehe... just wait for the next week. I got many task to do and have no time on experimenting script. I'm sure I will note this to my to do list =D 2 Share this post Link to post Share on other sites
Gambit. 84 Posted June 4, 2014 All right, let me know when you have time and we can figure it out. Share this post Link to post Share on other sites
+ Sughayyer 163 Posted June 4, 2014 Man, how I waited for something like this. Didn't think it was possible (and I guess I wasn't familiar/didn't know TheoAllen's organizer) Share this post Link to post Share on other sites
Gambit. 84 Posted June 5, 2014 (edited) I hope you don't mind, Theo, but your idea was so good that I couldn't wait to implement it! Your site and script references are in Indonesian though so I went ahead and created my own scene from scratch. Of course, you can still add support for mine into your script if you'd like. If you do, check out the task method in the Scene_DatabaseOrganizer class from my updated script to see how I prepare a task. Script updated! It should be much easier to use now with the scene interface. Check out the new screenshots in the OP. I also left in the option to specify a list of tasks in case anyone prefers the old way of queuing tasks so that they're automatically performed. v 1.10 - June 4, 2014 Added Database Organizer scene Edited June 5, 2014 by Gambit. Share this post Link to post Share on other sites
TheoAllen 830 Posted June 5, 2014 No worry, most of my scripts was intended to help me to do this kind of things actually. i.e, for my personal use. If anyone have done better, I would like to use other's since there is no database manager/organizer back then, so I created myself. I have a question. Though, I don't tried it myself. Would this produce a lag/frameskip because you will have to refresh all the list every the database has changed? Share this post Link to post Share on other sites
Gambit. 84 Posted June 5, 2014 (edited) Well, I created a method that loops the redraw method for only the items that need to be redrawn after each task. So the window only redraws those specific items instead of refreshing all items. So it will lag more if you delete Skill 1 (because the script will have to redraw skills 1-126) than if you delete Skill 126 (since it will only redraw Skill 126). I think most of the lag is because of the reference-changing though. If you delete Skill 1, for example, it will search the entire project for every reference to Skill 2 and change them to Skill 1, change Skill 3 to Skill 2, etc. It will do this over and over again for all 126 skills. So that slows the game down too. Edited June 5, 2014 by Gambit. 1 Share this post Link to post Share on other sites
TheoAllen 830 Posted June 5, 2014 I do have english version here. If you look closely on the video, there is a loading window. Basically, while database list is being drawn (because drawing function is the one which causes lag more) you still allowed to move the cursor and change the database. Scan for entire project is not time consuming as drawing pixel I guess. Well, dunno. 1 Share this post Link to post Share on other sites
Wren 179 Posted June 5, 2014 How did you two even do this? Seems impossible to edit the database in this way. I hate making changes to my database because it's like I have to plan ahead and leave large chunks of empty space in case I have to make more of something. Share this post Link to post Share on other sites
Gambit. 84 Posted June 5, 2014 @Theo: Well... I ran some tests got the following results: 6.268s to find / change all the references and 0.137s to draw the items in v1.10. But this was simply poor coding on my part! I thought about ways to improve the efficiency and realized that I basically had the insert and delete tasks looping swap tasks until they fixed all the necessary references. So if you deleted Skill 1 in a blank project, for example, the script was searching through the entire project over and over again for a total of 125 times. I've completely rewritten the way references are changed and database modifications are made so the entire project is only searched one time for each task (even for insert and delete). I just ran the same test that took 6.268s and it took 0.079s to complete with the new code! So that's a huge improvement. Now, drawing the items is the more time-consuming part, like you guessed. So good news: v1.15 will be out later today and it will be more than 90% faster! @Wren: It's more time-consuming than anything else really. In order to change all the references to all the objects, you've got to manually find them all (there isn't any easy way to do this). So this was the main issue. It meant tediously searching through the editor (databases, event commands, map properties, etc) and making notes of anything I could find that referenced something in the database. Once they were all found (at least what I believe to be everything after repeated searches), it just required figuring out how the IDs were coded in the data files (so for an event command, for example, this usually meant printing out the command and identifying the relevant parameters) so that they could be changed by a script. Now we can finally work on our games without worrying about adding / changing anything at a later time. 1 Share this post Link to post Share on other sites
+ Archeia 160 Posted June 5, 2014 This is amazing! I always wished there was a better way to reorganize DB items <3 Share this post Link to post Share on other sites
TheoAllen 830 Posted June 5, 2014 Definitely going to try this if you could improve better performace! I planned to organize my game database. And that was too late. So, I ended up to add actor skills in the end of skills list. Which doesn't look neat Share this post Link to post Share on other sites
Gambit. 84 Posted June 6, 2014 Okay, the update has been posted. The performance is much, much better now for the insert and delete tasks (no more looping through the entire project repeatedly, now only one search is performed per task). And I added support for organizing switches! Variable support may be coming in the future... There's just so many references to them. v 1.15 - June 5, 2014 Significant performance improvements Added support for switches 1 Share this post Link to post Share on other sites
estriole 326 Posted June 6, 2014 this script will help a lot. will wait for the variable support feature. it would be perfect. Share this post Link to post Share on other sites
Dark Sky 20 Posted June 6, 2014 This script helped me a lot. Thanks so much! Share this post Link to post Share on other sites
Gambit. 84 Posted June 7, 2014 (edited) this script will help a lot. will wait for the variable support feature. it would be perfect. Updated! It now supports variables and self switches! This script helped me a lot. Thanks so much! You're very welcome! I'm glad you found it useful. New update! v 1.50 - June 6, 2014 Added support for variables Added support for self switches Note 1: If a switch / variable is the beginning of a batch, then that reference will be changed. If the reference is at the end of a batch, it will not be changed. This seemed like the best way to handle batches. Note 2: Self switches can only be swapped and updated (no moving, inserting, or deleting). They are organized on a per-map basis. Edited June 7, 2014 by Gambit. 2 Share this post Link to post Share on other sites
estriole 326 Posted June 7, 2014 marvelous. . good job gambit. . now no need to let blank spaces on the project anymore and found out later that the blank spaces still NOT ENOUGH . Share this post Link to post Share on other sites
bvck 2 Posted June 16, 2014 Wow I wish I came across this like two weeks ago lol. Spent almost a full day moving around dozens of equipment pieces and items, still not 100% sure if I got all the refernces fixed up throughout the project. Share this post Link to post Share on other sites
DoubleX 208 Posted August 16, 2014 (edited) My feeling after trying to understand your script is this: If rewriting the whole battle system is like rebuilding the entire display card, then rewriting the whole database system is like rebuilding the entire motherboard(even though your script doesn't rewrite how rvdata2 works as it's not its scope). I wonder how many weeks or months you've spent on this script I think this script isn't only valuable to its users but also other scripters who wishes to improve their scripting proficiency. Right now many scripters can rebuild the entire display card(while I still can't XD), but it seems to me that only really proficient ones can rebuild the entire motherboard. Maybe your script can be indeed used as a formal learning material of RGSS3, or at least the database part of it Edited August 16, 2014 by DoubleX 1 Share this post Link to post Share on other sites
Gambit. 84 Posted August 16, 2014 Thanks for all your kind words. The hardest part with this script was figuring out exactly what to change for each type of object. I had to manually go through every part of the editor and search through it carefully while taking notes whenever I saw a reference to one of the objects the script can change. And, of course, going through all of the event commands to find the indices of each of their parameters was a pain. I'm glad you can use it as a reference though. I hope you learn from it! Let me know if you have any questions and I can try to explain. Share this post Link to post Share on other sites
DoubleX 208 Posted August 16, 2014 (edited) Thanks for all your kind words. The hardest part with this script was figuring out exactly what to change for each type of object. I had to manually go through every part of the editor and search through it carefully while taking notes whenever I saw a reference to one of the objects the script can change. And, of course, going through all of the event commands to find the indices of each of their parameters was a pain. I'm glad you can use it as a reference though. I hope you learn from it! Let me know if you have any questions and I can try to explain. Unfortunately, right now I can just barely get the overall structure of your script. It's merely because my RGSS3 understanding just didn't reach your level yet. For me, studying every last detail of your script is like studying every last circuit of a motherboard. So I'll keep your script in mind and maybe when my RGSS3 proficiency improves, I'll use your script as a learning material myself. Like what you said, it's what those details that require the most effort to put into. As there are so many things in the database system and most of them are so closely interrelated, it must be a pain to test and debug your script Edited August 16, 2014 by DoubleX Share this post Link to post Share on other sites