-
Notifications
You must be signed in to change notification settings - Fork 0
/
harvest.ts
144 lines (121 loc) · 2.57 KB
/
harvest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#ore harvester
:vars
setVar $count 1
setVar $script "(harvester)"
setVar $scriptname "$playerName's ore harvester"
setVar $torp 20
setvar $det 20
setVar $torp_max 20
setVar $det_max 20
setVar $total_moved 0
:main
getWord CURRENTLINE $location 1
if ($location <> "Command")
echo "*not command prompt*"
halt
end
:get_input
echo "*enter planet to ore/base planet*"
getconsoleinput $base_planet
echo "*enter sector*"
getconsoleinput $base_sector
echo "*how much ore to move?*"
getconsoleinput $limit
:get_info
echo "*START WITH FULL TORPS/DETS*"
:launch
killalltriggers
send " u y * ::ore::* c "
setVar $torp ($torp - 1)
:land
send "l"
waitFor "Registry# and"
setTextLineTrigger 1 :planet "::ore::"
pause
:planet
killalltriggers
setVar $line CURRENTLINE
getWord $line $target_planet 2
stripText $target_planet ")"
stripText $target_planet ">"
send $target_planet "*"
:chk_values
setTextLineTrigger chk_fuel :chk_fuel "Fuel Ore"
pause
:chk_fuel
killalltriggers
setVar $line CURRENTLINE
getWord $line $ore 6
stripText $ore ","
if ($ore <> 0)
goto :move_product
else
goto :det
end
:det
killalltriggers
send " z d y "
setVar $det ($det - 1)
setTextTrigger destroyed :destroyed "For blowing up this planet"
pause
:destroyed
killalltriggers
if ($torp < 2) OR ($det = 0)
goto :refill
end
goto :launch
:move_product
setVar $loops ($ore / 255)
setVar $count 1
:move_loop
killalltriggers
if ($count <= $loops)
send "t n t 1 * q l " $base_planet " * t n l 1 * q l " $target_planet " * "
add $count 1
setDelayTrigger move_pause :move_loop 100
pause
end
setVar $total_moved ($total_moved + $ore)
if ($total_moved > $limit)
echo "*ore moved, halting*"
halt
end
setvar $count 1
goto :det
:refill
killalltriggers
setVar $torps_needed ($torp_max - $torp)
setVar $dets_needed ($det_max - $det)
send " j y "
send " l " $base_planet " * t n t 1 * q "
setVar $dock STARDOCK
send " m " $dock " * "
:torp
send "p s h t"
setTextTrigger 1 :chk1 ") [0] ?"
pause
:chk1
killalltriggers
setVar $line CURRENTLINE
getWord $line $torpnum 9
stripText $torpnum ")"
send $torpnum "*"
setVar $torp 20
:det
send "a"
setTextTrigger 2 :chk2 ") [0] ?"
pause
:chk2
killalltriggers
setVar $line CURRENTLINE
getWord $line $detnum 9
stripText $detnum ")"
send $detnum "*"
setVar $det 20
:return
send " q q m " $base_sector " * y y "
setTextTrigger returned :returned "Command [TL=00:00:00]:[" & $base_sector & "]"
pause
:returned
killalltriggers
goto :launch