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 Apr 18, 2024 2:00 am
All times are UTC + 0
String replacement in INI reading
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
Parasite03
Cyborg Artillery


Also Known As: ZivDero
Joined: 23 Jul 2013
Location: Russia

PostPosted: Mon Apr 07, 2014 12:41 pm    Post subject:   Reply with quote  Mark this post and the followings unread

Also ,how about simplyfying the Locomotor= tag? All these CLSIDs are unconvenient and something like Locomotor=Fly/FallingObject/Hover/Whatever would be nice to have along with the CLSIDs so the game doesn't break if there are still old values.

_________________
DarkVen9109 wrote:
What in the name of insanity is this? I FRICKING LOVE THIS LOGICCCC!!!!!!!!!!!!OOOOOOOOHEEAWWWWWWWWWWWYAAAAAAAAAAAAAAAAAWWWWWW PEW PEW PEW PEW BOOM BOOM BOOM!! Nice I love this!!!! Ferriswheel bomb, Dive bomb. New Logic discovered thanks to Kenosis Very Happy

_________________

Back to top
View user's profile Send private message
Josh Is 25% Larger
Vehicle Drone


Joined: 17 Apr 2013

PostPosted: Mon Apr 07, 2014 12:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

An even more better way is to create variables in your ini.

Code:
;Some where in rulesmd.ini

[Vars]
flyloc="{4A582746-9839-11d1-B709-00A024DDAFD1}"
allFactories="GAWEAP,NAWEAP,YAWEAP"


And can be used like this:

Code:
[SomeAircraft]
...
Locomotor=flyloc

And:
Code:
[SecretTank]
Prerequisite=allFactories


Basically, before parsing the ini files, all the occurrences of "flyloc" is replaced with its value, and all the occurrences  of "allFactories" is replaced with its value.

Just basic string operations before parsing, should be piss-easy.

A great way to reduce duplicated code imo.

Back to top
View user's profile Send private message
Parasite03
Cyborg Artillery


Also Known As: ZivDero
Joined: 23 Jul 2013
Location: Russia

PostPosted: Mon Apr 07, 2014 1:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

No need for such thing. Ares has Generic Prerequisite Groups(I personally have 2 conyards, some need any and some need the specific one, when I need any - I use SOVCNST, when I need a specific one - I use NACNST)

_________________
DarkVen9109 wrote:
What in the name of insanity is this? I FRICKING LOVE THIS LOGICCCC!!!!!!!!!!!!OOOOOOOOHEEAWWWWWWWWWWWYAAAAAAAAAAAAAAAAAWWWWWW PEW PEW PEW PEW BOOM BOOM BOOM!! Nice I love this!!!! Ferriswheel bomb, Dive bomb. New Logic discovered thanks to Kenosis Very Happy

_________________

Back to top
View user's profile Send private message
Josh Is 25% Larger
Vehicle Drone


Joined: 17 Apr 2013

PostPosted: Mon Apr 07, 2014 2:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

Generic prerequisites are limited to prerequisite.

This is meant to be working with everything, like the stuff you suggested for locomotors.

So I dont know why you say "No need for such thing" when my "thing" addressed your issue.

Back to top
View user's profile Send private message
Nikademis Von Hisson
General


Joined: 05 Sep 2007
Location: Wilkes Barre PA

PostPosted: Mon Apr 07, 2014 4:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Josh Is 25% Larger wrote:
An even more better way is to create variables in your ini.

Code:
;Some where in rulesmd.ini

[Vars]
flyloc="{4A582746-9839-11d1-B709-00A024DDAFD1}"
allFactories="GAWEAP,NAWEAP,YAWEAP"


And can be used like this:

Code:
[SomeAircraft]
...
Locomotor=flyloc

And:
Code:
[SecretTank]
Prerequisite=allFactories


Basically, before parsing the ini files, all the occurrences of "flyloc" is replaced with its value, and all the occurrences  of "allFactories" is replaced with its value.

Just basic string operations before parsing, should be piss-easy.

A great way to reduce duplicated code imo.





you want a vehicle to be built by all countries?

_________________
I am authorized to send out the TMP Studio, PM ME IF YOU WANT IT And check this out, these were sent to me for help with terrain and zdata help along with TMP Studio/Builder

http://www.ppmsite.com/forum/viewtopic.php?t=27714

Back to top
View user's profile Send private message Send e-mail Skype Account
Parasite03
Cyborg Artillery


Also Known As: ZivDero
Joined: 23 Jul 2013
Location: Russia

PostPosted: Mon Apr 07, 2014 5:18 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh, I finally got him. He wants to reduce things to write, so if there is a variable named UN that equals to "UIName=Name" and if I write UN:SHK, its shoudl result in replacing UN with UIName=Name

_________________
DarkVen9109 wrote:
What in the name of insanity is this? I FRICKING LOVE THIS LOGICCCC!!!!!!!!!!!!OOOOOOOOHEEAWWWWWWWWWWWYAAAAAAAAAAAAAAAAAWWWWWW PEW PEW PEW PEW BOOM BOOM BOOM!! Nice I love this!!!! Ferriswheel bomb, Dive bomb. New Logic discovered thanks to Kenosis Very Happy

_________________

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


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Mon Apr 07, 2014 5:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Josh Is 25% Larger wrote:
Just basic string operations before parsing, should be piss-easy.

A great way to reduce duplicated code imo.


Parsing as-is will be faster than your method.

_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
Parasite03
Cyborg Artillery


Also Known As: ZivDero
Joined: 23 Jul 2013
Location: Russia

PostPosted: Tue Apr 08, 2014 4:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

I don't understand how my comment ended up in this split. My comment was not about string relacement but about simplyfying 1 specific tag to allow non-CLSID locomotors.

_________________
DarkVen9109 wrote:
What in the name of insanity is this? I FRICKING LOVE THIS LOGICCCC!!!!!!!!!!!!OOOOOOOOHEEAWWWWWWWWWWWYAAAAAAAAAAAAAAAAAWWWWWW PEW PEW PEW PEW BOOM BOOM BOOM!! Nice I love this!!!! Ferriswheel bomb, Dive bomb. New Logic discovered thanks to Kenosis Very Happy

_________________

Back to top
View user's profile Send private message
Nikademis Von Hisson
General


Joined: 05 Sep 2007
Location: Wilkes Barre PA

PostPosted: Tue Apr 08, 2014 5:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

Parasite03 wrote:
I don't understand how my comment ended up in this split. My comment was not about string relacement but about simplyfying 1 specific tag to allow non-CLSID locomotors.




it was probably moved by an Admin.

_________________
I am authorized to send out the TMP Studio, PM ME IF YOU WANT IT And check this out, these were sent to me for help with terrain and zdata help along with TMP Studio/Builder

http://www.ppmsite.com/forum/viewtopic.php?t=27714

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


Joined: 31 May 2010
Location: Germany

PostPosted: Tue Apr 08, 2014 5:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

Because it is a similar request. Locomotor=Drive with "Drive" being hardcoded is conceptually the same as Drive being just one of several user defined values. The general one supercesed your request completely. If enough people concur that Locomotor= and Locomotor= alone should be expanded this way, I'll come up with a system for that, though.

Also, this request is new, and it appears to me as an unnecessary feature. The old system works. Modders gain nothing new that isn't possible today. A very valid workaround for this feature is just using the current style. It has no downsides compared to this.

Just use:
Locomotor={VERYLONG-LONG-LONG-LONG-CODEBARF} ; Human-readable Description

The full replacement is of not much help either. Editors can't understand it, people might have to jump to the definitions to actually see what a replacement string does. And in case of yes=no, it does way more harm than it could possibly do good.

_________________

Back to top
View user's profile Send private message
Josh Is 25% Larger
Vehicle Drone


Joined: 17 Apr 2013

PostPosted: Wed Apr 09, 2014 9:12 am    Post subject: Reply with quote  Mark this post and the followings unread

RP wrote:
Josh Is 25% Larger wrote:
Just basic string operations before parsing, should be piss-easy.

A great way to reduce duplicated code imo.


Parsing as-is will be faster than your method.


True. But then you wont get the to use variables.

Whats your IQ?

Anyway, if people are interested, I could write a small independent program that would upon launch parse any type of text file(customizable), replace all the all variable names with its corresponding value, place a copy of the file(s) in a given directory and then launch a file(the game).

This means you have to use the program every time you want to start your game. But when you later release your mod, you just include the generated (ini) file instead of the one with variables.
The goal of the program is that it should be really fast.

Btw I dont think AlexB argument 'yes=no' is valid. If someone is that stupid, then its their own faults.

Last edited by Josh Is 25% Larger on Wed Apr 09, 2014 12:23 pm; edited 1 time in total

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


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Wed Apr 09, 2014 10:18 am    Post subject: Reply with quote  Mark this post and the followings unread

My IQ is probably higher than yours because you need such a silly replacement system.

Regarding AlexB's argument, you are too shortminded in your response. He just gave an example, a trivial one, there are hundreds of other errors that pop up with this 'feature'.

No-one wants it, no-one needs it. Except for you and Parasite03 (which says enough)

_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
Graion Dilach
Defense Minister


Joined: 22 Nov 2010
Location: Iszkaszentgyorgy, Hungary

PostPosted: Wed Apr 09, 2014 11:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Josh Is 25% Larger wrote:
Whats your IQ?

Claiming your own right just because of your 'suppsed-to being higher IQ' is not a reason, but a sign of a boosted ego.

On the other hand, many people with actual high IQ are indeed egoistic as hell, so you might have a higher IQ.

Josh Is 25% Larger wrote:
Btw I dont think AlexB argument 'yes=no' is not valid. If someone is that stupid, then its their own faults.

lolz. If the system allows to headshot itself, then it's a bad system, regardless of userbase.

Parsing itself is already a complicated task... such preprocessors should not be a part of an INI reader at all.

Not to mention, you can already decrease duplicated code by using the clone feature pd added (which is undocumented due to only working in included ini-files).

_________________
"If you didn't get angry and mad and frustrated, that means you don't care about the end result, and are doing something wrong." - Greg Kroah-Hartman
=======================
Past C&C projects: Attacque Supérior (2010-2019); Valiant Shades (2019-2021)
=======================
WeiDU mods: Random Graion Tweaks | Graion's Soundsets
Maintainance: Extra Expanded Enhanced Encounters! | BGEESpawn
Contributions: EE Fixpack | Enhanced Edition Trilogy | DSotSC (Trilogy) | UB_IWD | SotSC & a lot more...

Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID
Parasite03
Cyborg Artillery


Also Known As: ZivDero
Joined: 23 Jul 2013
Location: Russia

PostPosted: Wed Apr 09, 2014 12:18 pm    Post subject: Reply with quote  Mark this post and the followings unread

RP wrote:
Except for you and Parasite03 (which says enough)

Hey! I never stated that  I like the variables ideat because doing so will break the game.
I just claim that that would be nice if CLSID were not so. Alex has his own mind and if he thinks it will be better to leave this idea - then he does so.
Again, I do not support the variables.
BTW it eould be funny if yes=no loopen and replaced yes with no and backwards Very Happy

_________________
DarkVen9109 wrote:
What in the name of insanity is this? I FRICKING LOVE THIS LOGICCCC!!!!!!!!!!!!OOOOOOOOHEEAWWWWWWWWWWWYAAAAAAAAAAAAAAAAAWWWWWW PEW PEW PEW PEW BOOM BOOM BOOM!! Nice I love this!!!! Ferriswheel bomb, Dive bomb. New Logic discovered thanks to Kenosis Very Happy

_________________

Back to top
View user's profile Send private message
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.1616s ][ Queries: 11 (0.0078s) ][ Debug on ]