Little but annoying
-
Hello
I have some problem while I was trying to write little mod for eu4.I have some like that:
western = { major = yes potential = { capital_scope = { OR = { superregion = europe_superregion } } } allow = { OR = { AND = { has_dlc = "El Dorado" is_religion_reformed = yes } AND = { NOT = { has_dlc = "El Dorado" } has_institution = renaissance } } stability = 3 adm_power = 250 dip_power = 250 mil_power = 250 } effect = { add_adm_power = -250 add_dip_power = -250 add_mil_power = -250 add_stability = -3 if = { limit = { NOT = { technology_group = western } } change_technology_group = western change_unit_type = western } } ai_will_do = { factor = 1 } }
SO
My problem is:
While I’m try to fold “effect” (I’m writing it in .lua and later change to .txt) my “ai_will_do” get folded to.
So my question is: WHAT I WRITE WRONG?
Btw, if I do some like that:
effect = { add_adm_power = -250 add_dip_power = -250 add_mil_power = -250 add_stability = -3 if = { limit = { NOT = { technology_group = western } } change_technology_group = western change_unit_type = western } } } ai_will_do = { factor = 1 } }
Then it work. But there is one additional, needless (for me, I think) bracket.
Can anyone of you help?
-
I just ran some experiments: it may be because of your “
if = {}
” block…If I take this minimal example, everything folds correctly:
western = { effect = { iffin = { here = there } } ai_will_do = { factor = 1 } }
but if I change the one line to
if
instead ofiffin
,western = { effect = { if = { here = there } } ai_will_do = { factor = 1 } }
then it doesn’t fold correctly. But I see that it starts another fold-block on the
if
– so I guessed (not knowing Lua) thatif
-syntax has a special ending in Lua. Finding https://www.lua.org/pil/4.3.1.html seems to confirm that, so when I try:western = { effect = { if = { here = there } end } ai_will_do = { factor = 1 } }
… then it goes back to folding as expected.
Are you sure that
if = { ... }
is a valid Lua construct? Once again, I don’t know Lua, so it may be okay. If it is not okay, then the Lua lexer is properly interpreting that there should be another fold block you’ve not closed.If it is valid, then it looks like it is a bug. Unfortunately, that bug would be in the lua lexer in the Scintilla component that Notepad++ uses. NPP doesn’t often update it’s Scintilla component: Scintilla is a separate project, at v4.1.3↗, whereas it appears that the last time NPP updated Scintilla was to v3.56 back in June 2015↗ – so you’d have to go find out whether or not Scintilla has already fixed that bug: if they have, you’d have to lobby↗ for NPP to update to a modern Scintilla, or to at least patch the NPP copy of LuxLua.cxx. If that bug does still exist in Scintilla, then you would have to write a bug report for Scintilla (checking first whether the report already exists), then wait for it to get fixed there, then lobby NPP for the update or patch.
Hopefully, it really is a “little” problem for you. Or even better, you could come up with a better name than
if
for that element of the structure you showed. -
oooooooo facepalm
u are right I don’t remember that when i use “if” in .lua i need to “end” it
and it don’t get valid (for .lua) ending because it’s structure for game engine (in .txt)
so yee if will fold in wrong way _______thanks :))