forked from coderwilson/FFX_TAS_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFFX_menuGrid.py
929 lines (890 loc) · 33.6 KB
/
FFX_menuGrid.py
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
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
import pyxinput
import time
import FFX_Xbox
import FFX_Screen
import FFX_memory
FFXC = FFX_Xbox.FFXC
def gridUp():
FFXC.set_value('Dpad', 1)
time.sleep(0.04)
FFXC.set_value('Dpad', 0)
time.sleep(0.12)
def gridDown():
FFXC.set_value('Dpad', 2)
time.sleep(0.04)
FFXC.set_value('Dpad', 0)
time.sleep(0.12)
def gridLeft():
FFXC.set_value('Dpad', 4)
time.sleep(0.04)
FFXC.set_value('Dpad', 0)
time.sleep(0.12)
def gridRight():
FFXC.set_value('Dpad', 8)
time.sleep(0.04)
FFXC.set_value('Dpad', 0)
time.sleep(0.12)
def gridOpen():
return FFX_memory.sGridActive()
def gridTidus():
if FFX_memory.sGridChar() == 0:
return True
else:
return False
def gridKimahri():
if FFX_memory.sGridChar() == 3:
return True
else:
return False
def gridAuron():
if FFX_memory.sGridChar() == 2:
return True
else:
return False
def gridLulu():
if FFX_memory.sGridChar() == 5:
return True
else:
return False
def gridWakka():
if FFX_memory.sGridChar() == 4:
return True
else:
return False
def gridYuna():
if FFX_memory.sGridChar() == 1:
return True
else:
return False
def gridRikku():
if FFX_memory.sGridChar() == 6:
return True
else:
return False
def firstPosition():
if FFX_Screen.PixelTestTol(619,765,(255, 255, 255),5) and not FFX_Screen.PixelTestTol(178,786,(159, 161, 159),5):
return True
else: return False
def moveUseMenu():
return FFX_Screen.PixelTestTol(347,526,(255, 255, 255),5)
def moveReady():
if moveUseMenu():
return FFX_Screen.PixelTestTol(181,459,(179, 181, 179),5)
else: return False
def moveActive():
if readyUseSphere():
return False
else:
return FFX_Screen.PixelTestTol(178,786,(159, 161, 159),5)
def moveComplete():
if FFX_Screen.PixelTestTol(252,584,(218, 218, 218),5):
if FFX_Screen.PixelTestTol(182,546,(156, 158, 156),5):
return True
else: return False
else: return False
def useReady():
if moveUseMenu():
return FFX_Screen.PixelTestTol(181,502,(195, 197, 195),5)
else: return False
def readySelectSphere():
return FFX_Screen.PixelTestTol(636,438,(255, 255, 255),5)
def readyUseSphere():
if FFX_Screen.PixelTestTol(619,765,(255, 255, 255),5):
if FFX_Screen.PixelTestTol(176,786,(159, 161, 159),5):
return True
elif FFX_Screen.PixelTestTol(225,785,(232, 13, 13),5):
return True
else:
return False
elif FFX_Screen.PixelTestTol(225,785,(232, 13, 13),5):
return True
else: return False
def quitGridReady():
if FFX_Screen.PixelTestTol(252,584,(218, 218, 218),5):
if FFX_Screen.PixelTestTol(182,546,(156, 158, 156),5):
return True
else: return False
else: return False
def mainMenu():
return FFX_Screen.PixelTestTol(1575,20,(67, 70, 117),5)
def useFirst():
print("use first")
while not readySelectSphere():
if firstPosition():
FFX_Xbox.menuB()
elif moveReady():
FFX_Xbox.menuDown()
elif useReady():
FFX_Xbox.menuB()
time.sleep(0.4)
return True
def moveFirst():
print("move first")
while not moveActive():
if firstPosition():
FFX_Xbox.menuB()
elif moveReady():
FFX_Xbox.menuB()
elif useReady():
FFX_Xbox.menuUp()
time.sleep(0.2)
return True
def moveAndUse():
print("move and use")
time.sleep(0.1)
FFX_Xbox.menuB()
while not readySelectSphere():
if moveComplete() or firstPosition():
FFX_Xbox.menuB()
elif moveReady():
FFX_Xbox.menuDown()
elif useReady():
FFX_Xbox.menuB()
time.sleep(0.2)
return True
def useAndMove():
print("use and move")
time.sleep(0.1)
FFX_Xbox.menuB()
while not moveActive():
if readyUseSphere() or firstPosition():
FFX_Xbox.menuB()
elif moveReady():
FFX_Xbox.menuB()
elif useReady():
FFX_Xbox.menuUp()
else:
FFX_Xbox.menuB()
time.sleep(0.2)
return True
def useAndUseAgain():
print("use and use again")
time.sleep(0.1)
FFX_Xbox.menuB()
while not readySelectSphere():
if readyUseSphere() or firstPosition():
FFX_Xbox.menuB()
elif moveReady():
FFX_Xbox.menuDown()
elif useReady():
FFX_Xbox.menuB()
time.sleep(0.2)
return True
def useShiftLeft(toon):
print("use and shift")
time.sleep(0.1)
FFX_Xbox.menuB()
toon = toon.lower()
if toon == 'yuna':
while not gridYuna():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'lulu':
while not gridLulu():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'auron':
while not gridAuron():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'wakka':
while not gridWakka():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'tidus':
while not gridTidus():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'kimahri':
while not gridKimahri():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'rikku':
while not gridRikku():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
print("Ready for grid: " + toon)
def useShiftRight(toon):
print("use and shift")
time.sleep(0.1)
FFX_Xbox.menuB()
toon = toon.lower()
if toon == 'yuna':
while not gridYuna():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
if toon == 'lulu':
while not gridLulu():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
time.sleep(0.3)
if toon == 'auron':
while not gridAuron():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
if toon == 'wakka':
while not gridWakka():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
if toon == 'tidus':
while not gridTidus():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
if toon == 'kimahri':
while not gridKimahri():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
if toon == 'rikku':
while not gridRikku():
if readyUseSphere():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
print("Ready for grid: " + toon)
def moveShiftLeft(toon):
print("Move and shift, left")
FFX_Xbox.menuB()
toon = toon.lower()
if toon == 'yuna':
while not gridYuna():
if moveReady() or moveActive() or moveComplete():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
if toon == 'lulu':
while not gridLulu():
if moveReady() or moveActive() or moveComplete():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderLeft()
print("Ready for grid: " + toon)
def moveShiftRight(toon):
print("Move and shift, right")
FFX_Xbox.menuB()
toon = toon.lower()
if toon == 'yuna':
while not gridYuna():
if moveReady() or moveActive() or moveComplete():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
if toon == 'lulu':
while not gridLulu():
if moveReady() or moveActive() or moveComplete():
FFX_Xbox.menuB()
elif moveUseMenu():
FFX_Xbox.menuBack()
elif firstPosition():
FFX_Xbox.shoulderRight()
print("Ready for grid: " + toon)
def useAndQuit():
time.sleep(0.1)
FFX_Xbox.menuB()
while not mainMenu():
if readyUseSphere():
print("Using the current item.")
FFX_Xbox.menuB()
elif firstPosition():
print("Opening the Quit menu")
FFX_Xbox.menuA()
elif quitGridReady():
print("quitting sphere grid")
FFX_Xbox.menuB()
time.sleep(0.6)
return True
def cursorPos():
if FFX_Screen.PixelTestTol(180,459,(179, 181, 179),5):
return 1
elif FFX_Screen.PixelTestTol(176,504,(147, 148, 147),5):
return 2
elif FFX_Screen.PixelTestTol(176,547,(148, 150, 148),5):
return 3
elif FFX_Screen.PixelTestTol(176,591,(145, 145, 145),5):
return 4
else: return cursorPos()
def sphereColor(desired):
print("Desired color: ", desired)
position = cursorPos()
print("Testing position: ", position)
if position == 1:
color = FFX_Screen.PixelValue(230,460)
print("Position 1: ", color)
if color == (220, 9, 9):
print("Position 1, red sphere found.")
if desired == 'red':
print("Desired color found.")
return 1
if color == (68, 69, 69):
print("Position 1, black sphere found.")
if desired == 'black':
print("Desired color found.")
return 4
if position == 2:
color = FFX_Screen.PixelValue(230,505)
print("Position 2: ", color)
if color == (222, 1, 1):
print("Position 2, red sphere found.")
if desired == 'red':
print("Desired color found.")
return 2
if color == (182, 143, 2):
print("Position 2, yellow sphere found.")
if desired == 'yellow':
print("Desired color found.")
return 2
if position == 3:
color = FFX_Screen.PixelValue(230,550)
print("Position 3: ", color)
if color == (147, 0, 0):
print("Position 3, red sphere found.")
if desired == 'red':
print("Desired color found.")
return 3
if color == (141, 123, 0):
print("Position 3, yellow sphere found.")
if desired == 'yellow':
print("Desired color found.")
return 3
if position == 4:
color = FFX_Screen.PixelValue(230,590)
print("Position 4: ", color)
if color == (215, 7, 7):
print("Position 4, red sphere found.")
if desired == 'red':
print("Desired color found.")
return 4
if color == (193, 223, 231):
print("Position 4, white sphere found.")
if desired == 'white':
print("Desired color found.")
return 4
if color == (114, 18, 210):
print("Position 4, purple sphere found.")
if desired == 'purple':
print("Desired color found.")
return 4
if color == (49, 50, 50):
print("Position 4, black sphere found.")
if desired == 'black':
print("Desired color found.")
return 4
if color == (198, 167, 6):
print("Position 4, yellow sphere found.")
if desired == 'yellow':
print("Desired color found.")
return 4
return 0
def selSphere(sType, direction, shift):
sType = sType.lower()
shift = shift.lower()
found = 0
limit = 0
speed = 0.05
position = 0
color = 'none'
print("Looking for sphere: '",sType,"'")
if sType == 'power' or sType == 'speed' or sType == 'mana' or sType == 'ability' or sType == 'fortune':
color = 'red'
if sType == 'tele' or sType == 'ret' or sType == 'friend':
color = 'white'
if sType == 'magic' or sType == 'luck' or sType == 'strength' or sType == 'purpAny':
color = 'purple'
if sType == 'lv1' or sType == 'lv2' or sType == 'lv3' or sType == 'lv4':
color = 'black'
if sType == 'skill' or sType == 'att':
color = 'yellow'
while not readyUseSphere():
print(color)
position = sphereColor(color)
if position != 0:
if sType == 'power':
if position == 1:
if FFX_Screen.PixelTestTol(370,473,(171, 171, 171),5):
FFX_Xbox.menuB() #Found a power sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 2:
if FFX_Screen.PixelTestTol(389,495,(22, 22, 22),5):
FFX_Xbox.menuB() #Found a power sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'mana':
if position == 1:
if FFX_Screen.PixelTestTol(357,473,(171, 171, 171),5):
FFX_Xbox.menuB() #Found mana sphere
time.sleep(0.1)
found = 1
if position == 2:
if FFX_Screen.PixelTestTol(356,516,(172, 172, 172),5):
FFX_Xbox.menuB() #Found mana sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'speed':
if position == 1:
if FFX_Screen.PixelTestTol(275,472,(174, 174, 174),5):
FFX_Xbox.menuB() #Found a speed sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 2:
if FFX_Screen.PixelTestTol(275,516,(172, 172, 172),5):
FFX_Xbox.menuB() #Found a speed sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 3:
print("Ping")
if FFX_Screen.PixelTestTol(275,560,(170, 170, 170),5):
print("Ping 2")
FFX_Xbox.menuB() #Found a speed sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 4 and direction == 'd':
direction = 'u'
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'ability':
if position == 1:
if FFX_Screen.PixelTestTol(300,452,(222, 222, 222),5):
FFX_Xbox.menuB() #Found ability sphere
time.sleep(0.1)
found = 1
if position == 4:
if FFX_Screen.PixelTestTol(300,582,(222, 222, 222),5):
FFX_Xbox.menuB() #Found ability sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'fortune':
if position == 4:
if FFX_Screen.PixelTestTol(391,602,(172, 172, 172),5):
FFX_Xbox.menuB() #Found ability sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'tele':
if position == 4:
if FFX_Screen.PixelTestTol(316,603,(169, 169, 169),5):
FFX_Xbox.menuB() #Found a teleport sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'friend':
if position == 4:
if FFX_Screen.PixelTestTol(331,581,(223, 223, 223),5):
FFX_Xbox.menuB() #Found a friend sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'ret':
if position == 4:
if FFX_Screen.PixelTestTol(295,582,(222, 222, 222),5):
print("Found Return sphere")
FFX_Xbox.menuB() #Found a return sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'lv1' or sType == 'lv2' or sType == 'lv3' or sType == 'lv4':
pixel2 = FFX_Screen.PixelValue(307,598)
print(pixel2)
if position == 4 and FFX_Screen.PixelTestTol(258,583,(220, 220, 220),5):
#Should be more specific. Just getting tired of finding the right level.
FFX_Xbox.menuB() # Lv.1 sphere
time.sleep(0.1)
found = 1
elif position == 1:
print("Found a key sphere in position 1")
FFX_Xbox.menuB() # Lv.1 sphere
time.sleep(0.1)
found = 1
elif position == 3: #This is just a placeholder until we feel like coming back to improve this.
if (sType == 'lv3' or sType == 'lv4') and FFX_Screen.PixelTestTol(258,583,(220, 220, 220),5):
print("Found a Lv.3/4 sphere (these are never side by side)")
FFX_Xbox.menuB() # Lv.1 sphere
time.sleep(0.1)
found = 1
elif FFX_Screen.PixelTestTol(317,581,(137, 132, 160),5): # Top corner of the 1 in Lv.1
print("Found a Lv.1 unlock sphere.")
if sType == 'lv1':
FFX_Xbox.menuB() # Lv.1 sphere
time.sleep(0.1)
found = 1
else:
print("Wrong sphere.")
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif pixel2 == (184, 184, 184): #Bottom left of the 2 in Lv.2
print("Found a Lv.2 unlock sphere.")
if sType == 'lv2':
FFX_Xbox.menuB() # Lv.2 sphere
time.sleep(0.1)
found = 1
else:
print("Wrong sphere.")
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
print("Could not identify sphere.")
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'magic':
if position == 4:
if FFX_Screen.PixelTestTol(301,602,(172, 172, 172),5):
FFX_Xbox.menuB() #Found a magic sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'luck':
if position == 4:
if FFX_Screen.PixelTestTol(303,580,(225, 225, 225),5):
FFX_Xbox.menuB() #Found a Luck sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'strength':
if position == 4:
if FFX_Screen.PixelTestTol(421,581,(223, 223, 223),5):
FFX_Xbox.menuB() #Found a Strength sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'skill':
if position == 2:
if FFX_Screen.PixelTestTol(306,494,(224, 224, 224),5) and FFX_Screen.PixelTestTol(343,516,(172, 172, 172),5):
FFX_Xbox.menuB() #Found a Skill sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 3:
if FFX_Screen.PixelTestTol(306,538,(223, 223, 223),5) and FFX_Screen.PixelTestTol(343,560,(170, 170, 170),5):
FFX_Xbox.menuB() #Found a Skill sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 4:
if FFX_Screen.PixelTestTol(306,585,(216, 216, 216),5) and FFX_Screen.PixelTestTol(343,601,(175, 175, 175),5):
FFX_Xbox.menuB() #Found a Skill sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif sType == 'att':
if position == 2:
if FFX_Screen.PixelTestTol(412,516,(172, 172, 172),5):
FFX_Xbox.menuB() #Found an Attribute sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 3:
if FFX_Screen.PixelTestTol(412,559,(173, 173, 173),5):
FFX_Xbox.menuB() #Found an Attribute sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
elif position == 4:
if FFX_Screen.PixelTestTol(412,603,(169, 169, 169),5):
FFX_Xbox.menuB() #Found an Attribute sphere
time.sleep(0.1)
found = 1
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
else:
if direction == 'd':
FFX_Xbox.menuDown()
if direction == 'u':
FFX_Xbox.menuUp()
if found == 1:
if shift == 'up':
gridUp()
if shift == 'left':
gridLeft()
if shift == 'l5':
gridLeft()
gridLeft()
gridLeft()
gridLeft()
gridLeft()
if shift == 'right':
gridRight()
if shift == 'r2':
gridRight()
gridRight()
if shift == 'down':
gridDown()
if shift == 'd2':
gridDown()
gridDown()
if shift == 'd5':
gridDown()
gridDown()
gridDown()
gridDown()
gridDown()
if shift == 'aftersk':
gridUp()
gridRight()
gridDown()
#gridDown()
if shift == 'aftersk2':
gridRight()
gridRight()
time.sleep(0.1)
gridLeft()
if shift == 'torikku':
gridDown()
gridDown()
gridLeft()
gridLeft()
if shift == 'yunaspec':
#Yuna Special
gridDown()
gridRight()
gridRight()
gridDown()
gridDown()
if found == 0:
if limit == 1:
limit = 0
print("Limit reached without success. Resetting.")
print("Reminder, sphere type: ", sType)
if direction == 'd' and FFX_Screen.PixelTestTol(681,611,(112, 111, 138),5):
#We've hit the bottom. Resetting.
#time.sleep(5)
while not FFX_Screen.PixelTestTol(680,440,(128, 127, 156),5):
FFX_Xbox.menuUp()
elif direction == 'u' and FFX_Screen.PixelTestTol(680,440,(128, 127, 156),5):
#We've hit the top. Resetting.
#time.sleep(5)
if color != 'red':
print("Item sort issue. Adjusting.")
while not FFX_Screen.PixelTestTol(681,611,(112, 111, 138),5):
FFX_Xbox.menuDown()
elif sType == 'power':
print("No need to shift. Power spheres are always at the top.")
limit = 1
elif sType == 'ability':
direction = 'd'
else:
while not FFX_Screen.PixelTestTol(681,611,(112, 111, 138),5):
FFX_Xbox.menuDown()
elif limit == 0:
if direction == 'd' and FFX_Screen.PixelTestTol(681,611,(112, 111, 138),5):
limit = 1
elif direction == 'u' and FFX_Screen.PixelTestTol(680,440,(128, 127, 156),5):
limit = 1