-
Notifications
You must be signed in to change notification settings - Fork 11
/
Casting.inc
666 lines (618 loc) · 15.6 KB
/
Casting.inc
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
button_names = {
"Heavy Lead Bowl",
"Monkey Wrench",
"Silver Bowl",
"Iron Cookpot",
"Anvil Bed",
"Fuel",
"Gearwork",
"Hardware",
"Tools"
};
fuel_button_names = {
"Orichalcum Pellets"
};
gearwork_button_names = {
"Medium Gear",
"Small Gear"
};
hardware_button_names = {
"Bearing",
"12 Washers",
"4 Bolts"
};
tools_button_names = {
"Heavy Mallet Head",
"Wide Tungsten Chisel",
"Round Hammer",
"Ball Peen Hammer",
"Shaping Mallet",
"Lead Mallet",
"Pewter Incense Prong"
};
----------------- MAKE PROJECTS 'SUPPORTING' FUNCTIONS -----------------
function waitMinutes(minutes)
-- Teppy Minute is 66 seconds or 66000 ms
-- Add a 3 second delay (3000 ms) in case of lag
wait_delay = 3000; -- Extra delay on top of Teppy Time, for lag purposes. Default is 3000
wait = (minutes * 66000) + wait_delay;
askForFocus(); -- Pause to allow user to focus back to ATITD (if they checked the Pause for Focus Box), before starting project.
end
function doneGUI(totalPasses)
wait = 5000; -- Gives a 5 second delay to review the GUI stats, before quitting/returing to Main Menu.
clickAllImages("This.png"); -- Refresh the screen. Update Casting box window so we know how much charcoal is currently in each box before next project
sleepWithStatusPause(wait, "[" .. totalPasses .. "/" .. totalPasses .. "] ALL DONE!\n----------------------------------------------\n[" .. made .. "/" .. batch*project_windows*num_loops .. "] " .. name .. " / Completed");
lsPlaySound("Complete.wav");
runCasting(); -- Return to/Display Main Menu
end
function waitGUI(pass)
--If any casting menus shows the Forge_StartFire.png - refreshWindows() function, then display the stalledMessage in the GUI. Suggests its not lit (or out of charcoal)
if #stalled > 0 then
stalledMessage = "\n[" .. #stalled .. "] CB\'s STALLED (Needs Lit)"
else
stalledMessage = "";
end
sleepWithStatusPause(wait, "[" .. pass .. "/" .. num_loops .. "] Total Passes\n----------------------------------------------\n[" .. batch .. "] " .. name .. " per CB\n[" .. project_windows .. "] CB\'s working" .. stalledMessage .. "\n----------------------------------------------\n[" .. batch*project_windows .. "] " .. name .. " per pass\n----------------------------------------------\n[" .. made .. "/" .. batch*project_windows*num_loops .. "] " .. name .. " / Completed");
made = made + (batch*project_windows);
end
function refreshWindows()
checkBreak();
pinned_windows = clickAllImages("This.png");
lsSleep(400);
if pinned_windows == 0 then
error("No pinned windows found!");
else
srReadScreen();
stalled = findAllImages("Forge/Forge_StartFire.png");
if #stalled == pinned_windows/2 then -- The /2 is because each box has 'This' located in window twice. Can't use ThisIs.png either because idle/working box has different words (Idle box shows 'This' only and Working box shows 'This Is'
error("No Casting Boxes are lit!");
end
end
end
----------------- MAKE PROJECT FUNCTIONS -----------------
function heavyleadbowl()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Heavy Lead Bowl";
waitMinutes(10);
for i=1, num_loops do
while 1 do
refreshWindows();
project_windows = clickAllImages("Casting/HeavyLeadBowl.png");
if project_windows == 0 then
sleepWithStatusPause(1500, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function monkeywrench()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Monkey Wrench";
waitMinutes(4);
for i=1, num_loops do
while 1 do
refreshWindows();
project_windows = clickAllImages("Casting/MonkeyWrench.png");
if project_windows == 0 then
sleepWithStatusPause(1500, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function silverbowl()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Silver Bowl";
waitMinutes(15);
for i=1, num_loops do
while 1 do
refreshWindows();
project_windows = clickAllImages("Casting/SilverBowl.png");
if project_windows == 0 then
sleepWithStatusPause(1500, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function ironcookpot()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Iron Cookpot";
waitMinutes(1);
for i=1, num_loops do
while 1 do
refreshWindows();
project_windows = clickAllImages("Casting/IronCookingPot.png");
if project_windows == 0 then
sleepWithStatusPause(1500, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function anvilbed()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Anvil Bed";
waitMinutes(3);
for i=1, num_loops do
while 1 do
refreshWindows();
project_windows = clickAllImages("Casting/AnvilBed.png");
if project_windows == 0 then
sleepWithStatusPause(1500, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function orichalcumpellets()
num_loops = promptNumber("How many passes ?", 1);
batch = 4;
name = "Orichalcum Pellet";
waitMinutes(.5);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Fuel.png");
lsSleep(400);
project_windows = clickAllImages("Casting/OrichalcumPellets.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function mediumgear()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Medium Gear";
waitMinutes(5);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Gearwork.png");
lsSleep(400);
project_windows = clickAllImages("Casting/MediumGear.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function smallgear()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Small Gear";
waitMinutes(1);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Gearwork.png");
lsSleep(400);
project_windows = clickAllImages("Casting/SmallGear.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function bearing()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Bearings";
waitMinutes(2);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Hardware.png");
lsSleep(400);
project_windows = clickAllImages("Casting/Bearing.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function washers()
num_loops = promptNumber("How many passes ?", 1);
batch = 12;
name = "Washers";
waitMinutes(2);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Hardware.png");
lsSleep(400);
project_windows = clickAllImages("Casting/12Washers.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function bolts()
num_loops = promptNumber("How many passes ?", 1);
batch = 4;
name = "Bolts";
waitMinutes(2);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Hardware.png");
lsSleep(400);
project_windows = clickAllImages("Casting/4Bolts.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function heavymallethead()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Heavy Mallet Head";
waitMinutes(10);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/HeavyMalletHead.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function widetungstenchisel()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Wide Tungsten Chisel";
waitMinutes(5);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/WideTungstenChisel.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function roundhammer()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Round Hammer";
waitMinutes(5);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/RoundHammer.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function ballpeenhammer()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Ball Peen Hammer";
waitMinutes(5);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/BallPeenHammer.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function shapingmallet()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Shaping Mallet";
waitMinutes(10);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/ShapingMallet.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function leadmallet()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Lead Mallet";
waitMinutes(5);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/LeadMallet.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function pewterincenseprong()
num_loops = promptNumber("How many passes ?", 1);
batch = 1;
name = "Incense Prong";
waitMinutes(3);
for i=1, num_loops do
while 1 do
refreshWindows();
clickAllImages("Casting/Forge_Tools.png");
lsSleep(400);
project_windows = clickAllImages("Casting/PewterIncenseProng.png");
if project_windows == 0 then
sleepWithStatusPause(1100, "Waiting for Project windows");
else
break;
end
end
waitGUI(i);
end
doneGUI(num_loops);
end
function fuel()
while 1 do
-- Ask for which button
local image_name = nil;
local is_done = nil;
while not is_done do
local y = nil;
local x = nil;
local bsize = nil;
for i=1, #fuel_button_names do
if fuel_button_names[i] == "Orichalcum Pellets" then
x = 30;
y = 10;
bsize = 250;
end
if lsButtonText(x, y, 0, bsize, 0x80D080ff, fuel_button_names[i]) then
image_name = fuel_button_names[i];
is_done = 1;
end
end
if lsButtonText(lsScreenX - 110, lsScreenY - 30, z, 100, 0xFFFFFFff, "End script") then
error "Clicked End Script button";
end
lsDoFrame();
lsSleep(10);
end
if image_name == "Orichalcum Pellets" then
orichalcumpellets();
end
end
end
function gearwork()
while 1 do
-- Ask for which button
local image_name = nil;
local is_done = nil;
while not is_done do
local y = nil;
local x = nil;
local bsize = nil;
for i=1, #gearwork_button_names do
if gearwork_button_names[i] == "Medium Gear" then
x = 30;
y = 10;
bsize = 150;
elseif gearwork_button_names[i] == "Small Gear" then
x = 30;
y = 35;
bsize = 150;
end
if lsButtonText(x, y, 0, 250, 0x80D080ff, gearwork_button_names[i]) then
image_name = gearwork_button_names[i];
is_done = 1;
end
end
if lsButtonText(lsScreenX - 110, lsScreenY - 30, z, 100, 0xFFFFFFff, "End script") then
error "Clicked End Script button";
end
lsDoFrame();
lsSleep(10);
end
if image_name == "Medium Gear" then
mediumgear();
elseif image_name == "Small Gear" then
smallgear();
end
end
end
function hardware()
while 1 do
-- Ask for which button
local image_name = nil;
local is_done = nil;
while not is_done do
local y = nil;
local x = nil;
local bsize = nil;
for i=1, #hardware_button_names do
if hardware_button_names[i] == "Bearing" then
x = 30;
y = 10;
bsize = 250;
elseif hardware_button_names[i] == "12 Washers" then
x = 30;
y = 40;
bsize = 250;
elseif hardware_button_names[i] == "4 Bolts" then
x = 30;
y = 70;
bsize = 250;
end
if lsButtonText(x, y, 0, bsize, 0x80D080ff, hardware_button_names[i]) then
image_name = hardware_button_names[i];
is_done = 1;
end
end
if lsButtonText(lsScreenX - 110, lsScreenY - 30, z, 100, 0xFFFFFFff, "End script") then
error "Clicked End Script button";
end
lsDoFrame();
lsSleep(10);
end
if image_name == "Bearing" then
bearing();
elseif image_name == "12 Washers" then
washers();
elseif image_name == "4 Bolts" then
bolts();
end
end
end
function tools()
while 1 do
-- Ask for which button
local image_name = nil;
local is_done = nil;
while not is_done do
local y = nil;
local x = nil;
local bsize = nil;
for i=1, #tools_button_names do
if tools_button_names[i] == "Heavy Mallet Head" then
x = 30;
y = 10;
bsize = 250;
elseif tools_button_names[i] == "Wide Tungsten Chisel" then
x = 30;
y = 40;
bsize = 250;
elseif tools_button_names[i] == "Round Hammer" then
x = 30;
y = 70;
bsize = 250;
elseif tools_button_names[i] == "Ball Peen Hammer" then
x = 30;
y = 100;
bsize = 250;
elseif tools_button_names[i] == "Shaping Mallet" then
x = 30;
y = 130;
bsize = 250;
elseif tools_button_names[i] == "Lead Mallet" then
x = 30;
y = 160;
bsize = 250;
elseif tools_button_names[i] == "Pewter Incense Prong" then
x = 30;
y = 190;
bsize = 250;
end
if lsButtonText(x, y, 0, bsize, 0x80D080ff, tools_button_names[i]) then
image_name = tools_button_names[i];
is_done = 1;
end
end
if lsButtonText(lsScreenX - 110, lsScreenY - 30, z, 100, 0xFFFFFFff, "End script") then
error "Clicked End Script button";
end
lsDoFrame();
lsSleep(10);
end
if image_name == "Heavy Mallet Head" then
heavymallethead();
elseif image_name == "Wide Tungsten Chisel" then
widetungstenchisel();
elseif image_name == "Round Hammer" then
roundhammer();
elseif image_name == "Ball Peen Hammer" then
ballpeenhammer();
elseif image_name == "Shaping Mallet" then
shapingmallet();
elseif image_name == "Lead Mallet" then
leadmallet();
elseif image_name == "Pewter Incense Prong" then
pewterincenseprong();
end
end
end