INI section includes / section templates

Bug #895552 reported by pd
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ares
Confirmed
Wishlist
Unassigned

Bug Description

Sometimes you need to create multiple sections that contain largely the same keys and values, causing a lot of copy & paste work and making INIs large as hell. You see that a lot throughout INI files, in fact, it applies to most units.

I would like to introduce a possibility to make a section "include" another, so that the latter serves as a template to the former. All keys defined in the template section would be copied to the using section.

This would, of course, only be possible if the template section has been defined before.

As for the semantics, I'm thinking of the following example:
[PsychicJab]
Damage=25
ROF=15
Range=4.5
Projectile=InvisibleLow
Speed=100
Warhead=SAFlame
Report=InitiateAttack
OccupantAnim=UCINIT
OpenToppedAnim=GUNFIRE

[PsychicJabE]:[PsychicJab]
Damage=30
Range=6

PsychicJabE would include all keys from PsychicJab, then override Damage and Range.

Revision history for this message
Professor_Tesla (professor-tesla) wrote :

I support this, and agree with the reasoning behind it. I believe this would be a very useful feature if implemented.

Revision history for this message
EVA-251 (eva-251) wrote :

I strongly support this measure. This could be extremely useful, and shrink the size of rulesmd.ini significantly.

Revision history for this message
reaperrr (reaperrr) wrote :

Totally like this idea. The immense bloat of RA2/YR's inis has always been one of the main reasons why I always favored modding TS despite its inferior feature-set. This feature would completely turn the tide in RA2/YR's favor for me.

Revision history for this message
Bug Importer (bug-importer) wrote :

Code related to this issue has just been checked in; pd wrote in revision 605:
Fixes issue 940.
Implemented as described in the report.
Related to issue 940 .
SVN: http://svn.renegadeprojects.com/listing.php?repname=Ares&path=%2Ftrunk%2F&rev=605&sc=1

Revision history for this message
WoRmINaToR (worminator) wrote :

This needs re-opening because unless I am making some stupid mistake there is a problem.

The first part of this issue works. Using [TECHTYPE1]:[TECHTYPE2], TECHTYPE1 inherited all characteristics of TECHTYPE2, however the second part failed. The tags added after the unit's declaration are not parsed at all; none of the overrides are recognized by the game.

Of course it could be a mistake in my code, here is what I used:

;Predator Mech
[PREDATOR]
UIName=Name:PRED
Name=Predator Battle Mech
Prerequisite=GAWEAP
Prerequisite.Negative=GTNKUP,GAISUP,GAISUP2,GTNKUP2
Primary=105mm
Strength=300
Category=AFV
Armor=heavy
Turret=yes
IsTilter=yes
Crusher=yes
Operator=_ANY_
TooBigToFitUnderBridge=true
TechLevel=2
Passengers=1
SizeLimit=1
Sight=8
Sensors=yes
SensorsSight=6
Speed=4
CrateGoodie=no
Owner=British,French,Germans,Americans,Alliance
ForbiddenHouses=Germans
Cost=900
Soylent=900
Points=25
DeploysInto=GAPRGUN
ROT=5
IsSelectableCombatant=yes
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
VoiceSelect=GenAllVehicleSelect
VoiceMove=GenAllVehicleMove
VoiceAttack=GenAllVehicleAttackCommand
VoiceFeedback=
DieSound=GenVehicleDie
MoveSound=GrizzlyTankMoveStart
CrushSound=TankCrush
MinDebris=5
MaxDebris=10
Locomotor={4A582741-9839-11d1-B709-00A024DDAFD1}
MovementZone=Normal
ThreatPosed=15
DamageParticleSystems=SparkSys,SmallGreySSys
VeteranAbilities=STRONGER,FIREPOWER,SIGHT,FASTER
EliteAbilities=SELF_HEAL,STRONGER,FIREPOWER
Accelerates=false
ImmuneToVeins=yes
Size=3
AllowedToStartInMultiplayer=no
OpportunityFire=yes
ElitePrimary=105mmE
BuildTimeMultiplier=1.0

;Predator w/ Lasers
[ISPREDATOR]:[PREDATOR]
Image=PREDATOR
Prerequisite=GAWEAP,GAISUP
Prerequisite.Lists=1
Prerequisite.List1=GAWEAP,GAISUP2
Prerequisite.Negative=GTNKUP,GTNKUP2
Primary=Laser105mm
ElitePrimary=Laser105mmE
DeploysInto=ISGAPRGUN

ISPREDATOR came out with no image (because PREDATOR doesn't have/need an Image= value), had the same prerequisites, and fired the same old gun as the first predator incantation.

On another note, I was unable to re-open this issue for some reason. I clicked re-open and posted this same note (or attempted to), and all I got was a white screen saying "Access Denied."

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

Reopening as per last comment.

Revision history for this message
reaperrr (reaperrr) wrote :

unless that issue turned up in an earlier revision than 667, I cannot confirm this. I tested it and it seems to work just fine.

[VehicleTypes]
102=HOWI3

[HOWI3]:[MTNK]
UIName=NOSTR:Howitzer III
Image=MTNK
Cost=350
Primary=RadBeamWeapon_2

With this code, the unit has all the basic Grizzly characteristics but uses the apoc's voxel, costs 350 credits, fires my custom RadBeam weapon etc.

Revision history for this message
WoRmINaToR (worminator) wrote :

...

Well I am still not getting results. Am I making any syntax errors that you can see in the above code?

(Edit) And yes, I tested with with rev. 667.

Revision history for this message
WoRmINaToR (worminator) wrote :

Okay, I'm getting very strange results now.

@Reaperrr I copy/pasted your exact code (but ofc changed the weapon) into a fresh, clean set of rulesmd.ini taken straight from the YR 1.001 patch. I ran the game with Ares enabled and got absolutely no effect whatsoever. I couldn't even build the new unit.

What's stranger, I made some minor edits to my rulesmd.ini, where all i really did was remove the Operator=_ANY_ tag, and I am getting really erratic results. Now only the original predator and one of three upgraded versions are showing up.

I know my code above shows only one upgraded predator, but i have 3 in total in my rulesmd.ini, all of which showed up in my first test, albeit all with the same exact characteristics of the original PREDATOR. Now only one of them shows up at all, and it still doesn't have any of its own characteristics.

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

Sorry, this stuff was implemented by pd and I'm not too familiar with it. Can you make a process dump while the game is running (Task Manager -> right click -> Create Dump File) and upload it, with the rules you're using? That would give us a bit more to work on.

Revision history for this message
reaperrr (reaperrr) wrote :

@WoRmINaToR: we were both right.

If you put the code into RULESMD.INI, it indeed doesn't get loaded.

if you put the code into a separate ini and let that ini be loaded through the [#include] section, it loads properly (which is what I did, that's why it worked for me).

Revision history for this message
WoRmINaToR (worminator) wrote :

Well, since we (putatively) figured out the issue, do you still want that process dump file, DCoder?

Anyways, it's all good that it works with #include's, but I think that for the sake of all of us other modders who most likely won't be using includes, this needs to be working normally for the main body rulesmd.ini file.

For now I'll use the #include section, but I definitely think this needs to work for the main file.

EDIT: Confirmed reaperr's findings and it works fine for me in an #include file

Revision history for this message
reaperrr (reaperrr) wrote :

As I expected, this feature doesn't work when used inside artmd.ini either, and since [#include] currently doesn't with artmd.ini, this feature currently cannot be used at all for art-related ini code.

It would be great if it was fixed so that it works for both the main rulesmd.ini and artmd.ini.

Edit: Doesn't work for artmd.ini even in an #included .ini..

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

As much as I'd like to get this done, it's pd's code in the area that I'm not familiar with. Unassigning, retargeting.

Revision history for this message
reaperrr (reaperrr) wrote :

I must say even though I've been one of the supporters so far, I found myself using it (the working part) far less frequently than I originally thought. So while I'd still like to see the flaws fixed one day, I'm perfectly fine with delaying this to the distant future.

Revision history for this message
WoRmINaToR (worminator) wrote :

Perhaps pd will make another of his show-stopper visits over here and fix this issue.

Since that's mostly wishful thinking, if there is anything we users can do (like that process dump?) to help out, I'm more than willing. I use this feature extensively in my mod, and while for the most part all of the things that need this feature ended up in [#include] files anyway, I can definitely see this being bothersome in the future when I expand on some of the things that I have left in the main rulesmd.ini file (expansions I have already planned). This will also probably be an issue for newer modders (to either Ares or to YR itself) on the scene that want to shorten their rulesmd.ini files.

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

No, I'm afraid there's no real way you guys can help with this one for now.

Revision history for this message
secondwtq (secondwtq) wrote :

I think features like that to facilitate modders is a waste of time.

Revision history for this message
Black Temple Gaurdian (black-temple-gaurdian) wrote :

Yes but you also obviously think search bars are a waste of time so your opinion doesn't really count for much.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.