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 Tue Apr 16, 2024 10:10 pm
All times are UTC + 0
Tool for editing INI file
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [3 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
linq2js
Light Infantry


Joined: 26 May 2011

PostPosted: Sun Apr 15, 2018 9:57 pm    Post subject:  Tool for editing INI file Reply with quote  Mark this post and the followings unread

I developed INI Transformer, it saves much time for modder. Here are some featured functionality

SAMPLES:
1. Declare variables
Code:

@AllCountries=Yuri,America,Russia..

[NewTechNo]
Owner=@{AllCountries}

Output
Code:

[NewTechNo]
Owner=Yuri,America,Russia..


2. Reuse/inherit INI section
Code:

[HasPrimary]
@type=base ; specific this section is base section and it will be not rendered to output file
Primary=@{0} ; set primary weapon to argument 0 value
ElitePrimary=@{1} ; set elite primary weapon to argument 1 value

[NewTechno]
@extend=HasPrimary | 120mm | 120mmE


Code:

[NewTechno]
Primary=120mm
ElitePrimary=120mmE


OR we can set default value if no argument 1 passed
Code:

[HasPrimary]
@type=base ; specific this section is base section and it will be not rendered to output file
Primary=@{0} ; set primary weapon to argument 0 value
ElitePrimary=@{1} ; set elite primary weapon to argument 1 value
@default:1=@{0} ; set default value for argument 1


3. Auto merge properties
Code:

; file 1
[General]
Prop1 = value1
Prop2 = value2

;file 2
[General]
Prop1 = value2


Output
Code:

[General]
Prop1 = value2
Prop2 = value2


4. Auto register list item
Code:

[InfantryTypes]
@type=append
1 = NewTechno

[NewTechno]
; techno props here

Output
Code:

[InfantryTypes]
... existing items
121 = NewTechno ; new item will be added in last position


OR we can use other way to register Techno
Code:

[NewTechno]
@appendTo=InfantryTypes ; same effect with prev sample


This helps modders can register Projectiles, Warheads, Techno Types... on the fly

5. Auto modify tag value
For sample, modder want to add TechNo name to BuildCons of AI section
Code:

[AI]
@type = merge
BuildConst=@{current},AUBASE ; @{current} is special value, it means value of current tag

Output
Code:

[AI]
... another tags
BuildConst=...another values,AUBASE


6. Obfuscate section name
Code:

[unique:NewTechno]
... some tags here

[AnotherTechno]
Prerequisite=ref:NewTechno ; get NewTechno real name


Output
Code:

[ads577as996da]
...new techno tags

[AnotherTechno]
Prerequisite=ads577as996da


USAGE:
We can organize our INI files look like
rules.original.ini ; original rules
rules.soviet.builings.ini ; contains all building technos
rules.soviet.infantry.ini ; contains all infantry technos (may be weapons included)
rules.soviet.misc.ini ; other things

BAT file:
INITransformer.exe rules.ini rules.original.ini rules.soviet.builings.ini rules.soviet.infantry.ini rules.soviet.misc.ini

That will create rules.ini file with combinations of rules.original.ini, rules.soviet.builings.ini ...

Syntax:
INITransformer.exe OutputFile File1 File2 File3 ...

DOWNLOAD LINK:
This requires .Net 4.5.2
https://goo.gl/9g9FYg

UPDATE 16 Apr
7. @require feature
Code:

; Can use @require anywhere, it will inject another file and parse immediately
@require=rulesmd.original,ini
@require.rulesmd.soviet,ini
... more files or new techno here


So we have simplier BAT file
INITransform.exe rulesmd.mod.ini

8. query for merging and updating
Code:

[?Replace armor type query:*] ; using wildcard for any chars, ? for single char
@where=Armor:concrete&ConstructionYard:yes ; this means tag filter for Armor = concrete and ConstructionYard=yes
Armor=NewArmorType


Sample 1
Code:

; render original rulesmo firstly
@require=rulesmo.original.ini

; define simple base section, it has Owner tag and make sure ForbiddenHouses tag must be removed
[AnyOwner]
@type=base
Owner=USSR,Latin,Chinese,PsiCorps,Headquaters,ScorpionCell,Europeans,UnitedStates,Pacific,Guild1,Guild2,Guild3
ForbiddenHouses=@@remove

; define new tech no
[TDHMGT]
; append it into BuildingTypes
@appendTo=BuildingTypes
; copy all tags from CAHMG gun
@extend=CAHMG
; it belongs to any country
@extend=AnyOwner
; more stuffs
BaseNormal=yes
Adjacent=10
Power=0
Powered=false
TechLevel=1


Output
Code:

[TDHMGT]
BaseNormal=yes
Adjacency=10
Power=0
Powered=false
TechLevel=1
UIName=Name:CAHMG
Name=Tech HMG Tower
Strength=1050
Armor=defense
NeedsEngineer=yes
CaptureEvaEvent=EVA_TechDefenseCaptured
LostEvaEvent=EVA_TechDefenseLost
Sight=8
ROT=5
Unsellable=yes
Insignificant=yes
RadarVisible=yes
Bounty=no
Points=15
Cost=500
Crewed=no
Primary=HMGWeapon
Capturable=true
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
DebrisAnims=DBRIS1LG,DBRIS1SM,DBRIS4LG,DBRIS4SM,DBRIS5LG,DBRIS5SM
MaxDebris=4
MinDebris=1
ThreatPosed=0
DamageParticleSystems=SparkSys,LGSparkSys
IsBaseDefense=yes
Drainable=yes
Turret=yes
TurretAnim=CAHMG_A
TurretAnimIsVoxel=false
TurretAnimZAdjust=-125
HasStupidGuardMode=false
AntiInfantryValue=50
AntiArmorValue=10
AntiAirValue=0
VeteranAbilities=STRONGER
EliteAbilities=SELF_HEAL,FIREPOWER
ElitePrimary=HMGWeapon
Trainable=yes
VoiceSelect=TechDefenseSelect
HasRadialIndicator=true
Nominal=no
ImmuneToEMP=no
Insignia.Veteran=defvet
Insignia.Elite=defeli
Chronoshift.Allow=no
EVA.VeteranPromoted=EVA_DefenseUpgraded
EVA.ElitePromoted=EVA_DefenseUpgraded
Promote.VeteranSound=UpgradeDefenseVeteran
Promote.EliteSound=UpgradeDefenseElite
Owner=USSR,Latin,Chinese,PsiCorps,Headquaters,ScorpionCell,Europeans,UnitedStates,Pacific,Guild1,Guild2,Guild3

Last edited by linq2js on Sun Apr 29, 2018 2:51 am; edited 1 time in total

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Tue Apr 17, 2018 6:48 am    Post subject: Reply with quote  Mark this post and the followings unread

same was done already here
Any differences/improvements of yours over the other one?

Also check out the comments on the other one. Such a tool isn't well received here from most experienced modders due to various good reasons.

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
linq2js
Light Infantry


Joined: 26 May 2011

PostPosted: Tue Apr 17, 2018 9:34 am    Post subject: Reply with quote  Mark this post and the followings unread

Lin Kuei Ominae wrote:
same was done already here
Any differences/improvements of yours over the other one?

Also check out the comments on the other one. Such a tool isn't well received here from most experienced modders due to various good reasons.

wow, thank you it really good. i never know it before. haha
I can collect some diff between it and mine
1. Can declare variable any where in my app
2. Can update multiple techno tags with few lines
3. Multiple inheritances, can pass arguments to base class
4. Easy to register techno warhead...
5.. Append / prepend value to existing techno tag value
hopfully these features help modder a lot

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 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
You cannot post new topics in this forum
You cannot 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.1716s ][ Queries: 11 (0.0083s) ][ Debug on ]