-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVSQ.ahk
More file actions
4674 lines (3925 loc) · 190 KB
/
VSQ.ahk
File metadata and controls
4674 lines (3925 loc) · 190 KB
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
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Requires AutoHotkey v2.0
; Download here: https://www.autohotkey.com/download/ahk-v2.exe
; ========================================
; VSQ.ahk - Vyris's Stormhalter QoL Improvement Mod - v1.5.0
; ========================================
; All user-configurable settings are in VSQ_Config.ini
; The VSQ_Config.ini is created after running the script the first time.
; ========================================
; ========================================
; 1. GLOBAL VARIABLES
; ========================================
; These variables are managed by the script and should not be edited manually
ConfigFile := "VSQ_Config.ini"
LogFile := "VSQ_Debug.log"
GameWindowTitle := "ahk_exe Kesmai.Client.exe"
GameRunning := false
; ========================================
; GAME SETTINGS
; ========================================
GamePath := "C:\Program Files\Stormhalter\"
GameExecutable := "Kesmai.Client.exe"
AutoClickLogin := true
LoginButtonX := 0
LoginButtonY := 0
UseSecondaryMonitor := true
SecondaryMonitorNumber := 3
AutoMaximizeWindow := true
BackupFolder := "VSQ_Backups"
; ========================================
; TIMING SETTINGS
; ========================================
ShortDelay := 32
MediumDelay := 64
LongDelay := 128
TooltipDisplayTime := 2048
AutoLoopInterval := 100
CoinRoundTimerDelay := 1064
LoginDelay := 200
MouseClickCooldown := 2000
GameMonitorInterval := 2000
; ========================================
; LOGGING SETTINGS
; ========================================
EnableDebugLogging := false
EnableBackups := false
BackupConfigOnly := true
; ========================================
; CHARACTER PROFILES
; ========================================
MaxProfiles := 9
CurrentProfile := 1
Profile1Name := "Profile 1"
Profile2Name := "Profile 2"
Profile3Name := "Profile 3"
Profile4Name := "Profile 4"
Profile5Name := "Profile 5"
Profile6Name := "Profile 6"
Profile7Name := "Profile 7"
Profile8Name := "Profile 8"
Profile9Name := "Profile 9"
; ========================================
; PROFILE-SPECIFIC SETTINGS (PROFILE X sections)
; ========================================
; Note: These are loaded/saved per profile, but stored as global variables for current profile
; Auto settings
EnableAuto := false ; Script-only variable, controlled by Middle Click
ManualActionInProgress := false ; Flag to prevent auto mode from executing during manual hotkey actions
EnableHealthMonitoring := true
EnableManaMonitoring := true
AttackKey1 := ""
AttackKey2 := ""
EnableAttackKey2 := true
AttackSpamReduction := true
DrinkKey := ""
HealthAreaX := 0
HealthAreaY := 0
ManaAreaX := 0
ManaAreaY := 0
CreatureAreaX := 0
CreatureAreaY := 0
ShieldCoordinatesX := 0
ShieldCoordinatesY := 0
PalyShieldDelay := 3500 ; Delay in milliseconds between shield attacks
LastPalyShieldTime := 0 ; Track when shield attack was last executed
PalyShieldQueued := false ; Track if shield attack is queued
; MASkill settings
EnableMASkill := false
MAFistsKey := ""
MARestockKey := ""
CurrentMASkill := "restock"
PotionsPerRestock := 1
UsedPotionsCount := 0
; Knight Heal settings
EnableKnightHeal := false
KnightHealKey := ""
; Coin pickup settings
MoneyRingKey := ""
CoinAreaTopLeftX := 0
CoinAreaTopLeftY := 0
CoinAreaBottomRightX := 0
CoinAreaBottomRightY := 0
; Active spell scrolling settings
EnableActiveSpellScrolling := false
ActiveSpellsLeftX := 0
ActiveSpellsLeftY := 0
ActiveSpellsRightX := 0
ActiveSpellsRightY := 0
ActiveSpellGoneX := 0
ActiveSpellGoneY := 0
LastMouseClickTime := A_TickCount ; Track when mouse was last clicked
MousePositionTooltipActive := false ; Track if mouse position tooltip is active
; Spell casting settings
EnableSpellCasting := false
SpellCastingDelay := 5000 ; Delay in milliseconds between spell casts
EnableSpellCreatureCheck := true ; Check for creatures before casting spells
LastSpellCastTime := 0 ; Track when spell was last cast
WarmSpellKey := ""
CastSpellKey := ""
WarmedSpellX := 0
WarmedSpellY := 0
; 2nd Spell casting settings
EnableSpellCasting2 := false
SpellCastingDelay2 := 5000 ; Delay in milliseconds between 2nd spell casts
EnableSpellCreatureCheck2 := true ; Check for creatures before casting 2nd spells
LastSpellCastTime2 := 0 ; Track when 2nd spell was last cast
WarmSpellKey2 := ""
CastSpellKey2 := ""
; 3rd Spell casting settings
EnableSpellCasting3 := false
SpellCastingDelay3 := 5000 ; Delay in milliseconds between 3rd spell casts
EnableSpellCreatureCheck3 := true ; Check for creatures before casting 3rd spells
LastSpellCastTime3 := 0 ; Track when 3rd spell was last cast
WarmSpellKey3 := ""
CastSpellKey3 := ""
; Track which spell is currently warmed (1, 2, 3, or 0 for unknown)
CurrentWarmedSpell := 0
; Fumble recovery settings
RecoverFumbleMain := false
RecoverFumbleOffhand := false
RecoverMainKey := ""
RecoverOffhandKey := ""
MainHandX := 0
MainHandY := 0
OffHandX := 0
OffHandY := 0
; Creature list verification settings
EnableCreatureListVerification := false
CritListVerifyX := 0
CritListVerifyY := 0
ReadyCursorHashes := [] ; Array of hashes for "ready" cursors (populate via hotkey)
; ========================================
; 2. CONFIGURATION FUNCTIONS
; ========================================
; Function to load configuration from file
LoadConfig(profileToLoad := "") {
global ConfigFile
global GamePath, GameExecutable, AutoClickLogin, LoginButtonX, LoginButtonY, UseSecondaryMonitor, SecondaryMonitorNumber, AutoMaximizeWindow, BackupFolder
global ShortDelay, MediumDelay, LongDelay, TooltipDisplayTime, AutoLoopInterval, CoinRoundTimerDelay, LoginDelay, MouseClickCooldown, GameMonitorInterval, EnableDebugLogging, EnableBackups, BackupConfigOnly
global MaxProfiles, CurrentProfile, Profile1Name, Profile2Name, Profile3Name, Profile4Name, Profile5Name, Profile6Name, Profile7Name, Profile8Name, Profile9Name
global EnableAuto, EnableHealthMonitoring, EnableManaMonitoring, AttackKey1, AttackKey2, EnableAttackKey2, AttackSpamReduction, DrinkKey, HealthAreaX, HealthAreaY, ManaAreaX, ManaAreaY, CreatureAreaX, CreatureAreaY, ShieldCoordinatesX, ShieldCoordinatesY, PalyShieldDelay, EnableMASkill, MAFistsKey, MARestockKey, CurrentMASkill, EnableKnightHeal, KnightHealKey, CoinAreaTopLeftX, CoinAreaTopLeftY, CoinAreaBottomRightX, CoinAreaBottomRightY, CoinRoundTimerDelay, EnableActiveSpellScrolling, ActiveSpellsLeftX, ActiveSpellsLeftY, ActiveSpellsRightX, ActiveSpellsRightY, ActiveSpellGoneX, ActiveSpellGoneY, EnableSpellCasting, SpellCastingDelay, EnableSpellCreatureCheck, LastSpellCastTime, WarmSpellKey, CastSpellKey, WarmedSpellX, WarmedSpellY, EnableSpellCasting2, SpellCastingDelay2, EnableSpellCreatureCheck2, LastSpellCastTime2, WarmSpellKey2, CastSpellKey2, EnableSpellCasting3, SpellCastingDelay3, EnableSpellCreatureCheck3, LastSpellCastTime3, WarmSpellKey3, CastSpellKey3, CurrentWarmedSpell, RecoverFumbleMain, RecoverFumbleOffhand, RecoverMainKey, RecoverOffhandKey, MainHandX, MainHandY, OffHandX, OffHandY, EnableCreatureListVerification, CritListVerifyX, CritListVerifyY, PotionsPerRestock, UsedPotionsCount
global ReadyCursorHashes
static hashString
; Create default config if it doesn't exist
if (!FileExist(ConfigFile)) {
CreateDefaultConfig()
LogMessage("Created default configuration file: " . ConfigFile)
return
}
try {
; Load settings from config file using IniRead
GamePath := IniRead(ConfigFile, "GAME SETTINGS", "GamePath", GamePath)
GameExecutable := IniRead(ConfigFile, "GAME SETTINGS", "GameExecutable", GameExecutable)
AutoClickLogin := (IniRead(ConfigFile, "GAME SETTINGS", "AutoClickLogin", AutoClickLogin ? "true" : "false") = "true")
LoginButtonX := IniRead(ConfigFile, "GAME SETTINGS", "LoginButtonX", LoginButtonX)
LoginButtonY := IniRead(ConfigFile, "GAME SETTINGS", "LoginButtonY", LoginButtonY)
UseSecondaryMonitor := (IniRead(ConfigFile, "GAME SETTINGS", "UseSecondaryMonitor", UseSecondaryMonitor ? "true" : "false") = "true")
SecondaryMonitorNumber := IniRead(ConfigFile, "GAME SETTINGS", "SecondaryMonitorNumber", SecondaryMonitorNumber)
AutoMaximizeWindow := (IniRead(ConfigFile, "GAME SETTINGS", "AutoMaximizeWindow", AutoMaximizeWindow ? "true" : "false") = "true")
BackupFolder := IniRead(ConfigFile, "GAME SETTINGS", "BackupFolder", BackupFolder)
ShortDelay := IniRead(ConfigFile, "TIMING SETTINGS", "ShortDelay", ShortDelay)
MediumDelay := IniRead(ConfigFile, "TIMING SETTINGS", "MediumDelay", MediumDelay)
LongDelay := IniRead(ConfigFile, "TIMING SETTINGS", "LongDelay", LongDelay)
TooltipDisplayTime := IniRead(ConfigFile, "TIMING SETTINGS", "TooltipDisplayTime", TooltipDisplayTime)
AutoLoopInterval := IniRead(ConfigFile, "TIMING SETTINGS", "AutoLoopInterval", AutoLoopInterval)
CoinRoundTimerDelay := IniRead(ConfigFile, "TIMING SETTINGS", "CoinRoundTimerDelay", CoinRoundTimerDelay)
LoginDelay := IniRead(ConfigFile, "TIMING SETTINGS", "LoginDelay", LoginDelay)
MouseClickCooldown := IniRead(ConfigFile, "TIMING SETTINGS", "MouseClickCooldown", MouseClickCooldown)
GameMonitorInterval := IniRead(ConfigFile, "TIMING SETTINGS", "GameMonitorInterval", GameMonitorInterval)
EnableDebugLogging := (IniRead(ConfigFile, "LOGGING SETTINGS", "EnableDebugLogging", EnableDebugLogging ? "true" : "false") = "true")
EnableBackups := (IniRead(ConfigFile, "LOGGING SETTINGS", "EnableBackups", EnableBackups ? "true" : "false") = "true")
BackupConfigOnly := (IniRead(ConfigFile, "LOGGING SETTINGS", "BackupConfigOnly", BackupConfigOnly ? "true" : "false") = "true")
; Coin pickup settings are now handled elsewhere (CoinRoundTimerDelay in TIMING SETTINGS)
; Load character profile settings
MaxProfiles := IniRead(ConfigFile, "CHARACTER PROFILES", "MaxProfiles", MaxProfiles)
if (profileToLoad != "") {
CurrentProfile := profileToLoad
} else {
CurrentProfile := IniRead(ConfigFile, "CHARACTER PROFILES", "CurrentProfile", CurrentProfile)
}
Profile1Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile1Name", Profile1Name)
Profile2Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile2Name", Profile2Name)
Profile3Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile3Name", Profile3Name)
Profile4Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile4Name", Profile4Name)
Profile5Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile5Name", Profile5Name)
Profile6Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile6Name", Profile6Name)
Profile7Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile7Name", Profile7Name)
Profile8Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile8Name", Profile8Name)
Profile9Name := IniRead(ConfigFile, "CHARACTER PROFILES", "Profile9Name", Profile9Name)
; Load current profile's auto settings
LoadProfileAutoSettings(CurrentProfile)
; Load cursor hashes
hashString := IniRead(ConfigFile, "CURSOR SETTINGS", "ReadyCursorHashes", "")
if (hashString != "") {
ReadyCursorHashes := StrSplit(hashString, ",")
}
LogMessage("Loaded " . ReadyCursorHashes.Length . " ready cursor hashes")
LogMessage("Configuration loaded successfully")
LogMessage("GamePath loaded as: " . GamePath)
LogMessage("Current profile: " . CurrentProfile . " - " . GetProfileName(CurrentProfile))
return true
} catch Error as e {
LogMessage("Error loading configuration: " . e.Message)
return false
}
}
; Function to save hotkey settings to config file
; Function to create default configuration file
CreateDefaultConfig() {
global ConfigFile
defaultConfig := "; VSQ Configuration File`n"
defaultConfig .= "; Edit these settings as needed - do not edit the main script`n"
defaultConfig .= "; *** IMPORTANT SETUP INSTRUCTIONS ***`n"
defaultConfig .= "; You MUST either:`n"
defaultConfig .= "; 1) Update the GamePath below to point to your Stormhalter folder, OR`n"
defaultConfig .= "; 2) Place this script in the same folder as Kesmai.Client.exe`n"
defaultConfig .= "; The script will automatically check both locations`n`n"
defaultConfig .= "[GAME SETTINGS]`n"
defaultConfig .= "GamePath=C:\Program Files\Stormhalter\`n"
defaultConfig .= "GameExecutable=Kesmai.Client.exe`n"
defaultConfig .= "AutoClickLogin=true`n"
defaultConfig .= "LoginButtonX=0`n"
defaultConfig .= "LoginButtonY=0`n"
defaultConfig .= "UseSecondaryMonitor=true`n"
defaultConfig .= "SecondaryMonitorNumber=3`n"
defaultConfig .= "AutoMaximizeWindow=true`n"
defaultConfig .= "BackupFolder=VSQ_Backups`n`n"
defaultConfig .= "[TIMING SETTINGS]`n"
defaultConfig .= "ShortDelay=32`n"
defaultConfig .= "MediumDelay=64`n"
defaultConfig .= "LongDelay=128`n"
defaultConfig .= "TooltipDisplayTime=2048`n"
defaultConfig .= "AutoLoopInterval=128`n"
defaultConfig .= "CoinRoundTimerDelay=1064`n"
defaultConfig .= "LoginDelay=200`n"
defaultConfig .= "MouseClickCooldown=2000`n"
defaultConfig .= "GameMonitorInterval=2000`n"
defaultConfig .= "[LOGGING SETTINGS]`n"
defaultConfig .= "EnableDebugLogging=false`n"
defaultConfig .= "EnableBackups=false`n"
defaultConfig .= "BackupConfigOnly=true`n"
defaultConfig .= "`n"
defaultConfig .= "[CHARACTER PROFILES]`n"
defaultConfig .= "MaxProfiles=9`n"
defaultConfig .= "CurrentProfile=1`n"
defaultConfig .= "Profile1Name=Profile 1`n"
defaultConfig .= "Profile2Name=Profile 2`n"
defaultConfig .= "Profile3Name=Profile 3`n"
defaultConfig .= "Profile4Name=Profile 4`n"
defaultConfig .= "Profile5Name=Profile 5`n"
defaultConfig .= "Profile6Name=Profile 6`n"
defaultConfig .= "Profile7Name=Profile 7`n"
defaultConfig .= "Profile8Name=Profile 8`n"
defaultConfig .= "Profile9Name=Profile 9`n`n"
; Add profile-specific auto settings for all 9 profiles
Loop 9 {
profileNum := A_Index
defaultConfig .= "[PROFILE " . profileNum . "]`n"
defaultConfig .= "EnableHealthMonitoring=true`n"
defaultConfig .= "EnableManaMonitoring=true`n"
defaultConfig .= "AttackKey1=`n"
defaultConfig .= "AttackKey2=`n"
defaultConfig .= "EnableAttackKey2=true`n"
defaultConfig .= "AttackSpamReduction=false`n"
defaultConfig .= "DrinkKey=`n"
defaultConfig .= "HealthAreaX=0`n"
defaultConfig .= "HealthAreaY=0`n"
defaultConfig .= "ManaAreaX=0`n"
defaultConfig .= "ManaAreaY=0`n"
defaultConfig .= "CreatureAreaX=0`n"
defaultConfig .= "CreatureAreaY=0`n"
defaultConfig .= "ShieldCoordinatesX=0`n"
defaultConfig .= "ShieldCoordinatesY=0`n"
defaultConfig .= "PalyShieldDelay=3500`n"
defaultConfig .= "EnableMASkill=false`n"
defaultConfig .= "MAFistsKey=`n"
defaultConfig .= "MARestockKey=`n"
defaultConfig .= "CurrentMASkill=restock`n"
defaultConfig .= "EnableKnightHeal=false`n"
defaultConfig .= "KnightHealKey=`n"
defaultConfig .= "MoneyRingKey=`n"
defaultConfig .= "EnableActiveSpellScrolling=false`n"
defaultConfig .= "ActiveSpellsLeftX=0`n"
defaultConfig .= "ActiveSpellsLeftY=0`n"
defaultConfig .= "ActiveSpellsRightX=0`n"
defaultConfig .= "ActiveSpellsRightY=0`n"
defaultConfig .= "ActiveSpellGoneX=0`n"
defaultConfig .= "ActiveSpellGoneY=0`n"
defaultConfig .= "EnableSpellCasting=false`n"
defaultConfig .= "SpellCastingDelay=5000`n"
defaultConfig .= "EnableSpellCreatureCheck=true`n"
defaultConfig .= "WarmSpellKey=`n"
defaultConfig .= "CastSpellKey=`n"
defaultConfig .= "WarmedSpellX=0`n"
defaultConfig .= "WarmedSpellY=0`n"
defaultConfig .= "EnableSpellCasting2=false`n"
defaultConfig .= "SpellCastingDelay2=5000`n"
defaultConfig .= "EnableSpellCreatureCheck2=true`n"
defaultConfig .= "WarmSpellKey2=`n"
defaultConfig .= "CastSpellKey2=`n"
defaultConfig .= "EnableSpellCasting3=false`n"
defaultConfig .= "SpellCastingDelay3=5000`n"
defaultConfig .= "EnableSpellCreatureCheck3=true`n"
defaultConfig .= "WarmSpellKey3=`n"
defaultConfig .= "CastSpellKey3=`n"
defaultConfig .= "RecoverFumbleMain=false`n"
defaultConfig .= "RecoverFumbleOffhand=false`n"
defaultConfig .= "RecoverMainKey=`n"
defaultConfig .= "RecoverOffhandKey=`n"
defaultConfig .= "MainHandX=0`n"
defaultConfig .= "MainHandY=0`n"
defaultConfig .= "OffHandX=0`n"
defaultConfig .= "OffHandY=0`n"
defaultConfig .= "EnableCreatureListVerification=false`n"
defaultConfig .= "CritListVerifyX=0`n"
defaultConfig .= "CritListVerifyY=0`n"
defaultConfig .= "CoinAreaTopLeftX=0`n"
defaultConfig .= "CoinAreaTopLeftY=0`n"
defaultConfig .= "CoinAreaBottomRightX=0`n"
defaultConfig .= "CoinAreaBottomRightY=0`n`n"
}
defaultConfig .= "[CURSOR SETTINGS]`n"
defaultConfig .= "; Comma-separated hashes, e.g., abc123,def456"
defaultConfig .= "ReadyCursorHashes=76eec8d1,3b61f171,77acfae0`n`n"
try {
FileAppend(defaultConfig, ConfigFile)
return true
} catch Error as e {
LogMessage("Error creating default config: " . e.Message)
return false
}
}
; ========================================
; 3. UTILITY FUNCTIONS
; ========================================
; Function to log messages with timestamp
LogMessage(message) {
global LogFile, EnableDebugLogging
if (!EnableDebugLogging) {
return
}
; Create timestamp with milliseconds
timestamp := FormatTime(A_Now, "yyyy-MM-dd HH:mm:ss.") . A_MSec
; Format log entry
logEntry := "[" . timestamp . "] " . message . "`n"
try {
FileAppend(logEntry, LogFile)
} catch Error as e {
; If logging fails, show in tooltip as fallback
; ToolTip("Log Error: " . e.Message)
; SetTimer(() => ToolTip(), -TooltipDisplayTime)
}
}
; ========================================
; 3.2 BACKUP FUNCTIONS
; ========================================
; Function to create backup of script and/or config
CreateBackup() {
global BackupFolder, ConfigFile, EnableBackups, BackupConfigOnly
if (!EnableBackups) {
return true
}
try {
; Create backup folder if it doesn't exist
if (!DirExist(BackupFolder)) {
DirCreate(BackupFolder)
}
; Generate timestamp
timestamp := FormatTime(A_Now, "yyyyMMdd_HHmmss")
backupFiles := []
; Backup script file (unless config-only mode)
if (!BackupConfigOnly) {
scriptBackup := BackupFolder . "\VSQ_Backup_" . timestamp . ".ahk"
FileCopy(A_ScriptFullPath, scriptBackup)
backupFiles.Push(scriptBackup)
}
; Backup config file if it exists
if (FileExist(ConfigFile)) {
configBackup := BackupFolder . "\VSQ_Config_Backup_" . timestamp . ".ini"
FileCopy(ConfigFile, configBackup)
backupFiles.Push(configBackup)
}
; Log what was backed up
if (backupFiles.Length > 0) {
LogMessage("Backup created: " . backupFiles[1] . (backupFiles.Length > 1 ? " and " . backupFiles[2] : ""))
}
return true
} catch Error as e {
LogMessage("Error creating backup: " . e.Message)
return false
}
}
; ========================================
; 3.3 GAME MANAGEMENT FUNCTIONS
; ========================================
; Function to launch the game
LaunchGame() {
global GamePath, GameExecutable, AutoClickLogin, AutoMaximizeWindow, UseSecondaryMonitor, SecondaryMonitorNumber
LogMessage("Starting game launch sequence")
; Check if game is already running
if (IsGameRunning()) {
LogMessage("Game is already running")
return true
}
try {
; First, try the configured path
; Ensure GamePath ends with backslash
if (!InStr(GamePath, "\", , -1)) {
GamePath := GamePath . "\"
}
fullPath := GamePath . GameExecutable
LogMessage("Attempting to launch: " . fullPath)
; Check if the executable exists at the configured path
if (!FileExist(fullPath)) {
LogMessage("Game executable not found at configured path: " . fullPath)
; Check if the executable is in the same folder as the script
scriptDir := A_ScriptDir . "\"
scriptPath := scriptDir . GameExecutable
LogMessage("Checking script directory: " . scriptPath)
if (FileExist(scriptPath)) {
LogMessage("Found game executable in script directory, using that instead")
fullPath := scriptPath
GamePath := scriptDir
} else {
LogMessage("Error: Game executable not found at either location")
LogMessage("Checked paths: " . fullPath . " and " . scriptPath)
return false
}
}
; Launch the game
Run(fullPath, GamePath)
LogMessage("Game executable launched from: " . GamePath)
; Wait for game window to appear
if (WaitForGameWindow()) {
LogMessage("Game window detected")
; Move to secondary monitor first if configured
if (UseSecondaryMonitor) {
MoveToSecondaryMonitor()
}
; Then maximize window if configured
if (AutoMaximizeWindow) {
WinMaximize(GameWindowTitle)
LogMessage("Game window maximized")
}
; Auto-click login if configured
if (AutoClickLogin) {
ClickLoginButton()
}
LogMessage("Game launch sequence completed successfully")
return true
} else {
LogMessage("Error: Game window not detected within timeout")
return false
}
} catch Error as e {
LogMessage("Error launching game: " . e.Message)
return false
}
}
; Function to wait for game window to appear
WaitForGameWindow() {
global GameWindowTitle
; Wait up to 15 seconds for game window
startTime := A_TickCount
timeout := 15000
while ((A_TickCount - startTime) < timeout) {
if (WinExist(GameWindowTitle)) {
; Check if window is actually visible and reasonably sized
WinGetPos(&x, &y, &width, &height, GameWindowTitle)
if (width > 200 && height > 200) {
return true
}
}
Sleep(LongDelay) ; Check every LongDelay
}
return false
}
; Function to move game to secondary monitor
MoveToSecondaryMonitor() {
global GameWindowTitle, SecondaryMonitorNumber
try {
; Get secondary monitor info
MonitorGet(SecondaryMonitorNumber, &Left, &Top, &Right, &Bottom)
; Get current window size to preserve it
WinGetPos(¤tX, ¤tY, ¤tWidth, ¤tHeight, GameWindowTitle)
; Move window to secondary monitor without changing size
WinMove(Left, Top, currentWidth, currentHeight, GameWindowTitle)
LogMessage("Game moved to secondary monitor " . SecondaryMonitorNumber . " at " . Left . "," . Top)
} catch Error as e {
LogMessage("Error moving to secondary monitor: " . e.Message)
}
}
; Function to click login button
ClickLoginButton() {
global LoginButtonX, LoginButtonY, GameWindowTitle, LongDelay
if (LoginButtonX = 0 && LoginButtonY = 0) {
LogMessage("Login button coordinates not set - use Ctrl+Shift+L to set them")
return
}
; Click relative to the game window using button down/up events
if (WinExist(GameWindowTitle)) {
LogMessage("Clicking login button at relative coordinates " . LoginButtonX . "," . LoginButtonY . " within game window")
; Move mouse to coordinates first, then click (login screen needs this approach)
WinActivate(GameWindowTitle)
MouseMove(LoginButtonX, LoginButtonY)
Sleep(LongDelay) ; Brief delay to ensure UI registers mouse position
SendClick("Left", 0, LoginButtonX, LoginButtonY) ; Click at current mouse position
LogMessage("Login button click sequence completed")
} else {
LogMessage("Game window not found - cannot click login button")
}
}
; Function to check mouse button states
CheckMouseButtons() {
global LastMouseClickTime
static lastLeftState := 0, lastRightState := 0, lastMiddleState := 0
; Check current mouse button states
currentLeftState := GetKeyState("LButton")
currentRightState := GetKeyState("RButton")
currentMiddleState := GetKeyState("MButton")
; Detect button press (state changed from 0 to 1)
if (currentLeftState && !lastLeftState) {
LastMouseClickTime := A_TickCount
LogMessage("Left mouse click detected - LastMouseClickTime updated")
}
if (currentRightState && !lastRightState) {
LastMouseClickTime := A_TickCount
LogMessage("Right mouse click detected - LastMouseClickTime updated")
}
if (currentMiddleState && !lastMiddleState) {
LastMouseClickTime := A_TickCount
LogMessage("Middle mouse click detected - LastMouseClickTime updated")
}
; Update states for next check
lastLeftState := currentLeftState
lastRightState := currentRightState
lastMiddleState := currentMiddleState
}
; Function to monitor game window and exit script if game closes
MonitorGameWindow() {
global GameRunning, GameWindowTitle, EnableActiveSpellScrolling, LastMouseClickTime, GUIOpen
if (WinExist(GameWindowTitle)) {
if (!GameRunning) {
GameRunning := true
LogMessage("Game window detected - script ready")
}
; Check active spell scrolling if enabled
if (EnableActiveSpellScrolling) {
; Check if enough time has passed since last click (2 seconds)
currentTime := A_TickCount
if ((currentTime - LastMouseClickTime) >= MouseClickCooldown) {
LogMessage("Executing active spell scrolling - no recent clicks")
ExecuteActiveSpellScrolling()
} else {
LogMessage("Skipping active spell scrolling - recent click detected")
}
}
} else {
if (GameRunning) {
GameRunning := false
; Only exit if GUI is not open
if (!GUIOpen) {
LogMessage("Game window closed - exiting script")
ExitApp()
} else {
LogMessage("Game window closed - but GUI is open, script continues running")
}
}
}
}
; ========================================
; 3.4 PROFILE MANAGEMENT FUNCTIONS
; ========================================
; Function to get profile name by number
GetProfileName(profileNumber) {
global Profile1Name, Profile2Name, Profile3Name, Profile4Name, Profile5Name, Profile6Name, Profile7Name, Profile8Name, Profile9Name
switch profileNumber {
case 1: return Profile1Name
case 2: return Profile2Name
case 3: return Profile3Name
case 4: return Profile4Name
case 5: return Profile5Name
case 6: return Profile6Name
case 7: return Profile7Name
case 8: return Profile8Name
case 9: return Profile9Name
default: return "Unknown Profile"
}
}
; Function to save profile name
SaveProfileName(profileNumber, profileName) {
global Profile1Name, Profile2Name, Profile3Name, Profile4Name, Profile5Name, Profile6Name, Profile7Name, Profile8Name, Profile9Name
global ConfigFile
try {
; Update the global variable
switch profileNumber {
case 1: Profile1Name := profileName
case 2: Profile2Name := profileName
case 3: Profile3Name := profileName
case 4: Profile4Name := profileName
case 5: Profile5Name := profileName
case 6: Profile6Name := profileName
case 7: Profile7Name := profileName
case 8: Profile8Name := profileName
case 9: Profile9Name := profileName
default: return false
}
; Save to config file
IniWrite(profileName, ConfigFile, "CHARACTER PROFILES", "Profile" . profileNumber . "Name")
LogMessage("Profile " . profileNumber . " name saved as: " . profileName)
return true
} catch Error as e {
LogMessage("Error saving profile name: " . e.Message)
return false
}
}
; Function to load auto settings for a specific profile
LoadProfileAutoSettings(profileNumber) {
global ConfigFile
global EnableAuto, EnableHealthMonitoring, EnableManaMonitoring, AttackKey1, AttackKey2, EnableAttackKey2, AttackSpamReduction, DrinkKey, HealthAreaX, HealthAreaY, ManaAreaX, ManaAreaY, CreatureAreaX, CreatureAreaY, ShieldCoordinatesX, ShieldCoordinatesY, PalyShieldDelay, EnableMASkill, MAFistsKey, MARestockKey, CurrentMASkill, EnableKnightHeal, KnightHealKey, MoneyRingKey, EnableActiveSpellScrolling, ActiveSpellsLeftX, ActiveSpellsLeftY, ActiveSpellsRightX, ActiveSpellsRightY, ActiveSpellGoneX, ActiveSpellGoneY, EnableSpellCasting, SpellCastingDelay, EnableSpellCreatureCheck, LastSpellCastTime, WarmSpellKey, CastSpellKey, WarmedSpellX, WarmedSpellY, EnableSpellCasting2, SpellCastingDelay2, EnableSpellCreatureCheck2, LastSpellCastTime2, WarmSpellKey2, CastSpellKey2, EnableSpellCasting3, SpellCastingDelay3, EnableSpellCreatureCheck3, LastSpellCastTime3, WarmSpellKey3, CastSpellKey3, CurrentWarmedSpell, RecoverFumbleMain, RecoverFumbleOffhand, RecoverMainKey, RecoverOffhandKey, MainHandX, MainHandY, OffHandX, OffHandY, CritListVerifyX, CritListVerifyY, AutoClickLogin, LoginButtonX, LoginButtonY, CoinAreaTopLeftX, CoinAreaTopLeftY, CoinAreaBottomRightX, CoinAreaBottomRightY, EnableCreatureListVerification, PotionsPerRestock, UsedPotionsCount
sectionName := "PROFILE " . profileNumber
try {
EnableHealthMonitoring := (IniRead(ConfigFile, sectionName, "EnableHealthMonitoring", EnableHealthMonitoring ? "true" : "false") = "true")
EnableManaMonitoring := (IniRead(ConfigFile, sectionName, "EnableManaMonitoring", EnableManaMonitoring ? "true" : "false") = "true")
AttackKey1 := IniRead(ConfigFile, sectionName, "AttackKey1", AttackKey1)
AttackKey2 := IniRead(ConfigFile, sectionName, "AttackKey2", AttackKey2)
EnableAttackKey2 := (IniRead(ConfigFile, sectionName, "EnableAttackKey2", EnableAttackKey2 ? "true" : "false") = "true")
AttackSpamReduction := (IniRead(ConfigFile, sectionName, "AttackSpamReduction", AttackSpamReduction ? "true" : "false") = "true")
DrinkKey := IniRead(ConfigFile, sectionName, "DrinkKey", DrinkKey)
HealthAreaX := IniRead(ConfigFile, sectionName, "HealthAreaX", HealthAreaX)
HealthAreaY := IniRead(ConfigFile, sectionName, "HealthAreaY", HealthAreaY)
ManaAreaX := IniRead(ConfigFile, sectionName, "ManaAreaX", ManaAreaX)
ManaAreaY := IniRead(ConfigFile, sectionName, "ManaAreaY", ManaAreaY)
CreatureAreaX := IniRead(ConfigFile, sectionName, "CreatureAreaX", CreatureAreaX)
CreatureAreaY := IniRead(ConfigFile, sectionName, "CreatureAreaY", CreatureAreaY)
ShieldCoordinatesX := IniRead(ConfigFile, sectionName, "ShieldCoordinatesX", ShieldCoordinatesX)
ShieldCoordinatesY := IniRead(ConfigFile, sectionName, "ShieldCoordinatesY", ShieldCoordinatesY)
PalyShieldDelay := IniRead(ConfigFile, sectionName, "PalyShieldDelay", PalyShieldDelay)
EnableMASkill := (IniRead(ConfigFile, sectionName, "EnableMASkill", EnableMASkill ? "true" : "false") = "true")
MAFistsKey := IniRead(ConfigFile, sectionName, "MAFistsKey", MAFistsKey)
MARestockKey := IniRead(ConfigFile, sectionName, "MARestockKey", MARestockKey)
CurrentMASkill := IniRead(ConfigFile, sectionName, "CurrentMASkill", CurrentMASkill)
PotionsPerRestock := IniRead(ConfigFile, sectionName, "PotionsPerRestock", PotionsPerRestock)
UsedPotionsCount := IniRead(ConfigFile, sectionName, "UsedPotionsCount", UsedPotionsCount)
EnableKnightHeal := (IniRead(ConfigFile, sectionName, "EnableKnightHeal", EnableKnightHeal ? "true" : "false") = "true")
KnightHealKey := IniRead(ConfigFile, sectionName, "KnightHealKey", KnightHealKey)
MoneyRingKey := IniRead(ConfigFile, sectionName, "MoneyRingKey", MoneyRingKey)
EnableActiveSpellScrolling := (IniRead(ConfigFile, sectionName, "EnableActiveSpellScrolling", EnableActiveSpellScrolling ? "true" : "false") = "true")
ActiveSpellsLeftX := IniRead(ConfigFile, sectionName, "ActiveSpellsLeftX", ActiveSpellsLeftX)
ActiveSpellsLeftY := IniRead(ConfigFile, sectionName, "ActiveSpellsLeftY", ActiveSpellsLeftY)
ActiveSpellsRightX := IniRead(ConfigFile, sectionName, "ActiveSpellsRightX", ActiveSpellsRightX)
ActiveSpellsRightY := IniRead(ConfigFile, sectionName, "ActiveSpellsRightY", ActiveSpellsRightY)
ActiveSpellGoneX := IniRead(ConfigFile, sectionName, "ActiveSpellGoneX", ActiveSpellGoneX)
ActiveSpellGoneY := IniRead(ConfigFile, sectionName, "ActiveSpellGoneY", ActiveSpellGoneY)
EnableSpellCasting := (IniRead(ConfigFile, sectionName, "EnableSpellCasting", EnableSpellCasting ? "true" : "false") = "true")
SpellCastingDelay := IniRead(ConfigFile, sectionName, "SpellCastingDelay", SpellCastingDelay)
EnableSpellCreatureCheck := (IniRead(ConfigFile, sectionName, "EnableSpellCreatureCheck", EnableSpellCreatureCheck ? "true" : "false") = "true")
WarmSpellKey := IniRead(ConfigFile, sectionName, "WarmSpellKey", WarmSpellKey)
CastSpellKey := IniRead(ConfigFile, sectionName, "CastSpellKey", CastSpellKey)
WarmedSpellX := IniRead(ConfigFile, sectionName, "WarmedSpellX", WarmedSpellX)
WarmedSpellY := IniRead(ConfigFile, sectionName, "WarmedSpellY", WarmedSpellY)
EnableSpellCasting2 := (IniRead(ConfigFile, sectionName, "EnableSpellCasting2", EnableSpellCasting2 ? "true" : "false") = "true")
SpellCastingDelay2 := IniRead(ConfigFile, sectionName, "SpellCastingDelay2", SpellCastingDelay2)
EnableSpellCreatureCheck2 := (IniRead(ConfigFile, sectionName, "EnableSpellCreatureCheck2", EnableSpellCreatureCheck2 ? "true" : "false") = "true")
WarmSpellKey2 := IniRead(ConfigFile, sectionName, "WarmSpellKey2", WarmSpellKey2)
CastSpellKey2 := IniRead(ConfigFile, sectionName, "CastSpellKey2", CastSpellKey2)
EnableSpellCasting3 := (IniRead(ConfigFile, sectionName, "EnableSpellCasting3", EnableSpellCasting3 ? "true" : "false") = "true")
SpellCastingDelay3 := IniRead(ConfigFile, sectionName, "SpellCastingDelay3", SpellCastingDelay3)
EnableSpellCreatureCheck3 := (IniRead(ConfigFile, sectionName, "EnableSpellCreatureCheck3", EnableSpellCreatureCheck3 ? "true" : "false") = "true")
WarmSpellKey3 := IniRead(ConfigFile, sectionName, "WarmSpellKey3", WarmSpellKey3)
CastSpellKey3 := IniRead(ConfigFile, sectionName, "CastSpellKey3", CastSpellKey3)
RecoverFumbleMain := (IniRead(ConfigFile, sectionName, "RecoverFumbleMain", RecoverFumbleMain ? "true" : "false") = "true")
RecoverFumbleOffhand := (IniRead(ConfigFile, sectionName, "RecoverFumbleOffhand", RecoverFumbleOffhand ? "true" : "false") = "true")
RecoverMainKey := IniRead(ConfigFile, sectionName, "RecoverMainKey", RecoverMainKey)
RecoverOffhandKey := IniRead(ConfigFile, sectionName, "RecoverOffhandKey", RecoverOffhandKey)
MainHandX := IniRead(ConfigFile, sectionName, "MainHandX", MainHandX)
MainHandY := IniRead(ConfigFile, sectionName, "MainHandY", MainHandY)
OffHandX := IniRead(ConfigFile, sectionName, "OffHandX", OffHandX)
OffHandY := IniRead(ConfigFile, sectionName, "OffHandY", OffHandY)
EnableCreatureListVerification := (IniRead(ConfigFile, sectionName, "EnableCreatureListVerification", EnableCreatureListVerification ? "true" : "false") = "true")
CritListVerifyX := IniRead(ConfigFile, sectionName, "CritListVerifyX", CritListVerifyX)
CritListVerifyY := IniRead(ConfigFile, sectionName, "CritListVerifyY", CritListVerifyY)
CoinAreaTopLeftX := IniRead(ConfigFile, sectionName, "CoinAreaTopLeftX", CoinAreaTopLeftX)
CoinAreaTopLeftY := IniRead(ConfigFile, sectionName, "CoinAreaTopLeftY", CoinAreaTopLeftY)
CoinAreaBottomRightX := IniRead(ConfigFile, sectionName, "CoinAreaBottomRightX", CoinAreaBottomRightX)
CoinAreaBottomRightY := IniRead(ConfigFile, sectionName, "CoinAreaBottomRightY", CoinAreaBottomRightY)
LogMessage("Loaded auto settings for profile " . profileNumber . " - " . GetProfileName(profileNumber))
return true
} catch Error as e {
LogMessage("Error loading auto settings for profile " . profileNumber . ": " . e.Message)
return false
}
}
; Function to save auto settings for a specific profile
SaveProfileAutoSettings(profileNumber) {
global ConfigFile
global EnableAuto, EnableHealthMonitoring, EnableManaMonitoring, AttackKey1, AttackKey2, EnableAttackKey2, AttackSpamReduction, DrinkKey, HealthAreaX, HealthAreaY, ManaAreaX, ManaAreaY, CreatureAreaX, CreatureAreaY, ShieldCoordinatesX, ShieldCoordinatesY, PalyShieldDelay, EnableMASkill, MAFistsKey, MARestockKey, CurrentMASkill, EnableKnightHeal, KnightHealKey, MoneyRingKey, EnableActiveSpellScrolling, ActiveSpellsLeftX, ActiveSpellsLeftY, ActiveSpellsRightX, ActiveSpellsRightY, ActiveSpellGoneX, ActiveSpellGoneY, EnableSpellCasting, SpellCastingDelay, EnableSpellCreatureCheck, LastSpellCastTime, WarmSpellKey, CastSpellKey, WarmedSpellX, WarmedSpellY, EnableSpellCasting2, SpellCastingDelay2, EnableSpellCreatureCheck2, LastSpellCastTime2, WarmSpellKey2, CastSpellKey2, EnableSpellCasting3, SpellCastingDelay3, EnableSpellCreatureCheck3, LastSpellCastTime3, WarmSpellKey3, CastSpellKey3, CurrentWarmedSpell, RecoverFumbleMain, RecoverFumbleOffhand, RecoverMainKey, RecoverOffhandKey, MainHandX, MainHandY, OffHandX, OffHandY, CritListVerifyX, CritListVerifyY, CoinAreaTopLeftX, CoinAreaTopLeftY, CoinAreaBottomRightX, CoinAreaBottomRightY, EnableCreatureListVerification, PotionsPerRestock, UsedPotionsCount
sectionName := "PROFILE " . profileNumber
try {
IniWrite(EnableHealthMonitoring ? "true" : "false", ConfigFile, sectionName, "EnableHealthMonitoring")
IniWrite(EnableManaMonitoring ? "true" : "false", ConfigFile, sectionName, "EnableManaMonitoring")
IniWrite(AttackKey1, ConfigFile, sectionName, "AttackKey1")
IniWrite(AttackKey2, ConfigFile, sectionName, "AttackKey2")
IniWrite(EnableAttackKey2 ? "true" : "false", ConfigFile, sectionName, "EnableAttackKey2")
IniWrite(AttackSpamReduction ? "true" : "false", ConfigFile, sectionName, "AttackSpamReduction")
IniWrite(DrinkKey, ConfigFile, sectionName, "DrinkKey")
IniWrite(HealthAreaX, ConfigFile, sectionName, "HealthAreaX")
IniWrite(HealthAreaY, ConfigFile, sectionName, "HealthAreaY")
IniWrite(ManaAreaX, ConfigFile, sectionName, "ManaAreaX")
IniWrite(ManaAreaY, ConfigFile, sectionName, "ManaAreaY")
IniWrite(CreatureAreaX, ConfigFile, sectionName, "CreatureAreaX")
IniWrite(CreatureAreaY, ConfigFile, sectionName, "CreatureAreaY")
IniWrite(ShieldCoordinatesX, ConfigFile, sectionName, "ShieldCoordinatesX")
IniWrite(ShieldCoordinatesY, ConfigFile, sectionName, "ShieldCoordinatesY")
IniWrite(PalyShieldDelay, ConfigFile, sectionName, "PalyShieldDelay")
IniWrite(EnableMASkill ? "true" : "false", ConfigFile, sectionName, "EnableMASkill")
IniWrite(MAFistsKey, ConfigFile, sectionName, "MAFistsKey")
IniWrite(MARestockKey, ConfigFile, sectionName, "MARestockKey")
IniWrite(CurrentMASkill, ConfigFile, sectionName, "CurrentMASkill")
IniWrite(PotionsPerRestock, ConfigFile, sectionName, "PotionsPerRestock")
IniWrite(UsedPotionsCount, ConfigFile, sectionName, "UsedPotionsCount")
IniWrite(EnableKnightHeal ? "true" : "false", ConfigFile, sectionName, "EnableKnightHeal")
IniWrite(KnightHealKey, ConfigFile, sectionName, "KnightHealKey")
IniWrite(MoneyRingKey, ConfigFile, sectionName, "MoneyRingKey")
IniWrite(EnableActiveSpellScrolling ? "true" : "false", ConfigFile, sectionName, "EnableActiveSpellScrolling")
IniWrite(ActiveSpellsLeftX, ConfigFile, sectionName, "ActiveSpellsLeftX")
IniWrite(ActiveSpellsLeftY, ConfigFile, sectionName, "ActiveSpellsLeftY")
IniWrite(ActiveSpellsRightX, ConfigFile, sectionName, "ActiveSpellsRightX")
IniWrite(ActiveSpellsRightY, ConfigFile, sectionName, "ActiveSpellsRightY")
IniWrite(ActiveSpellGoneX, ConfigFile, sectionName, "ActiveSpellGoneX")
IniWrite(ActiveSpellGoneY, ConfigFile, sectionName, "ActiveSpellGoneY")
IniWrite(EnableSpellCasting ? "true" : "false", ConfigFile, sectionName, "EnableSpellCasting")
IniWrite(SpellCastingDelay, ConfigFile, sectionName, "SpellCastingDelay")
IniWrite(EnableSpellCreatureCheck ? "true" : "false", ConfigFile, sectionName, "EnableSpellCreatureCheck")
IniWrite(WarmSpellKey, ConfigFile, sectionName, "WarmSpellKey")
IniWrite(CastSpellKey, ConfigFile, sectionName, "CastSpellKey")
IniWrite(WarmedSpellX, ConfigFile, sectionName, "WarmedSpellX")
IniWrite(WarmedSpellY, ConfigFile, sectionName, "WarmedSpellY")
IniWrite(EnableSpellCasting2 ? "true" : "false", ConfigFile, sectionName, "EnableSpellCasting2")
IniWrite(SpellCastingDelay2, ConfigFile, sectionName, "SpellCastingDelay2")
IniWrite(EnableSpellCreatureCheck2 ? "true" : "false", ConfigFile, sectionName, "EnableSpellCreatureCheck2")
IniWrite(WarmSpellKey2, ConfigFile, sectionName, "WarmSpellKey2")
IniWrite(CastSpellKey2, ConfigFile, sectionName, "CastSpellKey2")
IniWrite(EnableSpellCasting3 ? "true" : "false", ConfigFile, sectionName, "EnableSpellCasting3")
IniWrite(SpellCastingDelay3, ConfigFile, sectionName, "SpellCastingDelay3")
IniWrite(EnableSpellCreatureCheck3 ? "true" : "false", ConfigFile, sectionName, "EnableSpellCreatureCheck3")
IniWrite(WarmSpellKey3, ConfigFile, sectionName, "WarmSpellKey3")
IniWrite(CastSpellKey3, ConfigFile, sectionName, "CastSpellKey3")
IniWrite(RecoverFumbleMain ? "true" : "false", ConfigFile, sectionName, "RecoverFumbleMain")
IniWrite(RecoverFumbleOffhand ? "true" : "false", ConfigFile, sectionName, "RecoverFumbleOffhand")
IniWrite(RecoverMainKey, ConfigFile, sectionName, "RecoverMainKey")
IniWrite(RecoverOffhandKey, ConfigFile, sectionName, "RecoverOffhandKey")
IniWrite(MainHandX, ConfigFile, sectionName, "MainHandX")
IniWrite(MainHandY, ConfigFile, sectionName, "MainHandY")
IniWrite(OffHandX, ConfigFile, sectionName, "OffHandX")
IniWrite(OffHandY, ConfigFile, sectionName, "OffHandY")
IniWrite(EnableCreatureListVerification ? "true" : "false", ConfigFile, sectionName, "EnableCreatureListVerification")
IniWrite(CritListVerifyX, ConfigFile, sectionName, "CritListVerifyX")
IniWrite(CritListVerifyY, ConfigFile, sectionName, "CritListVerifyY")
IniWrite(CoinAreaTopLeftX, ConfigFile, sectionName, "CoinAreaTopLeftX")
IniWrite(CoinAreaTopLeftY, ConfigFile, sectionName, "CoinAreaTopLeftY")
IniWrite(CoinAreaBottomRightX, ConfigFile, sectionName, "CoinAreaBottomRightX")
IniWrite(CoinAreaBottomRightY, ConfigFile, sectionName, "CoinAreaBottomRightY")
LogMessage("Saved auto settings for profile " . profileNumber . " - " . GetProfileName(profileNumber))
return true
} catch Error as e {
LogMessage("Error saving auto settings for profile " . profileNumber . ": " . e.Message)
return false
}
}
; Function to restore default settings for a specific profile
RestoreProfileDefaults(profileNumber) {
global ConfigFile
sectionName := "PROFILE " . profileNumber
try {
; Set all profile settings to their default values
IniWrite("true", ConfigFile, sectionName, "EnableHealthMonitoring")
IniWrite("true", ConfigFile, sectionName, "EnableManaMonitoring")
IniWrite("", ConfigFile, sectionName, "AttackKey1")
IniWrite("", ConfigFile, sectionName, "AttackKey2")
IniWrite("true", ConfigFile, sectionName, "EnableAttackKey2")
IniWrite("false", ConfigFile, sectionName, "AttackSpamReduction")
IniWrite("", ConfigFile, sectionName, "DrinkKey")
IniWrite("0", ConfigFile, sectionName, "HealthAreaX")
IniWrite("0", ConfigFile, sectionName, "HealthAreaY")
IniWrite("0", ConfigFile, sectionName, "ManaAreaX")
IniWrite("0", ConfigFile, sectionName, "ManaAreaY")
IniWrite("0", ConfigFile, sectionName, "CreatureAreaX")
IniWrite("0", ConfigFile, sectionName, "CreatureAreaY")
IniWrite("0", ConfigFile, sectionName, "ShieldCoordinatesX")
IniWrite("0", ConfigFile, sectionName, "ShieldCoordinatesY")
IniWrite("3500", ConfigFile, sectionName, "PalyShieldDelay")
IniWrite("false", ConfigFile, sectionName, "EnableMASkill")
IniWrite("", ConfigFile, sectionName, "MAFistsKey")
IniWrite("", ConfigFile, sectionName, "MARestockKey")
IniWrite("restock", ConfigFile, sectionName, "CurrentMASkill")
IniWrite("1", ConfigFile, sectionName, "PotionsPerRestock")
IniWrite("0", ConfigFile, sectionName, "UsedPotionsCount")
IniWrite("false", ConfigFile, sectionName, "EnableKnightHeal")
IniWrite("", ConfigFile, sectionName, "KnightHealKey")
IniWrite("", ConfigFile, sectionName, "MoneyRingKey")
IniWrite("false", ConfigFile, sectionName, "EnableActiveSpellScrolling")
IniWrite("0", ConfigFile, sectionName, "ActiveSpellsLeftX")
IniWrite("0", ConfigFile, sectionName, "ActiveSpellsLeftY")
IniWrite("0", ConfigFile, sectionName, "ActiveSpellsRightX")
IniWrite("0", ConfigFile, sectionName, "ActiveSpellsRightY")
IniWrite("0", ConfigFile, sectionName, "ActiveSpellGoneX")
IniWrite("0", ConfigFile, sectionName, "ActiveSpellGoneY")
IniWrite("false", ConfigFile, sectionName, "EnableSpellCasting")
IniWrite("5000", ConfigFile, sectionName, "SpellCastingDelay")
IniWrite("true", ConfigFile, sectionName, "EnableSpellCreatureCheck")
IniWrite("", ConfigFile, sectionName, "WarmSpellKey")
IniWrite("", ConfigFile, sectionName, "CastSpellKey")
IniWrite("0", ConfigFile, sectionName, "WarmedSpellX")
IniWrite("0", ConfigFile, sectionName, "WarmedSpellY")
IniWrite("false", ConfigFile, sectionName, "EnableSpellCasting2")
IniWrite("5000", ConfigFile, sectionName, "SpellCastingDelay2")
IniWrite("true", ConfigFile, sectionName, "EnableSpellCreatureCheck2")
IniWrite("", ConfigFile, sectionName, "WarmSpellKey2")
IniWrite("", ConfigFile, sectionName, "CastSpellKey2")
IniWrite("false", ConfigFile, sectionName, "EnableSpellCasting3")
IniWrite("5000", ConfigFile, sectionName, "SpellCastingDelay3")
IniWrite("true", ConfigFile, sectionName, "EnableSpellCreatureCheck3")
IniWrite("", ConfigFile, sectionName, "WarmSpellKey3")
IniWrite("", ConfigFile, sectionName, "CastSpellKey3")
IniWrite("false", ConfigFile, sectionName, "RecoverFumbleMain")
IniWrite("false", ConfigFile, sectionName, "RecoverFumbleOffhand")
IniWrite("", ConfigFile, sectionName, "RecoverMainKey")
IniWrite("", ConfigFile, sectionName, "RecoverOffhandKey")
IniWrite("0", ConfigFile, sectionName, "MainHandX")
IniWrite("0", ConfigFile, sectionName, "MainHandY")
IniWrite("0", ConfigFile, sectionName, "OffHandX")
IniWrite("0", ConfigFile, sectionName, "OffHandY")
IniWrite("false", ConfigFile, sectionName, "EnableCreatureListVerification")
IniWrite("0", ConfigFile, sectionName, "CritListVerifyX")
IniWrite("0", ConfigFile, sectionName, "CritListVerifyY")
IniWrite("0", ConfigFile, sectionName, "CoinAreaTopLeftX")
IniWrite("0", ConfigFile, sectionName, "CoinAreaTopLeftY")
IniWrite("0", ConfigFile, sectionName, "CoinAreaBottomRightX")
IniWrite("0", ConfigFile, sectionName, "CoinAreaBottomRightY")
; Restore timing settings to defaults
IniWrite("32", ConfigFile, "TIMING SETTINGS", "ShortDelay")
IniWrite("64", ConfigFile, "TIMING SETTINGS", "MediumDelay")
IniWrite("128", ConfigFile, "TIMING SETTINGS", "LongDelay")
IniWrite("2048", ConfigFile, "TIMING SETTINGS", "TooltipDisplayTime")
IniWrite("128", ConfigFile, "TIMING SETTINGS", "AutoLoopInterval")
IniWrite("1064", ConfigFile, "TIMING SETTINGS", "CoinRoundTimerDelay")
IniWrite("200", ConfigFile, "TIMING SETTINGS", "LoginDelay")
IniWrite("2000", ConfigFile, "TIMING SETTINGS", "MouseClickCooldown")
IniWrite("2000", ConfigFile, "TIMING SETTINGS", "GameMonitorInterval")
LogMessage("Restored default settings for profile " . profileNumber . " - " . GetProfileName(profileNumber))
return true
} catch Error as e {
LogMessage("Error restoring default settings for profile " . profileNumber . ": " . e.Message)
return false
}
}
; Function to switch to a different profile
SwitchProfile(newProfileNumber) {
global CurrentProfile, MaxProfiles, ConfigFile