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 Thu Mar 28, 2024 6:33 pm
All times are UTC + 0
Ares #include with Lists
Moderators: Ares Support Team at PPM, Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [14 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
cxtian39
Commander


Joined: 11 Feb 2016

PostPosted: Wed Mar 14, 2018 7:58 am    Post subject:  Ares #include with Lists Reply with quote  Mark this post and the followings unread

If I have my rulesmd.ini including building.ini and in building.ini I have
Code:
[BuildingTypes]
0=NEWBUILDING1
1=NEWBUILDING2
2=NEWBUILDING3

What does the internal BuildingTypes list look like?

_________________

Back to top
View user's profile Send private message Skype Account
E1 Elite
General


Joined: 28 May 2013

PostPosted: Wed Mar 14, 2018 1:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

In Ares, you can map a hotkey from options->kbd->development->type list
and debug log will contain the list that the game uses when you press that
hotkey in the game.

I don't use #include. FA2/AI editor etc. uses such lists, so have to merge again
for those tools.

Just for curiosity, I tried like in buildings.ini:

[BuildingTypes]
305=REDLAMP2
306=REDLAMP3

And the result was

[BuildingTypes]
...
400=REDLAMP2
401=REDLAMP3
402=YAPOWR
403=YACNST

which is a screw up I didn't expect. Probably #includes are for the complete list
to be moved into the new INI.

Earlier it crashed the game when using 0/1/2 indices.

Back to top
View user's profile Send private message
4StarGeneral
General


Joined: 14 Sep 2006
Location: Limbo

PostPosted: Wed Mar 14, 2018 5:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

With 0/1/2 you're replacing what's in 0/1/2 currently, for me replacing 0/1/2/3 with GAAIRC threw GACNST and GAPOWR to the bottom of the list and completely removed GAREFN from existance. Not something I would do normally anyway, so I don't think using numbers already in use would be smart.

_________________
"Don't beg for things; Do it yourself or you'll never get anything."

Back to top
View user's profile Send private message Send e-mail YouTube User URL
cxtian39
Commander


Joined: 11 Feb 2016

PostPosted: Wed Mar 14, 2018 7:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

In SP map the list starts with 0 and it's appended to the end of the list in rulesmd.
How Object Arrays Work says the left side of the equal side doesn't matter only the order of the list matters.
Looks like Ares #include breaks these rules and gives unexpected result.

_________________

Back to top
View user's profile Send private message Skype Account
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Wed Mar 14, 2018 9:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ares doesn't break the rule. The rule is and always was applied later and still works as before.

Before the list is parsed, meaning the game uses the right-hand-side value to make the ID known, #include is applied while the INI is still being read from the file. That is, before any line has any meaning.

And there, two tags with the same name are not allowed, because the results can be random (that is, random per player and per match). Ares implemented #include in a way to remove the old value and replace it with the new one*. That's why 0= ... cannot be "reused" in an included file and still keep both values.

Arrow To create lists that "merge" well, use the key "+". This will be replaced at runtime with a "free" key name, thus never overwrite an existing key.
(The feature apparently isn't documented, and I'll yet have to see why this is the case. If I can't find the reason, I'll properly document it.)

* "As each INI file is loaded, any flag that is encountered that has already been defined will have its value updated with the newly found value."

_________________

Back to top
View user's profile Send private message
hotrods20
Commander


Joined: 27 Jul 2009

PostPosted: Thu Mar 15, 2018 1:12 am    Post subject: Reply with quote  Mark this post and the followings unread

When you say use they key "+", do you mean,
Code:

[BuildingList]
+=NEWBUILD
+=NEWBUILDJR
+=NEWBUILDSR

and that will automatically use the latest ID?

Back to top
View user's profile Send private message
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Thu Mar 15, 2018 3:01 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, but rather look at it like a "unique" key name, it doesn't try to find consecutive numbers. The idea is that

+=ID1
+=ID2

will never collide, and thus fully support including INI files with lists.

_________________

Back to top
View user's profile Send private message
hotrods20
Commander


Joined: 27 Jul 2009

PostPosted: Thu Mar 15, 2018 3:12 am    Post subject: Reply with quote  Mark this post and the followings unread

That's awesome! Now I can use that with my game improvements and zombie mod without them conflicting. Thanks for all the awesome stuff you do! Followup question if you don't mind, does AImd and ARTmd support included files? I tested it for ARTmd but it didn't work unless I messed up.

Back to top
View user's profile Send private message
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Sat Mar 17, 2018 11:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thank you! Smile

I've heard it's only supported for rulesmd.ini, though I don't know why. It looks quite universal to me. I'll have to look whether it's supposed to support other INIs.

_________________

Back to top
View user's profile Send private message
cxtian39
Commander


Joined: 11 Feb 2016

PostPosted: Fri Apr 27, 2018 10:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

I noticed that there is a internal WeaponTypes list and it's used by some map trigger. If you define your own WeaponTypes list you will mess up the order since the game append those unregistered to the end? I discovered this when I edit allied campaign 6 where there is a trigger calls a weapon and it calls the wrong weapon if I define my own WeaponTypes list.

_________________

Back to top
View user's profile Send private message Skype Account
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Tue May 01, 2018 6:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

The type lists are added first, so indeed new things would go at the end. Ignoring the problem that the weapons cannot be added at the end of the list, because that would require them to be added after everything has been read and thus they themselves wouldn't be read because that phase is already over: changing this would break order for everyone.

Wouldn't it be possible to output the list of weapon types, then copy it into the WeaponTypes list to have a deterministic order?

_________________

Back to top
View user's profile Send private message
4StarGeneral
General


Joined: 14 Sep 2006
Location: Limbo

PostPosted: Tue May 01, 2018 10:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

I would imagine it's everything that's used by units and weedguy hacks, listed in order from top to bottom of rulesmd.ini; But it could also be completely random, so how could we dump that into a debug.txt?

_________________
"Don't beg for things; Do it yourself or you'll never get anything."

Back to top
View user's profile Send private message Send e-mail YouTube User URL
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Tue May 01, 2018 10:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

If you don't change anything, the order should always be the same. Ares added a Dump Types Keyboard Command. That's the way to go.

_________________

Back to top
View user's profile Send private message
4StarGeneral
General


Joined: 14 Sep 2006
Location: Limbo

PostPosted: Tue May 01, 2018 11:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well now I feel foolish for forgetting that dumps everything. 203 vanilla WeaponTypes and of course, they're all in a random order.

Unrelated oddity: changing LargeVisceroid= or SmallVisceroid= to a buildable or AllowedToStartInMultiplayer unit will make some start as a visceroid with special hard-coded logics and unit-size health bar and some not in a 25/75 ratio (of 30 tries using E1).



WeaponTypes.txt
 Description:

Download
 Filename:  WeaponTypes.txt
 Filesize:  3.13 KB
 Downloaded:  14 Time(s)


_________________
"Don't beg for things; Do it yourself or you'll never get anything."

Back to top
View user's profile Send private message Send e-mail YouTube User URL
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [14 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.1560s ][ Queries: 13 (0.0081s) ][ Debug on ]