-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathD4WeakAura.ahk
794 lines (699 loc) · 24.8 KB
/
D4WeakAura.ahk
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
#NoEnv
#SingleInstance force
#Persistent
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , H
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
#Include Gdip_All.ahk
;SetTimer, Rumble, 1000
; Start GDI+
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
OnExit, Exit
Font := "Diablo"
If !hFamily := Gdip_FontFamilyCreate(Font)
{
MsgBox, 48, Font error!, The font you have specified does not exist on the system
ExitApp
}
Gdip_DeleteFontFamily(hFamily)
GetRunningWindowText(window_title) {
MouseGetPos,,,WindowUnderMouse
WinGetTitle, title, ahk_id %WindowUnderMouse%
Return title == window_title
}
Width := A_ScreenWidth, Height := A_ScreenHeight
Options = x10p y30p w80p Centre cbbffffff r4 s20 Underline Italic
Font = Arial
showUI := True
global drawDebug := False
global f1Pressed := -1
global f3Pressed := -1
global clonex := -1
global cloney := -1
global clonew := -1
global cloneh := -1
global clonedx := -1
global clonedy := -1
global tempX := -1
global tempY := -1
global tempW := -1
global tempH := -1
global rumbleStrength := 100
global rumbleLength := 50
global rumbleRepeats := 1
global vibrationEnabled := True
global TargetScriptTitle := "Rumbler.ahk ahk_class AutoHotkey"
global LastRumbleSend := -1
; Create a layered window (+E0x80000 : must be used for UpdateLayeredWindow to work!) that is always on top (+AlwaysOnTop), has no taskbar entry or caption
Gui, Overlay: -Caption +E0x80000 +E0x20 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
; Show the window
Gui, Overlay: Show, NA
; Get a handle to this window we have created in order to update it later
hwnd1 := WinExist()
; Create a GDI bitmap with width and height of the drawing area
hbm := CreateDIBSection(Width, Height)
; Get a device context compatible with the screen
hdc := CreateCompatibleDC()
; Select the bitmap into the device context
obm := SelectObject(hdc, hbm)
; Get a pointer to the graphics of the bitmap for drawing
G := Gdip_GraphicsFromHDC(hdc)
; Set the smoothing mode to antialias = 4 to make shapes appear smoother
Gdip_SetSmoothingMode(G, 4)
Screenshot(x,y,w,h)
{
screen=%x%|%y%|%w%|%h%
screenshot := Gdip_BitmapFromScreen(screen)
return screenshot
}
RotateImage(image, angle)
{
IWidth := Gdip_GetImageWidth(image)
IHeight := Gdip_GetImageHeight(image)
Gdip_GetRotatedDimensions(IWidth, IHeight, angle, RWidth, RHeight)
; xTranslation and yTranslation now contain the distance to shift the image by
Gdip_GetRotatedTranslation(IWidth, IHeight, Angle, xTranslation, yTranslation)
rotatedBitmap := Gdip_CreateBitmap(RWidth, RHeight) ; Create a new bitmap
GRotated := Gdip_GraphicsFromImage(rotatedBitmap) ; Get a pointer to the graphics of the bitmap
Gdip_SetSmoothingMode(GRotated, 1)
Gdip_TranslateWorldTransform(GRotated, xTranslation, yTranslation)
Gdip_RotateWorldTransform(GRotated, angle)
Gdip_DrawImage(GRotated, image, 0, 0, IWidth, IHeight, 0, 0, IWidth, IHeight)
;Gdip_SaveBitmapToFile(rotatedBitmap, "rotated.png") ; Save the new bitmap to file ## A_ScriptDir . "/Image2.png"
;Gdip_ResetWorldTransform(GRotated)
Gdip_DeleteGraphics(GRotated) ; The graphics may now be deleted
Gdip_DisposeImage(image) ; Delete the new bitmap
return rotatedBitmap
}
multiply_colors(color1, color2)
{
r1 := (color1 >> 16) & 0xFF
g1 := (color1 >> 8) & 0xFF
b1 := color1 & 0xFF
r2 := (color2 >> 16) & 0xFF
g2 := (color2 >> 8) & 0xFF
b2 := color2 & 0xFF
color3 := (0xFF << 24) | ((r1 * r2) >>> 8 << 16) | ((g1 * g2) >>> 8 << 8) | (b1 * b2 >>> 8)
}
generate_random_argb()
{
Random, Rand, 0, 16777215
random_color := Format("0xFF{}", Format("{:06X}", Rand))
return random_color
}
create_pen(section, pScreenshot, solid)
{
if section.cloneOverrideColor
{
ARGB := Gdip_GetPixelColor(pScreenshot, 0, 0, 1)
}
Else
{
ARGB := Gdip_GetPixelColor(pScreenshot, 0, 0, 1)
}
if solid
{
return Gdip_BrushCreateSolid(ARGB)
}
Else
{
return Gdip_CreatePen(ARGB, 10)
}
}
render_section(section, G, pScreenshot)
{
if section.cloneOutputType == "Full"
{
gPen := create_pen(section, pScreenshot, false)
Gdip_DrawRectangle(G, gPen, 0, 0, A_ScreenWidth, A_ScreenHeight)
Gdip_DeletePen(gPen)
}
Else if section.cloneOutputType == "Left"
{
gPen := create_pen(section, pScreenshot, true)
Gdip_FillRectangle(G, gPen, -1, -1, 25, A_ScreenHeight+1)
Gdip_DeleteBrush(gPen)
if drawDebug {
debugPen := Gdip_CreatePen(section.cloneColor, 2)
Gdip_DrawRectangle(G, debugPen, section.x, section.y, section.w, section.h)
Gdip_DrawLine(G, debugPen, section.x, section.y, 20, A_ScreenHeight/2)
Gdip_DeletePen(debugPen)
}
}
Else if section.cloneOutputType == "Right"
{
gPen := create_pen(section, pScreenshot, true)
Gdip_FillRectangle(G, gPen, A_ScreenWidth-40, -1, A_ScreenWidth, A_ScreenHeight+1)
Gdip_DeleteBrush(gPen)
;Gdip_DrawRectangle(G, greenPen, A_ScreenWidth-30, 0, A_ScreenWidth, A_ScreenHeight)
if drawDebug {
debugPen := Gdip_CreatePen(section.cloneColor, 2)
Gdip_DrawRectangle(G, debugPen, section.x, section.y, section.w, section.h)
Gdip_DrawLine(G, debugPen, section.x, section.y, A_ScreenWidth-20, A_ScreenHeight/2)
Gdip_DeletePen(debugPen)
}
}
Else if section.cloneOutputType == "Top"
{
gPen := create_pen(section, pScreenshot, true)
Gdip_FillRectangle(G, gPen, -1, -1, A_ScreenWidth+1, 20)
Gdip_DeleteBrush(gPen)
;Gdip_DrawRectangle(G, greenPen, A_ScreenWidth-30, 0, A_ScreenWidth, A_ScreenHeight)
if drawDebug {
debugPen := Gdip_CreatePen(section.cloneColor, 2)
Gdip_DrawRectangle(G, debugPen, section.x, section.y, section.w, section.h)
Gdip_DrawLine(G, debugPen, section.x, section.y, A_ScreenWidth/2, 10)
Gdip_DeletePen(debugPen)
}
}
Else if section.cloneOutputType == "Vibrate"
{
ARGB := Gdip_GetPixelColor(pScreenshot, 0, 0, 1)
if(section.cloneColor == ARGB)
{
rumbleIntensity := section.vibrationIntensity * 255
rumbleLength := section.vibrationLength
rumbleRepeats := section.vibrationRepeats
data = %rumbleIntensity%|%rumbleLength%|%rumbleRepeats%
if(A_TickCount >= LastRumbleSend + (rumbleLength * rumbleRepeats) + 300)
{
LastRumbleSend := A_TickCount
send_rumble(data,TargetScriptTitle)
}
;Rumbler(section.cloneTransparency * 255, 100, 2)
;SetTimer, Rumble, 30
}
if drawDebug {
debugPen := Gdip_CreatePen(section.cloneColor, 2)
Gdip_DrawRectangle(G, debugPen, section.x, section.y, section.w, section.h)
Gdip_DrawLine(G, debugPen, section.x, section.y, A_ScreenWidth/2, 10)
Gdip_DeletePen(debugPen)
}
}
Else{
if section.cloneRotation
{
pScreenshot := RotateImage(pScreenshot, section.cloneRotation)
}
www := section.w
hhh := section.h
if section.cloneOnMouse
{
MouseGetPos, xPos, yPos
xPos := xPos - www/2
xPos := xPos - hhh
}
Else
{
xPos := section.dx
yPos := section.dy
}
scale := section.cloneScale ? section.cloneScale : 1
Gdip_DrawImage(G, pScreenshot, xPos, yPos, www*section.cloneScale, hhh*section.cloneScale, Null, Null, Null, Null, section.cloneTransparency)
Gdip_DisposeBitmap(pScreenshot)
if drawDebug {
debugPen := Gdip_CreatePen(section.cloneColor, 2)
Gdip_DrawRectangle(G, debugPen, section.x, section.y, section.w, section.h)
Gdip_DrawRectangle(G, debugPen, section.dx, section.dy, section.w*section.cloneScale, section.h*section.cloneScale)
Gdip_DrawLine(G, debugPen, section.x, section.y, section.dx, section.dy)
xx := section.x
yy := section.y
Options = x%xx% y%yy% Centre cbbffffff r4 s10
Gdip_TextToGraphics(G, Format("x:{} y:{}", xx, yy) , Options, Font, Width, Height)
xx := section.dx
yy := section.dy
Options = x%xx% y%yy% Centre cbbffffff r4 s10
Gdip_TextToGraphics(G, Format("dx:{} dy:{}", xx, yy) , Options, Font, Width, Height)
Gdip_DeletePen(debugPen)
}
}
Gdip_DisposeBitmap(pBitmap)
}
Width := A_ScreenWidth, Height := A_ScreenHeight
iniFilename := Format("settings-{}x{}.ini", Width, Height)
ini := iniObj(iniFilename)
argb := generate_random_argb()
cloneToMove := ""
cloneToMoveTransparency := -1
cloneToMoveScale := 1
if !FileExist(iniFilename)
{
FileAppend, , %iniFilename%
MsgBox, File created.
}
Else
{
;MsgBox, Using config from %iniFilename%
}
should_render(ini, G)
{
general := ini["General"]
pScreenshot := Screenshot(general.enableX,general.enableY,2,2)
ARGB := Gdip_GetPixelColor(pScreenshot, 0, 0, 1)
Gdip_DisposeBitmap(pScreenshot)
return ARGB == general.enableColor
}
send_rumble(ByRef StringToSend, ByRef TargetScriptTitle)
{
VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0) ; Set up the structure's memory area.
; First set the structure's cbData member to the size of the string, including its zero terminator:
SizeInBytes := (StrLen(StringToSend) + 1) * (A_IsUnicode ? 2 : 1)
NumPut(SizeInBytes, CopyDataStruct, A_PtrSize) ; OS requires that this be done.
NumPut(&StringToSend, CopyDataStruct, 2*A_PtrSize) ; Set lpData to point to the string itself.
Prev_DetectHiddenWindows := A_DetectHiddenWindows
Prev_TitleMatchMode := A_TitleMatchMode
DetectHiddenWindows On
SetTitleMatchMode 2
TimeOutTime := 10 ; Optional. Milliseconds to wait for response from receiver.ahk. Default is 5000
; Must use SendMessage not PostMessage.
SendMessage, 0x004A, 0, &CopyDataStruct,, %TargetScriptTitle%,,,, %TimeOutTime% ; 0x004A is WM_COPYDATA.
DetectHiddenWindows %Prev_DetectHiddenWindows% ; Restore original setting for the caller.
SetTitleMatchMode %Prev_TitleMatchMode% ; Same.
return ErrorLevel ; Return SendMessage's reply back to our caller.
}
SetTimer Looper, 16
Looper:
{
sT:=A_TickCount
active := GetRunningWindowText("Diablo IV")
Gdip_GraphicsClear(G)
if (showUI and active)
{
ini := iniObj(iniFilename)
render := should_render(ini, G)
if(render)
{
for section_name, section_data in ini {
if(section_name != "General")
{
pScreenshot := Screenshot(section_data.x,section_data.y,section_data.w,section_data.h)
if(section_name != cloneToMove)
{
render_section(section_data, G, pScreenshot)
}
else
{
; Edit mode
MouseGetPos , xxxx, yyyy
section_data.dx := xxxx - section_data.w
section_data.dy := yyyy - section_data.h
section_data.cloneTransparency := cloneToMoveTransparency
section_data.cloneScale := cloneToMoveScale
render_section(section_data, G, pScreenshot)
Options = x%0% y1p Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "Edit Mode: Scrollwheel up/down for transparency, Ctrl+Scrollwheel for size. Press F3 again to save!", Options, Font, Width, Height)
}
}
else
{
if(drawDebug) {
debugPen := Gdip_CreatePen(0xffff0000, 1)
Gdip_DrawRectangle(G, debugPen, section_data.enableX-1, section_data.enableY-1, 2, 2)
debugPen := Gdip_CreatePen(0xbbff0000, 1)
Gdip_DrawLine(G, debugPen, Width/2, 0, Width/2, Height)
Gdip_DrawLine(G, debugPen, 0, Height/2, Width, Height/2)
Gdip_DeletePen(debugPen)
}
}
}
}
if(drawDebug)
{
Options = x%0% y1p Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "F1: New Overlay Rectangle Selection", Options, Font, Width, Height)
Options = x%0% y3p Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "F2: New Pixel Selection (check Readme for details)", Options, Font, Width, Height)
Options = x%0% y5p Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "F3: Edit Mode, Ctrl+F3: Delete Overlay under cursor", Options, Font, Width, Height)
Options = x%0% y7p Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "F4: Toggle Overlay, F5: Show Help / Debug View", Options, Font, Width, Height)
}
if(f1Pressed == 0)
{
MouseGetPos , tempX, tempY
tempW := tempX-clonex
tempH := tempY-cloney
debugPen := Gdip_CreatePen(0xffff0000, 1)
Gdip_DrawRectangle(G, debugPen, clonex, cloney, tempW, tempH)
Gdip_DeletePen(debugPen)
Options = x%10% y%0% Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "Use the mouse to draw a rectangle, press F1 again to submit.", Options, Font, Width, Height)
}
if(f1Pressed == 1)
{
MouseGetPos , tempX2, tempY2
pScreenshot := Screenshot(clonex,cloney,clonew,cloneh)
Gdip_DrawImage(G, pScreenshot, tempX2, tempY2, clonew, cloneh)
Gdip_DisposeBitmap(pScreenshot)
Options = x%10% y%0% Left cbbffffff r4 s30
Gdip_TextToGraphics(G, "Move the mouse to where you want to position the overlay and press F1 again to submit.", Options, Font, Width, Height)
}
}
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)
Gdip_DisposeBitmap(pScreenshot)
eT:=A_TickCount
ticks := eT-sT
if(ticks<16)
{
sleepfor := 16-ticks
DllCall("Sleep","UInt", sleepfor)
}
return
}
Exit:
; Release resources
Gdip_DeletePen(greenPen)
Gdip_DeletePen(orangePen)
Gdip_DeletePen(redPen)
Gdip_DeletePen(whitePen)
Gdip_DeleteGraphics(G)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteFontFamily(hFamily)
Gdip_Shutdown(pToken)
ExitApp
iniObj(iniFilename) {
ini := []
IniRead, sections,% iniFilename
for number, section in StrSplit(sections,"`n") {
IniRead, keys ,% iniFilename,% section
ini[section] := []
for number, key in StrSplit(keys,"`n") {
ini[section][StrSplit(key,"=").1] := StrSplit(key,"=").2
}
}
Return ini
}
f1Function()
{
if(f1Pressed < 0)
{
; first f1 press -> set x,y
MouseGetPos , clonex, cloney
f1Pressed := 0
}
else if(f1Pressed == 0)
{
; second f1 press -> set w,h
MouseGetPos , tempxx, tempyy
clonew := Abs(clonex - tempxx)
cloneh := Abs(cloney - tempyy)
f1Pressed := 1
}
else if(f1Pressed == 1)
{
MouseGetPos , clonedx, clonedy
Gui, 2:Destroy
Gui, 2:Add, Text,, Configure the Overlay
Gui, 2:Add, Text,, Enter an identifier:
Gui, 2:Add, Edit, vMyInput,
Gui, 2:Add, Text,, Transparency:
Gui, 2:Add, Edit, vMyTransparency,
Gui, 2:Add, Text,, Rotation:
Gui, 2:Add, Edit, vMyRotation,
Gui, 2:Add,Button,gSaveClone wp,Ok
Gui, 2:Show,,Setup Clone
;Goto, SaveClone
}
return
}
SaveClone:
{
if (clonex > 0 and cloney > 0 and clonew > 0 and cloneh > 0)
{
Gui, 2:Hide
GuiControlGet, MyDropdown,, MyDropdown
GuiControlGet, MyInput,, MyInput
GuiControlGet, MyTransparency,, MyTransparency
GuiControlGet, MyRotation,, MyRotation
MsgBox, You selected %MyDropdown% and entered %MyInput% with transparency %MyTransparency%.
vclonename := MyInput
vwhere := MyDropdown
vtransparency := MyTransparency
vrotation := MyRotation
cloneOutputType := "clone"
IniWrite, %clonex%, %iniFilename%, clone_%vclonename%, x
IniWrite, %cloney%, %iniFilename%, clone_%vclonename%, y
IniWrite, %clonew%, %iniFilename%, clone_%vclonename%, w
IniWrite, %cloneh%, %iniFilename%, clone_%vclonename%, h
IniWrite, %clonedx%, %iniFilename%, clone_%vclonename%, dx
IniWrite, %clonedy%, %iniFilename%, clone_%vclonename%, dy
IniWrite, %vclonename%, %iniFilename%, clone_%vclonename%, clonename
IniWrite, %vtransparency%, %iniFilename%, clone_%vclonename%, cloneTransparency
IniWrite, %cloneOutputType%, %iniFilename%, clone_%vclonename%, cloneOutputType
IniWrite, %vrotation%, %iniFilename%, clone_%vclonename%, cloneRotation
IniWrite, %A_ScreenHeight%, %iniFilename%, clone_%vclonename%, height
IniWrite, %A_ScreenWidth%, %iniFilename%, clone_%vclonename%, width
random_color := generate_random_argb()
IniWrite, %random_color%, %iniFilename%, clone_%vclonename%, cloneColor
clonex := -1
cloney := -1
clonew := -1
cloneh := -1
clonedx := -1
clonedy := -1
f1Pressed := -1
}
return
}
; x,y,w,h - defines the region, xxx,yyy is the point we clicked on, r is the angle
did_we_click_on_clone(x,y,w,h, xxx, yyy, s, r)
{
leftt := x
rightt := x + (w * s)
top := y
bottom := y + (h * s)
; Check if mouse is inside
inside := xxx >= leftt && xxx <= rightt
&& yyy >= top && yyy <= bottom
return inside
}
OkClone:
Gui, 2:Hide
GuiControlGet, MyDropdown,, MyDropdown
GuiControlGet, MyInput,, MyInput
GuiControlGet, MyTransparency,, MyTransparency
MsgBox, You selected %MyDropdown% and entered %MyInput% with transparency %MyTransparency%.
vclonename := MyInput
vwhere := MyDropdown
vtransparency := MyTransparency
IniWrite, %clonex%, %iniFilename%, clone_%vclonename%, x
IniWrite, %cloney%, %iniFilename%, clone_%vclonename%, y
IniWrite, %clonew%, %iniFilename%, clone_%vclonename%, w
IniWrite, %cloneh%, %iniFilename%, clone_%vclonename%, h
IniWrite, %clonedx%, %iniFilename%, clone_%vclonename%, dx
IniWrite, %clonedy%, %iniFilename%, clone_%vclonename%, dy
IniWrite, %A_ScreenHeight%, %iniFilename%, clone_%vclonename%, height
IniWrite, %A_ScreenWidth%, %iniFilename%, clone_%vclonename%, width
IniWrite, %vclonename%, %iniFilename%, clone_%vclonename%, clonename
IniWrite, 1.0, %iniFilename%, clone_%vclonename%, cloneTransparency
IniWrite, %vwhere%, %iniFilename%, clone_%vclonename%, cloneOutputType
random_color := generate_random_argb()
IniWrite, %random_color%, %iniFilename%, clone_%vclonename%, cloneColor
clonex := -1
cloney := -1
clonew := -1
cloneh := -1
clonedx := -1
clonedy := -1
IniRead, sections, Filename
ini := iniObj(iniFilename)
return
OkBorder:
Gui, 2:Hide
GuiControlGet, MyDropdown,, MyDropdown
GuiControlGet, MyInput,, MyInput
GuiControlGet, MyTransparency,, MyTransparency
MsgBox, You selected %MyDropdown% and entered %MyInput% with transparency %MyTransparency%.
vclonename := MyInput
vwhere := MyDropdown
vtransparency := MyTransparency
pScreenshot := Screenshot(clonex,cloney,1,1)
ARGB := Gdip_GetPixelColor(pScreenshot, 0, 0, 1)
IniWrite, %clonex%, %iniFilename%, clone_%vclonename%, x
IniWrite, %cloney%, %iniFilename%, clone_%vclonename%, y
IniWrite, %clonew%, %iniFilename%, clone_%vclonename%, w
IniWrite, %cloneh%, %iniFilename%, clone_%vclonename%, h
IniWrite, %clonedx%, %iniFilename%, clone_%vclonename%, dx
IniWrite, %clonedy%, %iniFilename%, clone_%vclonename%, dy
IniWrite, %A_ScreenHeight%, %iniFilename%, clone_%vclonename%, height
IniWrite, %A_ScreenWidth%, %iniFilename%, clone_%vclonename%, width
IniWrite, %vclonename%, %iniFilename%, clone_%vclonename%, clonename
IniWrite, 1.0, %iniFilename%, clone_%vclonename%, cloneTransparency
IniWrite, %vwhere%, %iniFilename%, clone_%vclonename%, cloneOutputType
random_color := generate_random_argb()
IniWrite, %ARGB%, %iniFilename%, clone_%vclonename%, cloneColor
clonex := -1
cloney := -1
clonew := -1
cloneh := -1
clonedx := -1
clonedy := -1
IniRead, sections, Filename
ini := iniObj(iniFilename)
return
#IfWinActive Diablo IV
F1::
{
f1Function()
return
}
^F1::
{
MouseGetPos , enableX, enableY
pScreenshot := Screenshot(enableX, enableY, 1, 1)
ARGB := Gdip_GetPixelColor(pScreenshot, 0, 0, 1)
IniWrite, %ARGB%, %iniFilename%, General, enableColor
IniWrite, %enableX%, %iniFilename%, General, enableX
IniWrite, %enableY%, %iniFilename%, General, enableY
return
}
F2::
{
MouseGetPos , clonedx, clonedy
cloneOutputType := "border"
clonex := clonedx
cloney := clonedy
clonew := 8
cloneh := 8
clonedx := clonedx
clonedy := clonedy
Gui, 2:Destroy
Gui, 2:Add, Text,, Enter an identifier:
Gui, 2:Add, Edit, vMyInput,
Gui, 2:Add, Text,, Where to display
Gui, 2:Add, DropdownList,vMyDropdown,Left|Right|Top|Full|Vibrate
Gui, 2:Add, Text,, Modifier (Transparency/Vibrate)
Gui, 2:Add, Edit, vMyTransparency,
Gui, 2:Add,Button,gOkBorder wp,Ok
Gui, 2:Show,,This is the title
return
}
F3::
{
MouseGetPos , xxx, yyy
if(f3Pressed < 0)
{
for section_name, section_data in ini {
test := did_we_click_on_clone(section_data.dx, section_data.dy, section_data.w, section_data.h, xxx, yyy, section_data.cloneScale ? section_data.cloneScale : 1, section_data.cloneRotation ? section_data.cloneRotation : 0)
if (test) {
cloneToMove := section_name
cloneToMoveTransparency := section_data.cloneTransparency
cloneToMoveScale := section_data.cloneScale
f3Pressed := 0
break
}
}
}
else if(f3Pressed == 0) {
ddx := xxx-ini[cloneToMove].w
ddy := yyy-ini[cloneToMove].h
IniWrite, %ddx%, %iniFilename%, %cloneToMove%, dx
IniWrite, %ddy%, %iniFilename%, %cloneToMove%, dy
IniWrite, %cloneToMoveTransparency%, %iniFilename%, %cloneToMove%, cloneTransparency
IniWrite, %cloneToMoveScale%, %iniFilename%, %cloneToMove%, cloneScale
cloneToMove := ""
cloneToMoveTransparency := -1
f3Pressed := -1
}
return
}
^F3::
{
MouseGetPos , xxx, yyy
if(f3Pressed < 0)
{
for section_name, section_data in ini {
if(section_data.cloneOutputType == "clone") {
test := did_we_click_on_clone(section_data.dx, section_data.dy, section_data.w, section_data.h, xxx, yyy, section_data.cloneScale ? section_data.cloneScale : 1, section_data.cloneRotation ? section_data.cloneRotation : 0)
if (test) {
IniDelete, %iniFilename%, %section_name%
f3Pressed := -1
}
}
else
{
test := did_we_click_on_clone(section_data.x, section_data.y, section_data.w, section_data.h, xxx, yyy, 1, 0)
if (test) {
IniDelete, %iniFilename%, %section_name%
f3Pressed := -1
}
}
}
}
}
#If (f1Pressed >= 0)
Esc::
{
clonex := -1
cloney := -1
clonew := -1
cloneh := -1
clonedx := -1
clonedy := -1
f1Pressed := -1
}
#If
#If (f3Pressed == 0)
Esc::
{
f3Pressed := -1
cloneToMoveTransparency := 1.0
cloneToMoveScale := 1.0
}
WheelUp::
{
cloneToMoveTransparency := cloneToMoveTransparency ? cloneToMoveTransparency : 1.0
cloneToMoveTransparency := Min(cloneToMoveTransparency + 0.1, 1.0)
return
}
WheelDown::
{
cloneToMoveTransparency := cloneToMoveTransparency ? cloneToMoveTransparency : 1.0
cloneToMoveTransparency := Max(cloneToMoveTransparency - 0.1, 0.0)
return
}
^WheelUp::
{
cloneToMoveScale := cloneToMoveScale ? cloneToMoveScale : 1.0
if(cloneToMoveScale <= 2.0)
{
cloneToMoveScale := cloneToMoveScale + 0.1
}
return
}
^WheelDown::
{
cloneToMoveScale := cloneToMoveScale ? cloneToMoveScale : 1.0
if(cloneToMoveScale >= 0.1)
{
cloneToMoveScale := cloneToMoveScale - 0.1
}
return
}
#If
F4::
{
showUI := !showUI
return
}
F5::
{
drawDebug := !drawDebug
return
}
#IfWinActive