<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Little but annoying]]></title><description><![CDATA[<p dir="auto">Hello<br />
I have some problem while I was trying to write little mod for eu4.</p>
<p dir="auto">I have some like that:</p>
<pre><code>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	
	}
}
</code></pre>
<p dir="auto">SO</p>
<p dir="auto">My problem is:</p>
<p dir="auto">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.</p>
<p dir="auto">So my question is: WHAT I WRITE WRONG?</p>
<p dir="auto">Btw, if I do some like that:</p>
<pre><code>	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	
	}
}
</code></pre>
<p dir="auto">Then it work. But there is one additional, needless (for me, I think) bracket.</p>
<p dir="auto">Can anyone of you help?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16961/little-but-annoying</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 04:18:54 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16961.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Jan 2019 13:12:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Little but annoying on Thu, 17 Jan 2019 15:20:06 GMT]]></title><description><![CDATA[<p dir="auto">oooooooo facepalm</p>
<p dir="auto">u are right I don’t remember that when i use “if” in .lua i need to “end” it</p>
<p dir="auto">and it don’t get valid (for .lua) ending because it’s structure for game engine (in .txt)<br />
so yee if will fold in wrong way _______</p>
<p dir="auto">thanks :))</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38619</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38619</guid><dc:creator><![CDATA[Arya Svit&#x27;kona]]></dc:creator><pubDate>Thu, 17 Jan 2019 15:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to Little but annoying on Thu, 17 Jan 2019 14:26:45 GMT]]></title><description><![CDATA[<p dir="auto">I just ran some experiments: it may be because of your “<code>if = {}</code>” block…</p>
<p dir="auto">If I take this minimal example, everything folds correctly:</p>
<pre><code>western = {
    effect = {
        iffin = {
            here = there
        }
    }

    ai_will_do = {  
        factor = 1  
    }
}
</code></pre>
<p dir="auto">but if I change the one line to <code>if</code> instead of <code>iffin</code>,</p>
<pre><code>western = {
    effect = {
        if = {
            here = there
        }
    }

    ai_will_do = {  
        factor = 1  
    }
}
</code></pre>
<p dir="auto">then it doesn’t fold correctly.  But I see that it starts another fold-block on the <code>if</code> – so I guessed (not knowing Lua) that <code>if</code>-syntax has a special ending in Lua.  Finding <a href="https://www.lua.org/pil/4.3.1.html" rel="nofollow ugc">https://www.lua.org/pil/4.3.1.html</a> seems to confirm that, so when I try:</p>
<pre><code>western = {
    effect = {
        if = {
            here = there
        }
        end
    }

    ai_will_do = {  
        factor = 1  
    }
}
</code></pre>
<p dir="auto">… then it goes back to folding as expected.</p>
<p dir="auto">Are you sure that <code>if = { ... }</code> 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.</p>
<p dir="auto">If it is valid, then it looks like it is a bug.  Unfortunately, that bug would be in the lua lexer in the <a href="https://www.scintilla.org/" rel="nofollow ugc">Scintilla</a> component that Notepad++ uses.  NPP doesn’t often update it’s Scintilla component:  Scintilla is a separate project, at v4.1.3<a href="https://www.scintilla.org/ScintillaDownload.html" rel="nofollow ugc">↗</a>, whereas it appears that the last time NPP updated Scintilla was to v3.56 back in June 2015<a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/lexers/LexLua.cxx" rel="nofollow ugc">↗</a> – 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<a href="https://notepad-plus-plus.org/community/topic/15741/faq-desk-feature-request" rel="nofollow ugc">↗</a> for NPP to update to a modern Scintilla, or to at least patch the NPP copy of <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/lexers/LexLua.cxx" rel="nofollow ugc">LuxLua.cxx</a>.  If that bug <em>does</em> still exist in Scintilla, then you would have to write a <a href="https://sourceforge.net/p/scintilla/bugs/" rel="nofollow ugc">bug report for Scintilla</a> (checking first whether the report already exists), then wait for it to get fixed there, then lobby NPP for the update or patch.</p>
<p dir="auto">Hopefully, it really is a “little” problem for you.  Or even better, you could come up with a better name than <code>if</code> for that element of the structure you showed.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38616</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38616</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 17 Jan 2019 14:26:45 GMT</pubDate></item></channel></rss>