function UpdatePlants(){
for (let i=1000; i<$gameMap.events().length; i++)
{
if (!$gameMap.events()[i])
continue;
if (!this.getSelfVariableValue(1, i, 26))
this.setSelfVariableValue(1, i, 30, this.getSelfVariableValue(1, i, 30)-1);
else
{
this.setSelfVariableValue(1, i, 26, this.getSelfVariableValue(1, i, 26)-1);
this.setSelfVariableValue(1, i, 31, this.getSelfVariableValue(1, i, 31)-1);
}
['A', 'B', 'C', 'D'].forEach(letter => $gameSelfSwitches.setValue([1, i, letter], false));
// Dead page?
if (this.getSelfVariableValue(1, i, 26)<0)
$gameSelfSwitches.setValue([1, i, 'A'], true);
else if (this.getSelfVariableValue(1, i, 31)<=0 && this.getSelfVariableValue(1, i, 31)>=-4)
{
// Watered seeds page?
if (this.getSelfVariableValue(1, i, 26))
$gameSelfSwitches.setValue([1, i, 'C'], true);
// Seeds growing page?
else
$gameSelfSwitches.setValue([1, i, 'B'], true);
}
// Second growth page?
if (this.getSelfVariableValue(1, i, 31)<-4 && this.getSelfVariable(1, i, 31)>=-9)
$gameSelfSwitches.setValue([1, i, 'D'], true);
// Second stage watered - you need to make a self switch for this
else
this.setSelfSwitchValue(1, i, ID, true);
}};