Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Sat Nov 09, 2024 12:17 am
All times are UTC + 0
AICLEAN - a script to clean and organize rules/art/ai.ini
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [5 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Fri May 26, 2023 7:49 am    Post subject:  AICLEAN - a script to clean and organize rules/art/ai.ini
Subject description: (also supports merging Ares/Phobos 'include' files into the main ini)
Reply with quote  Mark this post and the followings unread

This script requires TCL runtimes, you can get it here: https://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai/downloads/activetcl-8612-for-windows

This script started out as a way to remove junk and duplicated or orphan code within the ai.ini, but has since been expanded to cover rules.ini and art.ini for cleaning, and has recently learned a few new tricks. The original goal was to simplify the inis, strip comments and anything else not suitable for a public release in a mod, thus prevent publishing internal notes or unused code, but some authors like the ability to organize the ini on a routine basis instead. This script should not really be considered an error-checking script and more of a housekeeping script, one concerned with layout and structure instead of correctness. As such, AICHECK should still be used to find errors in the cleaned inis, but the aiclean.log may contain vital information that should be corrected or used to correct related problems.

The recent updates have added more Ares/Phobos awareness in a few key ways, namely the include function, which has prevented my other cross-checking scripts from reading/parsing the mod. By using AICLEAN to merge the inis, it no longer matters that the other scripts don't support reading such includes, however as all the examples used to test this functionality, the very paradigm of dividing the ini code across multiple files does in fact lead to a lot of unnecessary mistakes. Merging all the files, eliminating duplicates and making sure the include code overrides the core code, can undo a runaway file organizing system. This Ares-awareness also extends to [WeaponTypes] support, to which can be added declarations with proper indexing with the right options set, and the Ares method of specifying alternate theater art, which is used to group related art in the art.ini restructuring.

The script will restructure the rules.ini according to the aiclean.cfg settings, which encompasses the basic section ordering, and has additional settings to sort the tags within unit classes and buildings, so as to make them visually consistent, which is easier to edit or catch mistakes. As of the latest updates overhauling the code, it will automatically organize all the declaration lists first, and all the object code later, with a few specific sections placed at the end. Within this organization, the objects are also sorted alphabetically, and objects not subject to the tag ordering sequence defined in the cfg, are also sorted alphabetically. In the process, anything duplicated is culled from the list and mentioned in the log. With the reindex option enabled, AICLEAN will also reset all the indexes on all the declaration lists to start at 0 and remove any numbering gaps, except for [OverlayTypes] where they must remain as they are.

A final function of AICLEAN is it will automatically add declarations for referenced objects (ie. used) if the code for them exists. So if there's a building in a Prerequisites= tag on a unit, and the building code has been added, but the [BuildingTypes] declaration is missing, it will add it to the end of the list, with the appropriate index number -- unless the reindex option is turned off, then it will start at 10000. Entirely orphaned code, with no references won't be deleted in rules/art.ini but will not be declared either, the script doesn't try to determine what class is the orphaned object, so without the declarations/references for guidance it won't know where it belongs.

As with all such scripts, the aiclean.tcl will have to be edited to set basic settings like filenames and the game path.

Current version: 6.0a



clean.jpg
 Description:
 Filesize:  211.07 KB
 Viewed:  2417 Time(s)

clean.jpg



aiclean6.rar
 Description:

Download
 Filename:  aiclean6.rar
 Filesize:  15.76 KB
 Downloaded:  21 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Last edited by G-E on Sun Jul 23, 2023 8:44 am; edited 1 time in total

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Fri Jun 02, 2023 10:29 am    Post subject: Reply with quote  Mark this post and the followings unread

Small update AICLEAN 6.1...

There was an oversight that caused [$Include] sections to be discarded even if mergemode was off, it now saves it. Although it doesn't place it automatically at the beginning, maybe that will come in the next update.



aiclean6.rar
 Description:

Download
 Filename:  aiclean6.rar
 Filesize:  15.72 KB
 Downloaded:  13 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Fri Jul 07, 2023 12:18 am    Post subject: Reply with quote  Mark this post and the followings unread

Another very small update, AICLEAN 6.1b...

First change is that the script will no longer exit before writing the log, so if art.ini or ai.ini aren't found/cleaned, the clean.log will still include all the messages up to that point.

The second change is to add a total processing time like AICHECK has at the end of the log.



aiclean6.rar
 Description:

Download
 Filename:  aiclean6.rar
 Filesize:  15.81 KB
 Downloaded:  28 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Dec 24, 2023 10:23 am    Post subject: Reply with quote  Mark this post and the followings unread

AICLEAN 6.2...

This release adds requested change I've been meaning to do, forcing include sections to write before other sections, if mergemode is off.

Since a big part of this script has become the ability to merge include sections, so that AICHECK can process the mod inis, this is likely not going to be overly important. That said, it is entirely logical to write them this way.



aiclean6.rar
 Description:

Download
 Filename:  aiclean6.rar
 Filesize:  15.91 KB
 Downloaded:  9 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Wed Dec 27, 2023 11:21 am    Post subject: Reply with quote  Mark this post and the followings unread

AICLEAN 6.2b...

- A minor update to fix improper merging of [Sides]

Previous versions would duplicate entries found in include inis instead of overriding the rules.ini value.



aiclean6.rar
 Description:

Download
 Filename:  aiclean6.rar
 Filesize:  16.05 KB
 Downloaded:  10 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1993s ][ Queries: 14 (0.0096s) ][ Debug on ]