Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for (Vic3/CK3) GUI files #109

Open
kaiser-chris opened this issue Dec 10, 2024 · 4 comments
Open

Support for (Vic3/CK3) GUI files #109

kaiser-chris opened this issue Dec 10, 2024 · 4 comments
Labels
cwt config related Need modify or extend cwt config enhancement New feature or request

Comments

@kaiser-chris
Copy link

kaiser-chris commented Dec 10, 2024

Hi,

I would love proper support for GUI files.
But I can understand if you are not interested.

As far as I know the GUI format is the same between Vic3 and CK3.
I haven't looked at other games.

GUI files are close to normal script files but different in a few ways.

Generally UI components could be defined by CWT:
https://ck3.paradoxwikis.com/Interface#UI_Components

Where things break is with Templates, Types and Block/Blockoverride:
https://ck3.paradoxwikis.com/Interface#Templates

One of the most painful things is creating functions.
Almost every field can be set using a complex function expression:

visible = "[And(Not(Battle.IsNavalBattle), Battle.IsNavalInvasion)]"

These can get quite long and complex:

visible = "[And3(ScriptedGui.IsShown(GuiScope.SetRoot(GetPlayer.MakeScope).End), Not(Technology.HasResearchedTech(GetPlayer.Self)), Or(Not(GetPlayer.MakeScope.Var('magic_research').IsSet), Not(ObjectsEqual(GetPlayer.MakeScope.Var('magic_research').GetTechnology.MakeScope, Technology.MakeScope))))]"

These functions are the same I referenced in #102 (Localisation commands).
Even just proper autocomplete/parsing/checking here would be massively helpful.

If you are interested I can provide example files and more edge cases.
Also I would create necessary configs for Victoria 3 if it is configurable.

Regards,

Chris

@DragonKnightOfBreeze DragonKnightOfBreeze added enhancement New feature or request cwt config related Need modify or extend cwt config labels Dec 11, 2024
@DragonKnightOfBreeze
Copy link
Owner

It's pretty complex and ... painful.

@kaiser-chris
Copy link
Author

It's pretty complex and ... painful.

Yeah I thought so.
So no problem if it does not happen.

@DragonKnightOfBreeze
Copy link
Owner

Where things break is with Templates, Types and Block/Blockoverride:

These special blocks can be treat as variants of parameter condition blocks, but only allowed in gui files, and, should modify the lexer and the parser (otherwise simply parse these keywords as strings). It's still hard to me to implement, since I'm not very familiar about how the lexer and the parser works in IDEA.

isible = "[And(Not(Battle.IsNavalBattle), Battle.IsNavalInvasion)]"

Add support for localisation command containing argument-style links, like Var(XXX), should be simple.

But for this, in fact, it should be a snippet of C++/C# code, or some variation, existing cwt configs are helpless, since there are no scope transition during method / property invocation, no information of available methods and properties.

@DragonKnightOfBreeze
Copy link
Owner

If I had the ability to implement a parser and a lexer for a such complex language (It's pretty complex, not only simple txt files!),
in my opinion, It's better to put in my effort and time into support for another more popular game language,
which is not supported By JetBrains officially, or by third party plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwt config related Need modify or extend cwt config enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants