-
Notifications
You must be signed in to change notification settings - Fork 177
/
corn-maze.lic
761 lines (707 loc) · 31.6 KB
/
corn-maze.lic
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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#corn-maze
This script runs non-combat tasks for sleeping dragon maze.
=end
custom_require.call(%w(common common-travel events common-items))
class CornMaze
def setup
@done = false
@task_count = 0
@type_ahead_size = 1
@current_type_ahead = 0
@searching = true
@looting = true
@last_move = Time.now
@searchables = /rake|stones|hay|wood|basket|boulder|wheel|spiderweb|straw|statue|pail|fence|wagon|burrow|hut/
@landmarks = /rake|stones|hay|wood|basket|boulder|wheel|spiderweb|straw|statue|pail|fence|wagon|burrow|hut|scarecrow/
@maze_path = ['south', 'south', 'south', 'south', 'west', 'west', 'west', 'south', 'south', 'south', 'south', 'south', 'go tunnel', 'east', 'south', 'south', 'southeast', 'southeast', 'go tunnel', 'southwest', 'southwest', 'south', 'south', 'go tunnel', 'north', 'north', 'go tunnel', 'north', 'east', 'north', 'west', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'east', 'east', 'east', 'north', 'north', 'north', 'north']
@mice_path = ['east', 'east', 'south', 'west', 'east', 'south', 'west', 'west', 'south', 'west', 'north', 'north', 'west', 'west', 'south', 'south', 'east', 'north', 'east', 'south', 'east', 'south', 'west', 'west', 'west', 'south', 'south', 'south', 'south', 'south', 'go tunnel', 'east', 'south', 'south', 'southeast', 'southeast', 'go tunnel', 'southwest', 'southwest', 'south', 'south', 'go tunnel', 'north', 'north', 'go tunnel', 'north', 'east', 'north', 'west', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'east', 'east', 'east', 'north', 'north', 'north', 'north']
@scream_path = ['scream', 'south', 'south', 'south', 'south', 'west', 'west', 'west', 'south', 'south', 'south', 'south', 'south', 'go tunnel', 'scream', 'east', 'south', 'south', 'southeast', 'southeast', 'northeast', 'northeast', 'go tunnel', 'scream', 'go tunnel', 'southwest', 'southwest', 'go tunnel', 'scream', 'southwest', 'southwest', 'south', 'south', 'go tunnel', 'scream', 'north', 'north', 'go tunnel', 'north', 'east', 'north', 'west', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'north', 'east', 'east', 'east', 'north', 'north', 'north', 'north']
@landmark_path = ['east', 'east', 'east', 'east', 'west', 'west', 'south', 'south', 'west', 'west', 'south', 'west', 'north', 'north', 'west', 'west', 'south', 'south', 'east', 'north', 'east', 'south', 'east', 'south', 'west', 'west', 'west', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'east', 'south', 'west', 'south', 'go tunnel', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'north', 'north', 'north', 'east', 'south', 'east', 'north', 'east', 'east', 'south', 'south', 'south', 'east', 'east', 'east', 'north', 'north', 'east', 'west', 'west', 'north', 'south', 'west', 'north', 'west', 'west', 'north', 'west', 'west', 'west', 'north', 'north', 'north', 'north', 'north', 'go tunnel', 'north', 'north', 'northeast', 'northeast', 'go tunnel', 'northwest', 'northwest', 'north', 'north', 'north', 'south', 'west', 'go tunnel', 'north', 'north', 'north', 'north', 'north', 'east', 'east', 'east', 'north', 'north', 'north', 'north']
@full_path = [
'west', 'west', 'west', 'east', 'east', 'east', 'loot',
'south', 'east', 'west', 'north', 'east', 'east', 'east', 'east', 'southwest', 'north', 'west', 'south', 'loot',
'south', 'loot',
'southwest', 'north', 'west', 'south', 'west', 'north', 'loot',
'north', 'west', 'west', 'south', 'loot',
'south', 'east', 'north', 'east', 'south', 'east', 'south', 'west', 'loot',
'west', 'west', 'south', 'east', 'east', 'loot',
'west', 'south', 'north', 'west', 'south', 'south', 'south', 'loot',
'south', 'south', 'south', 'south', 'loot',
'east', 'west', 'south', 'east', 'east', 'west', 'south', 'loot',
'west', 'south', 'go tunnel', 'south', 'loot',
'south', 'loot',
'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'north', 'north', 'loot',
'north', 'east', 'south', 'loot',
'south', 'east', 'east', 'north', 'loot',
'south', 'west', 'west', 'north', 'east', 'north', 'east', 'east', 'south', 'south', 'south', 'loot',
'east', 'east', 'east', 'north', 'north', 'east', 'loot',
'west', 'west', 'north', 'loot',
'south', 'west', 'south', 'loot',
'north', 'north', 'west', 'west', 'north', 'west', 'loot',
'west', 'west', 'north', 'north', 'north', 'north', 'north', 'go tunnel', 'north', 'north', 'loot',
'northeast', 'northeast', 'go tunnel', 'northwest', 'loot',
'northwest', 'north', 'north', 'west', 'east', 'north', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'loot',
'north', 'southeast', 'loot',
'south', 'southwest', 'southwest', 'southwest', 'southwest', 'southwest', 'loot',
'southwest', 'southwest', 'south', 'southeast', 'southeast', 'west', 'east', 'north', 'northwest', 'north', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'southwest', 'south', 'southwest', 'loot',
'southwest', 'southwest', 'southwest', 'southwest', 'northeast', 'east', 'south', 'north', 'southeast', 'north', 'loot',
'north', 'east', 'north', 'south', 'south', 'southwest', 'southwest', 'northwest', 'loot',
'southeast', 'go tunnel', 'northeast', 'south', 'northeast', 'northeast', 'northeast', 'loot',
'north', 'north', 'north', 'northeast', 'northeast', 'loot',
'northeast', 'northeast', 'east', 'east', 'east', 'east', 'east', 'loot',
'east', 'southwest', 'west', 'west', 'west', 'west', 'loot',
'southwest', 'southwest', 'southwest', 'southwest', 'south', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'east', 'southwest', 'southwest', 'southwest', 'loot',
'southwest', 'southwest', 'south', 'east', 'southwest', 'west', 'north', 'southwest', 'loot',
'south', 'north', 'southwest', 'southwest', 'southwest', 'southwest', 'loot',
'west', 'northeast', 'southwest', 'east', 'northeast', 'east', 'northeast', 'east', 'northeast', 'west', 'east', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'loot',
'north', 'northeast', 'northeast', 'southwest', 'go tunnel', 'south', 'loot',
'south', 'west', 'southwest', 'loot',
'east', 'north', 'east', 'north', 'north', 'east', 'east', 'south', 'loot',
'north', 'north', 'north', 'loot',
'north', 'east', 'south', 'east', 'loot',
'west', 'south', 'east', 'east', 'north', 'loot',
'south', 'south', 'south', 'west', 'south', 'west', 'south', 'east', 'east', 'loot',
'south', 'south', 'west', 'south', 'west', 'south', 'loot',
'east', 'south', 'loot',
'north', 'west', 'north', 'north', 'north', 'west', 'loot',
'east', 'south', 'west', 'loot',
'south', 'go tunnel', 'west', 'northwest', 'north', 'loot',
'southwest', 'west', 'northwest', 'loot',
'southeast', 'east', 'east', 'southeast', 'southeast', 'south', 'loot',
'southeast', 'southeast', 'southeast', 'southeast', 'loot',
'northwest', 'south', 'south', 'south', 'southwest', 'southwest', 'loot',
'west', 'west', 'west', 'west', 'west', 'southwest', 'loot',
'go tunnel', 'south', 'south', 'west', 'west', 'east', 'east', 'east', 'loot',
'east', 'west', 'north', 'east', 'east', 'south', 'east', 'north', 'north', 'east', 'loot',
'east', 'east', 'north', 'east', 'north', 'south', 'south', 'south', 'loot',
'west', 'south', 'loot',
'west', 'west', 'north', 'east', 'west', 'west', 'south', 'west', 'north', 'north', 'loot',
'west', 'west', 'west', 'go tunnel', 'southwest', 'southwest', 'southwest', 'north', 'northeast', 'loot',
'northeast', 'northeast', 'east', 'east', 'loot',
'east', 'east', 'northeast', 'loot',
'go tunnel', 'north', 'loot',
'west', 'northwest', 'east', 'northwest', 'west', 'northwest', 'east', 'loot',
'northwest', 'west', 'east', 'north', 'south', 'west', 'southwest', 'southwest', 'west', 'northeast', 'loot',
'west', 'northeast', 'west', 'northeast', 'east', 'north', 'northeast', 'loot',
'southwest', 'west', 'west', 'west', 'southwest', 'southwest', 'southwest', 'loot',
'west', 'northeast', 'southwest', 'west', 'northeast', 'east', 'loot',
'northeast', 'north', 'east', 'west', 'southwest', 'west', 'southwest', 'loot',
'go tunnel', 'southwest', 'south', 'southeast', 'east', 'east', 'east', 'northwest', 'loot',
'east', 'southeast', 'east', 'northwest', 'southeast', 'loot',
'east', 'southeast', 'east', 'southeast', 'west', 'loot',
'west', 'west', 'southwest', 'west', 'loot',
'northeast', 'northwest', 'southeast', 'southwest', 'west', 'northeast', 'west', 'west', 'west', 'loot',
'west', 'west', 'northwest', 'northwest', 'north', 'north', 'north', 'loot',
'northeast', 'northeast', 'go tunnel', 'northwest', 'loot',
'northwest', 'north', 'north', 'west', 'go tunnel', 'north', 'north', 'north', 'north', 'north', 'east', 'east', 'east', 'north', 'north', 'north', 'north'
]
@poke_path = [
'south', 'south', 'south', 'south', 'west', 'west', 'west',
'south', 'south', 'south', 'south', 'south', 'go tunnel',
'east', 'south', 'south', 'southeast', 'southeast', 'go tunnel', 'southwest', 'southwest', 'south', 'south',
'north', 'north', 'loot',
'northeast', 'northeast', 'go tunnel', 'northwest', 'loot',
'northwest', 'north', 'north', 'west', 'east', 'north', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'loot',
'north', 'southeast', 'loot',
'south', 'southwest', 'southwest', 'southwest', 'southwest', 'southwest', 'loot',
'southwest', 'southwest', 'south', 'southeast', 'southeast', 'west', 'east', 'north', 'northwest', 'north', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'southwest', 'south', 'southwest', 'loot',
'southwest', 'southwest', 'southwest', 'southwest', 'northeast', 'east', 'south', 'north', 'southeast', 'north', 'loot',
'north', 'east', 'north', 'south', 'south', 'southwest', 'southwest', 'northwest', 'loot',
'southeast', 'go tunnel', 'northeast', 'south', 'northeast', 'northeast', 'northeast', 'loot',
'north', 'north', 'north', 'northeast', 'northeast', 'loot',
'northeast', 'northeast', 'east', 'east', 'east', 'east', 'east', 'loot',
'east', 'southwest', 'west', 'west', 'west', 'west', 'loot',
'southwest', 'southwest', 'southwest', 'southwest', 'south', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'northeast', 'east', 'southwest', 'southwest', 'southwest', 'loot',
'southwest', 'southwest', 'south', 'east', 'southwest', 'west', 'north', 'southwest', 'loot',
'south', 'north', 'southwest', 'southwest', 'southwest', 'southwest', 'loot',
'west', 'northeast', 'southwest', 'east', 'northeast', 'east', 'northeast', 'east', 'northeast', 'west', 'east', 'loot',
'northeast', 'northeast', 'northeast', 'northeast', 'loot',
'north', 'northeast', 'northeast', 'southwest',
'southwest', 'south', 'southwest', 'southwest', 'southwest', 'southwest',
'go tunnel', 'east', 'southeast', 'east', 'east', 'southeast', 'southeast',
'south', 'southeast', 'southeast', 'southeast',
'south', 'south', 'south', 'southwest', 'southwest', 'loot',
'west', 'west', 'west', 'west', 'west', 'southwest', 'loot',
'go tunnel', 'south', 'south', 'west', 'west', 'east', 'east', 'east', 'loot',
'east', 'west', 'north', 'east', 'east', 'south', 'east', 'north', 'north', 'east', 'loot',
'east', 'east', 'north', 'east', 'north', 'south', 'south', 'south', 'loot',
'west', 'south', 'loot',
'west', 'west', 'north', 'east', 'west', 'west', 'south', 'west', 'north', 'north', 'loot',
'west', 'west', 'west', 'go tunnel', 'southwest', 'southwest', 'southwest', 'north', 'northeast', 'loot',
'northeast', 'northeast', 'east', 'east', 'loot',
'east', 'east', 'northeast', 'loot',
'go tunnel', 'north', 'loot',
'west', 'northwest', 'east', 'northwest', 'west', 'northwest', 'east', 'loot',
'northwest', 'west', 'east', 'north', 'south', 'west', 'southwest', 'southwest', 'west', 'northeast', 'loot',
'west', 'northeast', 'west', 'northeast', 'east', 'north', 'northeast', 'loot',
'southwest', 'west', 'west', 'west', 'southwest', 'southwest', 'southwest', 'loot',
'west', 'northeast', 'southwest', 'west', 'northeast', 'east', 'loot',
'northeast', 'north', 'east', 'west', 'southwest', 'west', 'southwest', 'loot',
'go tunnel', 'southwest', 'south', 'southeast', 'east', 'east', 'east', 'northwest', 'loot',
'east', 'southeast', 'east', 'northwest', 'southeast', 'loot',
'east', 'southeast', 'east', 'southeast', 'west', 'loot',
'west', 'west', 'southwest', 'west', 'loot',
'northeast', 'northwest', 'southeast', 'southwest', 'west', 'northeast', 'west', 'west', 'west', 'loot',
'west', 'west', 'northwest', 'northwest', 'north', 'north', 'north', 'loot',
'northeast', 'northeast', 'go tunnel', 'northwest', 'loot',
'northwest', 'north', 'north', 'west', 'go tunnel', 'north', 'north', 'north', 'north', 'north', 'east', 'east', 'east', 'north', 'north', 'north', 'north'
]
@halfling_path = ['west', 'west', 'west', 'east', 'east', 'east', 'south', 'east', 'west', 'north', 'east', 'east', 'east', 'east', 'southwest', 'north', 'west', 'south', 'south', 'southwest', 'north', 'west', 'south', 'west', 'north', 'north', 'west', 'west', 'south', 'south', 'east', 'north', 'east', 'south', 'east', 'south', 'west', 'west', 'west', 'south', 'east', 'east', 'west', 'south', 'north', 'west', 'south', 'south', 'south', 'south', 'south', 'south', 'south', 'east', 'west', 'south', 'east', 'east', 'west', 'south', 'west', 'south', 'north', 'east', 'north', 'west']
end
def initialize
@settings = get_settings
@worn_trashcan = @settings.worn_trashcan
@worn_trashcan_verb = @settings.worn_trashcan_verb
@junk_list = @settings.maze_junk.map { |x| /\b#{x}/i }
arg_definitions = [
[
{ name: 'noloot', regex: /noloot/i, optional: true, description: 'Do tasks and run through the maze only picking up passes.' },
{ name: 'restart', regex: /restart/i, optional: true, description: 'Do tasks, but no searching for loot at all, not even passes.' },
{ name: 'slow', regex: /slow/i, optional: true, description: 'Move through the maze one room at a time, useful for a slow connection.' },
{ name: 'short', regex: /short/i, optional: true, description: 'Do the short 10-task maze run with the harried Halfling.' }
],
[
{ name: 'manual', regex: /manual/i, optional: false, description: 'Walk around the maze on your own, however it will search and loot any incidental points you see.' }
]
]
args = parse_args(arg_definitions)
setup
if @settings.cornmaze_containers.empty?
DRC.message('The Script will STOW any loot, but to handle spillover consider adding other containers to your YAML as:')
DRC.message('cornmaze_containers:')
DRC.message('- backpack')
DRC.message('- duffel bag')
pause 2
end
@searching = false if args.restart
@looting = false if args.noloot
@slow_movement = args.slow || !['profanity', 'stormfront'].include?($frontend)
DRCI.stow_hands
manual_loot if args.manual
unless args.restart
DRC.log_window("***STATUS*** Starting Maze run with #{count_he_bottle} kernels", "familiar")
end
if args.short
run_short_maze
else
run_long_maze
end
end
# --- SHORT MAZE --- #
def run_short_maze
Flags.add('maze_done', "Thanks for all the hard work. Here's a little something to show my appreciation.")
Flags.add('task_build', "find a good spot and BUILD")
Flags.add('task_search', "I'd like you to SEARCH")
Flags.add('task_touch', "I'd like you to find and TOUCH")
Flags.add('task_forage', "I'd like you to FORAGE")
Flags.add('task_scream', "let out a good SCREAM")
Flags.add('task_pull', "I'd like you to go PULL")
Flags.add('task_wave', "You just have to WAVE your hands")
Flags.add('task_disarm', "I'd like you to DISARM")
Flags.add('task_poke', "I'd like you to go find and POKE EMPLOYEEs")
join_harried_halfling
until Flags['maze_done'] do
do_short_task('build') if Flags['task_build']
do_short_task('search') if Flags['task_search']
do_short_task('touch') if Flags['task_touch']
do_short_task('forage') if Flags['task_forage']
do_short_task('scream') if Flags['task_scream']
do_short_task('pull') if Flags['task_pull']
do_short_task('wave') if Flags['task_wave']
do_short_task('disarm') if Flags['task_disarm']
do_short_task('poke') if Flags['task_poke']
pause 1
end
end
def join_harried_halfling
halfling_room = 13245 # harried Halfling
DRCT.walk_to(halfling_room)
join_confirm = [
"Are you SURE you want to do the FAST version",
]
join_success = [
"A harried Halfling escorts you"
]
join_failure = [
"What were you referring to?",
]
join_need_pass = [
"Sorry, I'm quite busy"
]
case DRC.bput("join harried halfling", *join_confirm, *join_success, *join_failure, *join_need_pass)
when *join_failure
DRC.message("Unable to join a harried Halfling. Is one here?")
exit
when *join_need_pass
DRC.message("You need to REDEEM a corn maze pass first, then retry this script.")
exit
when *join_confirm
join_harried_halfling
end
end
def count_he_bottle
DRC.bput("count my bottle", /^That doesn't tell you much of anything/, /^I could not find what you were referring to/, /^You count the number of kernels inside the bottle and find that there are \d+,?\d*/).tr(',', '').scan(/\d+/).first.to_i
end
def do_short_task(task)
Flags.reset("task_#{task}")
case task
when 'poke'
task = 'poke employee'
when 'disarm'
waitrt?
fput("search")
task = 'disarm trap'
end
waitrt?
fput("#{task}")
waitrt?
end
# --- LONG MAZE --- #
def run_long_maze
DRC.message("WARNING! THE CORN MAZE IS DIFFICULT TO NAVIGATE, AND IT'S ALWAYS POSSIBLE FOR LAG TO BREAK THE SCRIPT. BE MINDFUL OF YOUR PASSES, AND WATCH IT IN CASE YOU NEED TO TAKE CONTROL.")
Flags.add('maze_done', 'leads you through the twisting passages and brings you to the exit')
Flags.add('task_done', '10 of 10', '10 of the 10', '5 of the 5', '5 of 5', 'return to one of the Halflings and ASK HALFLING ABOUT TASK again')
find_start
get_task
end
def wait_for_command
reset_flags
Flags.reset('task_done')
case DRC.bput("TASK",
/need to BUILD SCARECROW/,
/need to WAVE to scare off the mice/,
/need to walk around the maze and PULL WEED/,
/need to first SEARCH out a trap in each room/,
/need to SEARCH in the rooms to find and catch the grasshoppers/,
/need to move to different rooms in the maze and SCREAM/,
/need to go around finding landmarks/,
/move around and SEARCH to find golden tokens/,
/need to FORAGE CORN inside the maze/,
/need to go up to each Halfling and POKE them/,
/You are not currently on a task in the Corn Maze/,
/Okay, we'd like you to kill/)
when /need to BUILD SCARECROW/
DRC.log_window("CM:Starting task BUILD SCARECROW", "familiar")
scarecrow_task
when /need to WAVE to scare off the mice/
DRC.log_window("CM:Starting task WAVE", "familiar")
mice_task
when /need to walk around the maze and PULL WEED/
DRC.log_window("CM:Starting task PULL WEED", "familiar")
weeds_task
when /need to first SEARCH out a trap in each room/
DRC.log_window("CM:Starting task SEARCH TRAPS", "familiar")
traps_task
when /need to SEARCH in the rooms to find and catch the grasshoppers/
DRC.log_window("CM:Starting task SEARCH", "familiar")
grasshopper_task
when /need to move to different rooms in the maze and SCREAM/
DRC.log_window("CM:Starting task SCREAM", "familiar")
scream_task
when /need to go around finding landmarks/
DRC.log_window("CM:Starting task LANDMARKS", "familiar")
landmarks_task
when /move around and SEARCH to find golden tokens/
DRC.log_window("CM:Starting task SEARCH TOKENS", "familiar")
tokens_task
when /need to FORAGE CORN inside the maze/
DRC.log_window("CM:Starting task FORAGE", "familiar")
corn_task
when /need to go up to each Halfling and POKE them/
DRC.log_window("CM:Starting task POKE", "familiar")
halfling_task
when /You are not currently on a task in the Corn Maze/
loot_task
when /Okay, we'd like you to kill/
DRC.log_window("CM:KILL TASK - Cancelling task", "familiar")
cancel_task
end
end
def cancel_task
DRC.bput 'TASK CANCEL', 'TASK CANCEL again in 30 seconds', 'Your current task has been canceled'
DRC.bput 'TASK CANCEL', 'TASK CANCEL again in 30 seconds', 'Your current task has been canceled'
pause 300
get_task
end
def traps_task
Flags.add('poisoned', 'You choke and gag on the poisonous gas')
@maze_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
case DRC.bput('search', 'You don\'t think there are any traps here', 'tiny black dots are jumping around inside', 'You notice', 'already looked for traps around here')
when 'You notice'
waitrt?
DRC.bput('disarm trap', 'You attempt to disarm', 'Disarm what')
pause 1
waitrt?
recover_stun
DRC.fix_standing
end
custom_move(x)
else
custom_move(x, true)
end
end
DRC.message("TURNING IN TASK!")
Flags.delete('poisoned')
finish_task
end
def scarecrow_task
Flags.add('scarecrow_done', 'You put the finishing touches')
Flags.add('already_built', 'already built a scarecrow here')
@maze_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
if !DRRoom.room_objs.include? "corn husk scarecrow"
while !Flags['scarecrow_done'] && !Flags['maze_done']
fput "build scarecrow"
pause 1
waitrt?
end
end
end
custom_move(x)
Flags.reset('scarecrow_done')
end
finish_task
end
def mice_task
@mice_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
fput 'wave'
pause 1
waitrt?
DRC.fix_standing
fput("TASK")
custom_move(x)
else
custom_move(x, true)
end
end
DRC.message("TURNING IN TASK!")
finish_task
end
def scream_task
@scream_path.each do |x|
exit if Flags['maze_done']
if x == 'scream'
wait_on_done_move
fput "#{x}"
else
custom_move(x, true)
end
end
DRC.message("TURNING IN TASK!")
finish_task
end
def weeds_task
@maze_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
fput 'pull weeds'
pause 1
waitrt?
while !checkstanding
DRC.fix_standing
end
DRC.fix_standing
fput("TASK")
custom_move(x)
else
custom_move(x, true)
end
end
DRC.message("TURNING IN TASK!")
finish_task
end
def corn_task
@maze_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
DRC.bput('forage corn', 'You forage around for a moment', 'You\'ve already looked around here')
pause 1
waitrt?
DRCI.dispose_trash('corn', @worn_trashcan, @worn_trashcan_verb) if /corn/ =~ DRC.left_hand || /corn/ =~ DRC.right_hand
DRC.fix_standing
fput "TASK"
custom_move(x)
else
custom_move(x, true)
end
end
echo "TURNING IN TASK!"
finish_task
end
def tokens_task
@maze_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
fput 'search'
pause 1
waitrt?
DRC.fix_standing
fput("TASK")
custom_move(x)
else
custom_move(x, true)
end
end
DRC.message("TURNING IN TASK!")
finish_task
end
def grasshopper_task
@mice_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
fput 'search'
pause 1
waitrt?
DRC.fix_standing
custom_move(x)
fput("TASK")
else
custom_move(x, true)
end
end
DRC.message("TURNING IN TASK!")
finish_task
end
def landmarks_task
@landmark_path.each do |x|
exit if Flags['maze_done']
if !Flags['task_done']
if DRRoom.room_objs.count > 0
touch_room
end
custom_move(x)
else
custom_move(x, true)
end
end
finish_task
end
def touch_room
targets = DRRoom.room_objs.grep(@landmarks)
targets.each do |target|
fput("touch #{target.split.last}")
end
end
def halfling_task
@poke_path.each do |x|
next if x == 'loot'
exit if Flags['maze_done']
if DRRoom.npcs.include? 'Halfling'
DRC.bput('poke halfling', 'You poke a', 'What were you')
pause 1
fput("TASK")
end
if DRRoom.npcs.include? 'Gor\'Tog'
DRC.bput('poke gor\'tog', 'You poke a', 'What were you')
DRC.fix_standing
recover_stun
DRC.fix_standing
pause 1
fput("TASK")
end
unless Flags['task_done']
custom_move(x)
else
custom_move(x, true)
end
end
finish_task
end
def loot_task
@searching = false
@full_path.each do |x|
exit if Flags['maze_done']
if x == 'loot'
wait_on_done_move
loot_room
else
custom_move(x, true)
end
end
finish_task
end
def manual_loot
until Flags['maze_done']
pause 0.2
loot_room
end
exit
end
def loot_room
pause 0.1 until XMLData.room_count != @last_looted
targets = DRRoom.room_objs.grep(@searchables)
targets.each do |target|
if /manage/ =~ DRC.bput("search #{target.split.last}", "Sadly, you don't find anything", 'You manage to find', 'already been picked clean', 'I could not find what you were referring to', 'not in any condition', 'nothing of special interest about it', 'You ponder that')
while (thing = DRC.left_hand || DRC.right_hand)
if @looting
case thing
when *@junk_list
drop_item(thing)
else
stow_thing(thing)
end
elsif DRC.left_hand.include?('pass') || DRC.right_hand.include?('pass')
stow_thing(thing)
else
drop_item(thing)
end
end
end
end
@last_looted = XMLData.room_count
end
def drop_item(item)
DRCI.dispose_trash(item, @worn_trashcan, @worn_trashcan_verb)
end
def wait_on_done_move
last_room = XMLData.room_count
pause 0.5
while last_room != XMLData.room_count
last_room = XMLData.room_count
pause 0.5
end
end
def get_task
wait_on_done_move
@halfling_path.each do |x|
exit if Flags['maze_done']
if DRRoom.npcs.include? 'Halfling'
break
else
custom_move(x)
end
end
DRC.bput('ask halfling about task', '^A .+ Halfling smiles happily at you', '^To whom')
echo "Task count = #{@task_count}"
if @searching == false
case DRC.bput('ask halfling for task', 'A cheerful Halfling smiles happily', 'To whom are you', 'A cheerful Halfling looks at you and says')
when 'A cheerful Halfling looks at you and says'
fput('ask halfling for task cancel')
fput('ask halfling for task cancel')
return get_task
end
end
@done = false
find_start
@done = false
wait_for_command
end
def find_start
wait_on_done_move
unless XMLData.room_title.include?('Labyrinth') || XMLData.room_title.include?('Corn Maze, Entrance')
DRC.message("The script can't find its way back from here! Open up ;narost, right click it and open the Corn Maze map, or use elanthipedia, then make your way back towards the northwest Labyrinth then unpause the script!")
5.times do
DRC.beep
pause 2
end
pause_script('corn-maze')
end
until @done
exit if Flags['maze_done']
find_exits = DRC.bput("look", /Obvious paths: .*\./,)
exits = find_exits.match(/^Obvious paths: (.*)\./).to_a[1].split(', ')
if (exits.include? 'north')
custom_move 'north'
elsif (exits.include? 'east')
custom_move 'east'
elsif (exits.include? 'south')
custom_move 'south'
custom_move 'south'
custom_move 'east'
elsif exits.include?('west') && !exits.include?('southwest') && !exits.include?('east') && !exits.include?('south') && !exits.include?('north') && !exits.include?('southeast') && !exits.include?('northwest') && !exits.include?('northeast')
custom_move 'west'
custom_move 'west'
elsif ((exits.include? 'west') && (exits.include? 'southwest'))
custom_move 'west'
custom_move 'west'
custom_move 'west'
custom_move 'west'
@done = true
end
end
end
def finish_task
DRC.log_window("Finished task.", "familiar")
fput('count my bottle')
reset_flags
@task_count = @task_count + 1
get_task
end
def reset_flags
# Short maze flags
Flags.reset('task_build')
Flags.reset('task_search')
Flags.reset('task_touch')
Flags.reset('task_forage')
Flags.reset('task_scream')
Flags.reset('task_pull')
Flags.reset('task_wave')
Flags.reset('task_disarm')
Flags.reset('task_poke')
end
def custom_move(dir, fast = false)
DRC.fix_standing
DRC.retreat if Time.now - @last_move > 8
if fast && !@slow_movement
put dir
@current_type_ahead += 1
if @type_ahead_size < @current_type_ahead
pause 0.2
@current_type_ahead = 0
end
else
move dir
end
@last_move = Time.now
end
def stow_thing(thing)
if @settings.cornmaze_containers.any?
@settings.cornmaze_containers.each do |container|
return if DRCI.put_away_item?(thing, container)
end
end
unless DRCI.stow_item?(thing)
DRC.message("YOU'VE RUN OUT OF ROOM! GET SOME MORE SPACE, YOU LAZY SLOB!")
DRCI.dispose_trash(thing, @worn_trashcan, @worn_trashcan_verb)
end
end
def recover_stun
return unless !checkstanding || stunned?
DRC.fix_standing
pause 3
recover_stun
end
end
before_dying do
kernel_count = DRC.bput("count my bottle", /^That doesn't tell you much of anything/, /^I could not find what you were referring to/, /^You count the number of kernels inside the bottle and find that there are \d+,?\d*/).tr(',', '').scan(/\d+/).first.to_i
DRC.message("CM: Exiting script with #{kernel_count} kernels.")
Flags.delete('maze_done')
Flags.delete('poisoned')
Flags.delete('already_built')
Flags.delete('scarecrow_done')
Flags.delete('task_done')
# Short maze flags
Flags.delete('task_build')
Flags.delete('task_search')
Flags.delete('task_touch')
Flags.delete('task_forage')
Flags.delete('task_scream')
Flags.delete('task_pull')
Flags.delete('task_wave')
Flags.delete('task_disarm')
Flags.delete('task_poke')
end
CornMaze.new