This is the process used for determining a condition for Victor's Auto States https://victorscripts.wordpress.com/rpg-maker-vx-ace/gameplay-scripts/state-auto-apply/ :
def apply_state_custom?(notes) eval("#{notes.gsub(/\r\n/i, ";")}") rescue false end(only the eval process is relevant here)
This script has been very useful for me.
If my condition were
self.state?(10);rand(100) <= 50;then the condition would be true if the subject has State 10, to which the new state would be applied at a 50% chance.
It separates multiple conditions by semicolons.
Now, that's nice because you don't have to do a bunch of and-s or &&-s if you don't like those.
Although
self.state?(10) && rand(100) <= 50;is still technically valid.
But what that also means is that you can't do data processing before the final condition, like, for example,
value = rand(20)+1; if value == 1 then true elsif value == 20 then false else value <= 10 end;Where you essentially roll a 20-sided die and if you roll a 20 then you surpass a condition, if you roll a 1 then you automatically succumb to a state, and elsewise you have about a 50-50 chance to get the state inflicted.
And oddly, things like (#{if 2 > 1 then 50 end}) don't work, so I can't use that as workaround.
I would like either to modify the eval process or find a workaround to either successfully allow for prior data processing or negate the multiple-conditions-separated-by-semicolons and instead just have it be one big formula, like most conditional formula scripts do.
Could I ask for help? I'm unsure how to modify the process myself, and the creator of the script is long inactive.
def apply_state_custom?(notes) eval("#{notes.gsub(/\r\n/i, ";")}") rescue false end(only the eval process is relevant here)
This script has been very useful for me.
If my condition were
self.state?(10);rand(100) <= 50;then the condition would be true if the subject has State 10, to which the new state would be applied at a 50% chance.
It separates multiple conditions by semicolons.
Now, that's nice because you don't have to do a bunch of and-s or &&-s if you don't like those.
Although
self.state?(10) && rand(100) <= 50;is still technically valid.
But what that also means is that you can't do data processing before the final condition, like, for example,
value = rand(20)+1; if value == 1 then true elsif value == 20 then false else value <= 10 end;Where you essentially roll a 20-sided die and if you roll a 20 then you surpass a condition, if you roll a 1 then you automatically succumb to a state, and elsewise you have about a 50-50 chance to get the state inflicted.
And oddly, things like (#{if 2 > 1 then 50 end}) don't work, so I can't use that as workaround.
I would like either to modify the eval process or find a workaround to either successfully allow for prior data processing or negate the multiple-conditions-separated-by-semicolons and instead just have it be one big formula, like most conditional formula scripts do.
Could I ask for help? I'm unsure how to modify the process myself, and the creator of the script is long inactive.