Author Topic: idea: conditional table parsing  (Read 2327 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
idea: conditional table parsing
you know how in c you can use macros to blot out sections of code you need disabled or select from a series of code blocks based on some option? what if we could do that with tables?

often modders end up working across multiple versions of the engine during the course of mod development. say you want to use features in an experimental build, but still do most of your deving under stable. you ususally end up getting the way you want them and then commenting them out until they hit trunk. what about we do something like:

$tried and true setting that works in stable build: 42
?ifvers: 3.6.13
$tag that works in only in 3.6.13 and should be ignored everywhere else: 69
?endif
?ifhighervers: 3.6.13
$tag that only works in builds after 3.6.13: 3.14159
?endif
?iflowervers: 3.6.12
$tag that was deprecated after 3.6.12 and shouldnt be used anymore: "your mom"
?endif

the syntax starts with some character that would otherwise be treated as a comment and skipped such as, "?" (i used ? but it could just as easily be an @ or a &), followed by the comparation type:
if: true if values match
ifnot: true if values do not match
ifgreater: true if value is higher than attribute
iflesser: true if value is lower than attribute

the next part defines the attribute that is being checked against. i used the games version number (the short version, in practice the long version would be better). i figure you might also want mediavp version, or versions from other mods you are using. this would be followed by the ":" character and then the value which would be parsed as a string and handled differently depending on the attribute name.

so we got:

"?"+comparation type+attribute name+":"+value
;text block containing table tags
?end

and if the conditional statement is true, the text block is parsed, otherwise its treated as a comment and skipped. you might also do ?else and ?elseif statements, but those could be constructed from these primitives. just an idea, not gonna assume modders would understand or use this. many of them would likely go "wtf?!?". but for large scale mod projects deving off of multiple versions i think it would come in handy.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: idea: conditional table parsing
Doesn't something like this exist?

Like these version tags.
Code: [Select]
;;FSO 3.6.8;;
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline CommanderDJ

  • Software engineer
  • 210
    • Minecraft
Re: idea: conditional table parsing
Doesn't something like this exist?

Like these version tags.
Code: [Select]
;;FSO 3.6.8;;

I thought the semicolons in table files were... comments.
[16:57] <CommanderDJ> What prompted the decision to split WiH into acts?
[16:58] <battuta> it was long, we wanted to release something
[16:58] <battuta> it felt good to have a target to hit
[17:00] <RangerKarl> not sure if talking about strike mission, or jerking off
[17:00] <CommanderDJ> WUT
[17:00] <CommanderDJ> hahahahaha
[17:00] <battuta> hahahaha
[17:00] <RangerKarl> same thing really, if you think about it

 

Offline Iss Mneur

  • 210
  • TODO:
Re: idea: conditional table parsing
Doesn't something like this exist?

Like these version tags.
Code: [Select]
;;FSO 3.6.8;;

I thought the semicolons in table files were... comments.
They are, but a double semicolon with that pattern is treated as a conditional by new engines (3.6.10> IIRC), similar to what Nuke is proposing .  The reason that the current system uses the comment characters is because it allows older binaries (retail in particular) to still parse the table.  If I recall correctly, this is how Silent Thread: Reborn is able to remain retail compatible but still supporting some of the newer goodies.  I believe this is also how FRED implements the "compatibility modes" that are listed in the File menu.

Unfortunately I am not closely familiar with the details and I can't find a wiki page about it (I didn't look that hard though).  If you bug Goober5000 (the one that implemented it) or Karajorma they will be able to provide more information.

One problem with what Nuke proposes (beyond the fact that we already have as similar system) is what happens to binaries that don't understand the new syntax?  They will just fail if I understand what Nuke is proposing.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline z64555

  • 210
  • Self-proclaimed controls expert
    • Minecraft
    • Steam
Re: idea: conditional table parsing

One problem with what Nuke proposes (beyond the fact that we already have as similar system) is what happens to binaries that don't understand the new syntax?  They will just fail if I understand what Nuke is proposing.

Could you have the conditional bits of code "commented out" (so that retail thinks its just a comment?)
Secure the Source, Contain the Code, Protect the Project
chief1983

------------
funtapaz: Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Juche.
z64555: s/J/Do
BotenAlfred: <funtapaz> Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Douche.

 

Offline Iss Mneur

  • 210
  • TODO:
Re: idea: conditional table parsing

One problem with what Nuke proposes (beyond the fact that we already have as similar system) is what happens to binaries that don't understand the new syntax?  They will just fail if I understand what Nuke is proposing.

Could you have the conditional bits of code "commented out" (so that retail thinks its just a comment?)
Yea, which is how the currently implemented system works around that problem.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: idea: conditional table parsing
gotta love secret undocumented features :P
Doesn't something like this exist?

Like these version tags.
Code: [Select]
;;FSO 3.6.8;;

I thought the semicolons in table files were... comments.
They are, but a double semicolon with that pattern is treated as a conditional by new engines (3.6.10> IIRC), similar to what Nuke is proposing .  The reason that the current system uses the comment characters is because it allows older binaries (retail in particular) to still parse the table.  If I recall correctly, this is how Silent Thread: Reborn is able to remain retail compatible but still supporting some of the newer goodies.  I believe this is also how FRED implements the "compatibility modes" that are listed in the File menu.

Unfortunately I am not closely familiar with the details and I can't find a wiki page about it (I didn't look that hard though).  If you bug Goober5000 (the one that implemented it) or Karajorma they will be able to provide more information.

One problem with what Nuke proposes (beyond the fact that we already have as similar system) is what happens to binaries that don't understand the new syntax?  They will just fail if I understand what Nuke is proposing.

i figure if you check for the conditional character before comment are removed then you could comment out the conditional. you could also use a compound character like ;?.

some issues might crop up from using the same character which a majority of modders would interpret as just being a comment and not recognizing the pattern has significance. using a ;? ?; enclosure would be more intuitive, but would still be interpreted as a comment on older builds.

if anything id expand the current system to allow for build number in addition to version, and perhaps support some additional logic features (greater than, less than, not). unless of course those already exist.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: idea: conditional table parsing
gotta love secret undocumented features :P

inorite?

i figure if you check for the conditional character before comment are removed then you could comment out the conditional. you could also use a compound character like ;?.

some issues might crop up from using the same character which a majority of modders would interpret as just being a comment and not recognizing the pattern has significance. using a ;? ?; enclosure would be more intuitive, but would still be interpreted as a comment on older builds.
What's wrong with the current ;;FSO system? (Just curious why a change would be necessary on the syntax)

if anything id expand the current system to allow for build number in addition to version, and perhaps support some additional logic features (greater than, less than, not). unless of course those already exist.
Those additions could be useful.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: idea: conditional table parsing
no real reason to change the syntax if it works. it just doesnt seem intuitive is all. some modders might confuse it for a comment. im sure if the feature was documented better it would confuse modders less, and eliminate the need for any changes.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: idea: conditional table parsing
IIRC this was how FS1 music tables were made to work with FSO; I think it was FSO 3.6.8 or .9, I really can't remember.  Might even have been .7

EDIT: And, if you put a short description in each table, that would work for documentation, no?

;To use version-specific features, use a double semi-colon ( ;; ) at the beginning of the line
;followed by the version desired, e.g. ;;FreeSpace Open 3.6.8

Copy + paste something similar to that to all tables?

  

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
Re: idea: conditional table parsing

The ;;FSO tag does work in a greater than mechanic, fyi. If a feature is tagged as 3.6.8, it will only work in builds that are 3.6.8 or greater.
As for instituting a feature that will only operate on earlier builds, I can't exactly see why you would want to do that especially if it's been deprecated or converted to a newer feature function.

And yes, there are any number of "hypothetical" situations that could be thrown at that statement. But I can't think of anything (other than $Decals which didn't work even in .10) that got removed in such a way that it would cause any problems to require version tagging their entry to being pre-.10 loadable only, since people would be (at this time) using either .12 or .14 RC1.

In fact the only thing I could think of where it would be useful is in any changes to value types for conditions. I accidentally $Special Explosions: values for instance, which caused Axem no small amount of inconvenience, and that could have been avoided with a pre-version tag maybe, but that would have been an erroneous work-around and wouldn't have really addressed the larger problem presented by the change.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys