/
Mouse.scar
337 lines (301 loc) · 12.6 KB
/
Mouse.scar
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
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Official SCAR Include
Mouse Routines
--------------------------------------------------------------------------------
* procedure GetMousePosP(var P: TPoint);
By: Wanted
* procedure MMouse(X, Y, RX, RY: Integer);
By: Timer
* procedure MMouseP(P: TPoint; RX, RY: Integer);
By: Wanted
* procedure HoldMouseWait(X, Y, RX, RY, MinTime, MaxTime: Integer; Left: Boolean);
By: Wanted
* procedure HoldMouseWaitP(P: TPoint; RX, RY, MinTime, MaxTime: Integer; Left: Boolean);
By: Wanted
* procedure Mouse(X, Y, RX, RY: Integer; Left: Boolean);
By: Wanted & Timer.
* procedure MouseP(P: TPoint; RX, RY: Integer; Left: Boolean);
By: Wanted
* procedure MouseCurrentPos(Left: Boolean);
By: Wanted
* procedure HoldMouseWaitBox(X1, Y1, X2, Y2, MinTime, MaxTime: Integer; Left: Boolean);
By: Wanted
* procedure HoldMouseWaitBoxB(B: TBox; MinTime, MaxTime: Integer; Left: Boolean);
By: Wanted
* procedure MouseBox(X1, Y1, X2, Y2: Integer; TypeC: ClickActions);
By: Wanted & Timer.
* procedure MouseBoxB(B: TBox; TypeC: ClickActions);
By: Wanted
* procedure MouseCircle(Radius, CX, CY: Integer; TypeC: ClickActions);
By: Wanted
* procedure MouseCircleP(Radius: Integer; P: TPoint; TypeC: ClickActions);
By: Wanted
* procedure DragMouse(SX, SY, SRX, SRY, EX, EY, ERX, ERY: Integer; Left: Boolean);
By: Naum
* procedure DragMouseP(SP: TPoint; SRX, SRY: Integer; EP: TPoint; ERX, ERY: Integer; Left: Boolean);
By: Wanted
* procedure DragMouseBox(SX1, SY1, SX2, SY2, EX1, EY1, EX2, EY2: Integer; Left: Boolean);
By: Wanted
* procedure DragMouseBoxB(SB, EB: TBox; Left: Boolean);
By: Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure GetMousePosP(var P: TPoint);
Contributors: Wanted
Description: Wrapper for GetMousePos with point.
Date Created: March 16th, 2013. By Wanted
Last Modified: March 16th, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure GetMousePosP(var P: TPoint);
begin
GetMousePos(P.X, P.Y);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MMouse(X, Y, RX, RY: Integer);
Contributors: Timer, Wanted, Freddy, Bixby Sayz, LordJashin.
Description: Moves the mouse humanly.
Date Created: August 7th, 2011. By Timer
Last Modified: October 7th, 2014. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MMouse(X, Y, RX, RY: Integer);
var
P: TPoint;
B1: TBox;
begin
B1 := Box(X - RX, Y - RY, X + RX, Y + RY);
P := RRectanglePoint(B1.X1, B1.Y1, B1.X2, B1.Y2);
if (MouseSpeed <> 0) then
MoveMouseEx(P.X, P.Y, RR(MouseSpeed - 3, MouseSpeed + 3))
else
MoveMouse(P.X, P.Y);
GetMousePosP(P);
if (IAbs(P.X - X) > RX) then
SetMousePos(X, P.Y);
GetMousePosP(P);
if (IAbs(P.Y - Y) > RY) then
SetMousePos(P.X, Y);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MMouseP(P: TPoint; RX, RY: Integer);
Contributors: Wanted
Description: Moves the mouse humanly to Point.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MMouseP(P: TPoint; RX, RY: Integer);
begin
MMouse(P.X, P.Y, RX, RY);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure HoldMouseWait(X, Y, RX, RY, MinTime, MaxTime: Integer; Left: Boolean);
Contributors: Wanted, Timer, Freddy.
Description: Moves the mouse and clicks + holds humanly.
Date Created: August 19th, 2011. By Wanted
Last Modified: July 20th, 2012. By Freddy
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure HoldMouseWait(X, Y, RX, RY, MinTime, MaxTime: Integer; Left: Boolean);
var
CX, CY: Integer;
begin
MMouse(X, Y, RX, RY);
WaitRR(60, 90);
GetMousePos(CX, CY);
ClickMouseEx(CX, CY, TMouseButton(not Left), RR(MinTime, MaxTime));
WaitRR(100, 200);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure HoldMouseWaitP(P: TPoint; RX, RY, MinTime, MaxTime: Integer; Left: Boolean);
Contributors: Wanted
Description: Moves the mouse to point and clicks + holds humanly.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure HoldMouseWaitP(P: TPoint; RX, RY, MinTime, MaxTime: Integer; Left: Boolean);
begin
HoldMouseWait(P.X, P.Y, RX, RY, MinTime, MaxTime, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure Mouse(X, Y, RX, RY: Integer; Left: Boolean);
Contributors: Timer, Wanted.
Description: Moves the mouse and clicks humanly.
Date Created: August 7th, 2011. By Wanted & Timer.
Last Modified: August 19th, 2011. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure Mouse(X, Y, RX, RY: Integer; Left: Boolean);
begin
HoldMouseWait(X, Y, RX, RY, 80, 120, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MouseP(P: TPoint; RX, RY: Integer; Left: Boolean);
Contributors: Wanted
Description: Moves the mouse to point and clicks humanly.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MouseP(P: TPoint; RX, RY: Integer; Left: Boolean);
begin
Mouse(P.X, P.Y, RX, RY, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MouseCurrentPos(Left: Boolean);
Contributors: Wanted
Description: Clicks the mouse in the current position.
Date Created: October 26th, 2014. By Wanted
Last Modified: October 28th, 2014. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MouseCurrentPos(Left: Boolean);
var
P: TPoint;
begin
GetMousePosP(P);
MouseP(P, 0, 0, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure HoldMouseWaitBox(X1, Y1, X2, Y2, MinTime, MaxTime: Integer; Left: Boolean);
Contributors: Wanted
Description: Moves the mouse in box and clicks + holds humanly.
Date Created: August 19th, 2011. By Wanted
Last Modified: September 18th, 2011. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure HoldMouseWaitBox(X1, Y1, X2, Y2, MinTime, MaxTime: Integer; Left: Boolean);
var
P: TPoint;
begin
P := RRectanglePoint(X1, Y1, X2, Y2);
HoldMouseWait(P.X, P.Y, 0, 0, MinTime, MaxTime, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure HoldMouseWaitBoxB(B: TBox; MinTime, MaxTime: Integer; Left: Boolean);
Contributors: Wanted
Description: Moves the mouse in box and clicks + holds humanly.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure HoldMouseWaitBoxB(B: TBox; MinTime, MaxTime: Integer; Left: Boolean);
begin
HoldMouseWaitBox(B.X1, B.Y1, B.X2, B.Y2, MinTime, MaxTime, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MouseBox(X1, Y1, X2, Y2: Integer; TypeC: ClickActions);
Contributors: Wanted, Timer, LordJashin.
Description: Clicks/moves the mouse in a specified area.
Date Created: August 7th, 2011. By Wanted & Timer.
Last Modified: October 2nd, 2012. By LordJashin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MouseBox(X1, Y1, X2, Y2: Integer; TypeC: ClickActions);
var
P: TPoint;
begin
P := RRectanglePoint(X1, Y1, X2, Y2);
case (TypeC) of
ClickLeft: Mouse(P.X, P.Y, 0, 0, True);
ClickRight: Mouse(P.X, P.Y, 0, 0, False);
MoveTo: MMouse(P.X, P.Y, 0, 0);
end;
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MouseBoxB(B: TBox; TypeC: ClickActions);
Contributors: Wanted
Description: Clicks/moves the mouse in a specified area.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MouseBoxB(B: TBox; TypeC: ClickActions);
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, TypeC);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MouseCircle(Radius, CX, CY: Integer; TypeC: ClickActions);
Contributors: Wanted, LordJashin.
Description: Clicks/moves the mouse in a circle with a specified radius.
Date Created: September 4th, 2011. By Wanted
Last Modified: October 2nd, 2012. By LordJashin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MouseCircle(Radius, CX, CY: Integer; TypeC: ClickActions);
var
P: TPoint;
begin
P := RCirclePoint(CX, CY, Radius);
case TypeC of
ClickLeft: Mouse(P.X, P.Y, 0, 0, True);
ClickRight: Mouse(P.X, P.Y, 0, 0, False);
MoveTo: MMouse(P.X, P.Y, 0, 0);
end;
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure MouseCircleP(Radius: Integer; P: TPoint; TypeC: ClickActions);
Contributors: Wanted
Description: Clicks/moves the mouse in a circle with a specified radius.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure MouseCircleP(Radius: Integer; P: TPoint; TypeC: ClickActions);
begin
MouseCircle(Radius, P.X, P.Y, TypeC);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure DragMouse(SX, SY, SRX, SRY, EX, EY, ERX, ERY: Integer; Left: Boolean);
Contributors: Naum, Wanted, Freddy.
Description: Clicks and holds the mouse and then drags it and releases it.
Date Created: August 7th, 2011. By Naum
Last Modified: July 20th, 2012. By Freddy
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure DragMouse(SX, SY, SRX, SRY, EX, EY, ERX, ERY: Integer; Left: Boolean);
var
CX, CY: Integer;
begin
MMouse(SX, SY, SRX, SRY);
WaitRR(60, 90);
GetMousePos(CX, CY);
MouseBtnDown(CX, CY, TMouseButton(not Left));
WaitRR(80, 120);
MMouse(EX, EY, ERX, ERY);
WaitRR(60, 90);
GetMousePos(CX, CY);
MouseBtnUp(CX, CY, TMouseButton(not Left));
WaitRR(100, 200);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure DragMouseP(SP: TPoint; SRX, SRY: Integer; EP: TPoint; ERX, ERY: Integer; Left: Boolean);
Contributors: Wanted
Description: Clicks and holds the mouse and then drags it and releases it.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure DragMouseP(SP: TPoint; SRX, SRY: Integer; EP: TPoint; ERX, ERY: Integer; Left: Boolean);
begin
DragMouse(SP.X, SP.Y, SRX, SRY, EP.X, EP.Y, ERX, ERY, Left);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure DragMouseBox(SX1, SY1, SX2, SY2, EX1, EY1, EX2, EY2: Integer; Left: Boolean);
Contributors: Wanted, Freddy.
Description: See DragMouse. Except for does in box areas.
Date Created: August 19th, 2011. By Wanted
Last Modified: July 20th, 2012. By Freddy
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure DragMouseBox(SX1, SY1, SX2, SY2, EX1, EY1, EX2, EY2: Integer; Left: Boolean);
var
CX, CY: Integer;
begin
MouseBox(SX1, SY1, SX2, SY2, MoveTo);
WaitRR(60, 90);
GetMousePos(CX, CY);
MouseBtnDown(CX, CY, TMouseButton(not Left));
WaitRR(80, 120);
MouseBox(EX1, EY1, EX2, EY2, MoveTo);
WaitRR(60, 90);
GetMousePos(CX, CY);
MouseBtnUp(CX, CY, TMouseButton(not Left));
WaitRR(100, 200);
end;
{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
procedure DragMouseBoxB(SB, EB: TBox; Left: Boolean);
Contributors: Wanted
Description: See DragMouse. Except for does in box areas.
Date Created: March 3rd, 2013. By Wanted
Last Modified: March 3rd, 2013. By Wanted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
procedure DragMouseBoxB(SB, EB: TBox; Left: Boolean);
begin
DragMouseBox(SB.X1, SB.Y1, SB.X2, SB.Y2, EB.X1, EB.Y1, EB.X2, EB.Y2, Left);
end;