Is it at all possible to define our own variables and classes? Like, rather than having to be limited to piggy-backing off of pre-existing variables/classes, are we able to create our own? If so, then how?
I only know of set_variable check_variable change_variable, but even there get_variable seems to be missing.
There is also save_event_target_as and something with parameter, but I didn't use that yet.
pc_desert = {
set_variable:testVar = {
3
}
}
Oh and the closest thing to custom functions, is scripted_triggers where you can outsource often used code blocks and call it by a single line.
It's looks like this:
Code:set_variable = { which = "iSampleVar" value = 1 }
scripted_triggers Is still the same language, just outsourcing from one file to another. And it can only be 'functions' that return true/false used for conditions/triggers.
You probably can not define custom glasses.
I mean the substract/multiply/divide functions or for example setting variable X to equal variable Y.A reference to another variable in same scope: (set|change|subtract|multiply|divide)_variable = { which = <variable_name> which = <another_variable_name> }
I found this entry in the CK2 modding wiki but I don't see it used anywhere in Stellaris files. Does anyone know if this works?
I mean the substract/multiply/divide functions or for example setting variable X to equal variable Y.
ATM only variable related commands are set_variable and chech_variable, and in both you can only use values, not variables (so you can't compare two values). @Divine said he might take a look at implementing CK2 variable commands (which would be very useful).
Yeah, I meant a number. Sorry.
I found this entry in the CK2 modding wiki but I don't see it used anywhere in Stellaris files. Does anyone know if this works?
I mean the substract/multiply/divide functions or for example setting variable X to equal variable Y.
check_variable = {
which = testVar
value >= testVarMax
}
Is this possible?
Code:check_variable = { which = testVar value >= testVarMax }
Since it is a normal variable (albeit confined to numbers) I imagine that it'd still work in such a way.
I think it has to be 'value > x' where x is an actual number.
If > works, then I imagine that >= works as well. Not only that, but the testVarMax is a number var, so yet again, I imagine that it would work. I haven't actually gotten to test it since I haven't created the means of displaying it, but I'm hoping that using the max var will work. If not, then there needs to be some SERIOUS changes to the modding engine.
That would be logical but it's safe to assume that anything that you don't see used in the Stellaris files doesn't work. I've used workarounds to get past some of the limitations but without at least being able to compare one variable to another, I'm not sure I can solve the problem I have.
What exactly were these workarounds?