Plant Care by adamtwelve

Description: Harvest plant, plant a new one, estimate and set soil and water.

1#PlantCare by AdamTwelve
2#
3#This script will inventory all planters within range then: 
4#    Harvest any plants that are ready
5#    Plant seeds in empty planters (seed prioritization is a work in progress)
6#    Taste ID for Heat, Water, and Soil
7#    Add dirt and water to estimated amounts
8#    
9#Requirements:
10#    Planters in range
11#    Water tile or source within range
12#    Seeds, planters spade and dirt in backpack
13    
14overhead 'select 1 type of seeds to plant'
15setvar seeds
16
17
18clearignore
19clearlist pots
20createlist pots
21setvar globaltimeout 1100
22
23
24//createlist of all pots in range
25while findtype 6327|6328|6330|4551|6341|28987 true -1 -1 -1 as pot
26    setvar foundpot pot
27    if not inlist pots foundpot
28        pushlist pots foundpot
29        ignore pot
30    endif
31endwhile
32
33
34//harvest if ready
35overhead 'checking for ready plants'
36foreach x in pots
37    dclick x
38    waitforgump 3224608375
39    pause globaltimeout
40    if ingump 'Ready to Harvest' any
41        overhead 'harvesting plant'
42        gumpresponse 2
43        pause globaltimeout
44    endif
45    pause globaltimeout
46endfor
47
48
49//plant seed if needed
50overhead 'planting seeds in empty pots'
51if find seeds backpack -1 -1 -1
52foreach x in pots
53    dclick x
54    waitforgump 3224608375
55    pause globaltimeout
56    if ingump 'No Seed' any
57        overhead 'planting seed'
58        gumpresponse 2
59        pause globaltimeout
60        target seeds backpack -1 -1 -1
61     endif
62endfor
63else
64  overhead 'no seeds in backpack' 33
65endif
66        
67//TasteID all pots
68overhead 'Estimating ideal heat, water, and soil'
69if findtype 'spade' backpack -1 -1 -1
70foreach x in pots
71    dclick x
72    waitforgump 
73    pause globaltimeout
74    gumpresponse 3
75    waitforgump 3224608375
76    pause globaltimeout
77    gumpresponse 4
78    waitforgump 3224608375
79    pause globaltimeout
80    gumpresponse 5
81    waitforgump 3224608375
82    pause globaltimeout
83endfor
84else
85    overhead 'no planters spade found' 33
86endif
87
88
89// add dirt and water to estimated amounts
90//fill water each time (requires water tile or other source)
91overhead 'adding water and soil'
92if findtype 'watering can' backpack -1 -1 -1 and findtype 'dirt patch' backpack -1 -1 -1
93foreach x in pots
94//make sure seed exists.
95#if ingump 'No Seed Currently'
96#    overhead 'no seed'
97#    break
98#endif
99
100//water
101dclicktype 'watering can' backpack -1 -1 -1
102pause globaltimeout
103dclick x
104waitforgump 
105pause globaltimeout
106gumpresponse 2 3224608375
107waitfortarget
108waitforgump 3224608375
109targettype 'watering can' backpack -1 -1 -1
110waitforgump 3929333591
111pause globaltimeout
112gumpresponse 2 3929333591
113pause globaltimeout
114//dirt
115gumpresponse 2 3224608375
116waitforgump 
117pause globaltimeout
118targettype 'dirt patch' backpack -1 -1 -1
119waitforgump 4024474571
120pause globaltimeout
121gumpresponse 2 4024474571
122pause globaltimeout
123gumpclose
124gumpclose
125endfor
126else
127    overhead 'missing water or soil' 33
128endif
129
130overhead 'all done' 99