It's done:
https://github.com/Hudell/hudell-farm/blob/master/HudellFarm.rb
To use it, you will need to configure all your crops in the top of the file:
@maps = [ 2]This is a list of maps where the script should run. Just replace the number 2 for the ID of the map where you have your farm. You can add more than one using commas.
@graphicsConfig = { 100 => { 0 => { :dry => { :spriteName => 'crops', :spriteIndex => 0, :direction => 2,

attern => 1 }, :wet => { :spriteName => 'crops', :spriteIndex => 0, :direction => 4,

attern => 1 } }, 4 => { :dry => { :spriteName => 'crops', :spriteIndex => 1, :direction => 2,

attern => 0 }, :wet => { :spriteName => 'crops', :spriteIndex => 1, :direction => 4,

attern => 1 } } }}
This is the configuration for one type of crop.
100 is the code of the crop, you can add any multiple of 100 you want (there's no limit)
0 and 4 are the stage the crop is in. When the variable value is between 100 and 103, it will use the "0" configuration. When the variable value is between 104 and 199, it will use the "4" configuration. You can add as many as you want.
Inside the stage, there is the :dry and :wet configuration, I believe no explanation is needed here.
Then we finally have the graphic information:
:spriteName is the name of the spriteset.
:spriteIndex is the index inside that spriteset (0 to 7)
:direction is the direction of the sprite (2 = first row, 4 = second row, 6 = third row, 8 = fourth row)

attern is the movemtn pattern of the sprite (0 = first column, 1 = second column, 2 = third column)
How the code works:
If a variable value is, let's say: 307, the code will work like this:
It will check if there's any configuration for a crop with the code 300. If there's not, it will cancel the update. If there is, it will continue:
Then, inside the crop 300 config, it will check if there is a "7". If there is not, it will search for a "6", then a "5", all the way to "0", until it finds something.
When it finally finds the right config, it will update the event graphic using the information it finds.
How to setup the events:
All you need to do is add this in the event name:
[farm=15,30]replace 15 with the index of the variable that should be used by that event and replace 30 with the index of the switch that should be used to indicate if the crop is wet or not.
All events on the map will automatically be updated when you enter the map. If you need to update it manually, there's three ways to do it:
Code:
HudellFarm::updateCurrentEvent
If you put this line of script inside an event, it will update itself.
Code:
HudellFarm::updateEventById(50)
This will update the graphic of the event 50.
Code:
HudellFarm::updateMapEvents
This will update all crops in the current map.
If you are in the farm map, simply changing the variable value will not update the graphic, you have to call one of those three script lines.
You are free to use this script however you want. Let me know if there's any problem with it.