PDA

View Full Version : HoverSpell; Antiban/Spell Casting/Spell checking function.



R0b0t1
08-08-2007, 09:41 PM
Lol... This is one of JAD's Ideas that I stole from him.

Haven't found any bugs yet, but you could help :).

Well... I have two versions. The first one is just a big "case" statement with EXACT coords. The second adds coords to the x and y and may be off of the center a bit. I guess I can post both.


Gives you an option to cast the spell and returns true if it sees the green "you have the runes" color.

program HoverMagic;
{.Include SRL/SRL.scar}

Function HoverSpell(Which: Integer; Cast:Boolean): Boolean;
Var xm, ym, xz, yz:Integer;
begin;
If (not (GameTab(7)))Then
GameTab(7);
GetMousePos(xz, yz);
Case Which of
1: begin; //Home tele //Row 1
xm:= 575;
ym:= 235;
end;
2: begin;
xm:= 600;
ym:= 235;
end;
3: begin;
xm:= 623;
ym:= 240;
end;
4: begin;
xm:= 650;
ym:= 240;
end;
5: begin;
xm:= 674;
ym:= 235;
end;
6: begin;
xm:= 697;
ym:= 240;
end;
7: begin;
xm:= 720;
ym:= 238
end;
8: begin; //Row 2
xm:= 577;
ym:= 262;
end;
9: begin;
xm:= 600;
ym:= 262;
end;
10: begin;
xm:= 622;
ym:= 261;
end;
11: begin;
xm:= 649;
ym:= 261;
end;
12: begin;
xm:= 670;
ym:= 263;
end;
13: begin;
xm:= 696;
ym:= 265;
end;
14: begin;
xm:= 721;
ym:= 265;
end;
15: begin; //Row 3
xm:= 579;
ym:= 286;
end;
16: begin;
xm:= 600;
ym:= 286;
end;
17: begin;
xm:= 623;
ym:= 286;
end;
18: begin;
xm:= 647;
ym:= 286;
end;
19: begin;
xm:= 671;
ym:= 287;
end;
20: begin;
xm:= 697;
ym:= 285;
end;
21: begin;
xm:= 718;
ym:= 286;
end;
22: begin; //Row 4
xm:= 580;
ym:= 311;
end;
23: begin;
xm:= 600;
ym:= 311;
end;
24: begin;
xm:= 627;
ym:= 313;
end;
25: begin;
xm:= 646;
ym:= 309;
end;
26: begin;
xm:= 627;
ym:= 312;
end;
27: begin;
xm:= 694;
ym:= 310;
end;
28: begin;
xm:= 721;
ym:= 309;
end;
29: begin; //Row 5
xm:= 577;
ym:= 335;
end;
30: begin;
xm:= 601;
ym:= 334;
end;
31: begin;
xm:= 624;
ym:= 338;
end;
32: begin;
xm:= 649;
ym:= 336;
end;
33: begin;
xm:= 673;
ym:= 334;
end;
34: begin;
xm:= 697;
ym:= 335;
end;
35: begin;
xm:= 720;
ym:= 335;
end;
36: begin; //Row 6
xm:= 572;
ym:= 356;
end;
37: begin;
xm:= 599;
ym:= 359;
end;
38: begin;
xm:= 624;
ym:= 356;
end;
39: begin;
xm:= 649;
ym:= 359;
end;
40: begin;
xm:= 671;
ym:= 362;
end;
41: begin;
xm:= 649;
ym:= 362;
end;
42: begin;
xm:= 720;
ym:= 361;
end;
43: begin; //Row 7
xm:= 704;
ym:= 544;
end;
44: begin;
xm:= 731;
ym:= 552;
end;
45: begin;
xm:= 755;
ym:= 550;
end;
46: begin;
xm:= 781;
ym:= 550;
end;
47: begin;
xm:= 800;
ym:= 552;
end;
48: begin;
xm:= 827;
ym:= 552;
end;
49: begin;
xm:= 851;
ym:= 550;
end;
50: begin; //Row 8
xm:= 705;
ym:= 573;
end;
51: begin;
xm:= 731;
ym:= 571;
end;
52: begin;
xm:= 752;
ym:= 572;
end;
53: begin;
xm:= 781;
ym:= 572;
end;
54: begin;
xm:= 801;
ym:= 572;
end;
55: begin;
xm:= 826;
ym:= 572;
end;
56: begin;
xm:= 851;
ym:= 562;
end;
57: begin; //Row 9
xm:= 704;
ym:= 598;
end;
58: begin;
xm:= 729;
ym:= 597;
end;
59: begin;
xm:= 753;
ym:= 598;
end;
60: begin;
xm:= 776;
ym:= 599;
end;
61: begin;
xm:= 802;
ym:= 599;
end;
62: begin;
xm:= 822;
ym:= 599;
end;
63: begin;
xm:= 850;
ym:= 599;
end;
end;
If (FindColorTolerance(x, y, 65280, 680, 440, 870, 456, 5) or
FindColorTolerance(x, y, 65280, 680, 600, 870, 625, 5)) Then
begin;
Result:= True;
end else
begin;
Result:= False;
end;
If (Cast) Then
begin;
MMouse(xm, ym, 5, 5);
Wait(500+Random(1000));
Mouse(xm, ym, 5, 5, True);
end else
begin;
MMouse(xm, ym, 5, 5);
Wait(3000+Random(3000));
MMouse(xz, yz, 5, 5);
end;
end;

begin
WriteLn('spell 36 makes the box to top');
WriteLn('Green spell color is: 65280');
HoverSpell(36, False);
If not (HoverSpell(36, False)) Then
Writeln('TEST COMPLETE');
end.


This on it a little different and works a little different too. Spells cords start at 0.

program New;
{.Include SRL/SRL.scar}

Function HoverSpell(Row, Column: Integer; Cast: Boolean): Boolean;
Var i, b, xm, ym: Integer;
begin;
If not (GetCurrentTab = 7)Then
begin;
MouseBox(730, 175, 740, 205, 1);
Wait(500+Random(1000));
end;
xm:= 575;
ym:= 235;
For I:=1 to Row do
begin;
ym:= ym + 30 - 2;
end;
For B:=1 to Column do
begin;
xm:= xm + 25 - 2;
end;
If (FindColorTolerance(x, y, 65280, 680, 440, 870, 456, 5) or
FindColorTolerance(x, y, 65280, 680, 600, 870, 625, 5)) Then
begin;
Result:= True;
end else
begin;
Result:= False;
end;
If (Cast) Then
begin;
MMouse(xm, ym, 3, 3);
Wait(500+Random(1000));
Mouse(xm, ym, 3, 3, True);
end else
begin;
MMouse(xm, ym, 3, 3);
Wait(3000+Random(3000));
MMouse(xm, ym, 3, 3);
end;
end;

begin
BenMouse:= True;
HoverSpell(1, 3, False);
If (HoverSpell(1, 3, False)) Then //Wind bolt
WriteLn('YAY!');
end.

Tim0suprem0
08-08-2007, 10:13 PM
These look nice :) That is a gigantic case though.

R0b0t1
08-08-2007, 10:45 PM
Yeah. But it works fast enough for me. I don't think it actually loads the rest of the case stement except for whats called.

Santa_Clause
08-09-2007, 04:12 AM
True. It doesn't...are you sure you need all the begins and ends though?

As for this:

MMouse(xm, ym, 3, 3);
Wait(500+Random(1000));
Mouse(xm, ym, 3, 3, True);

What's the point? Mouse already waits a sufficient time before clicking...unless you wanted to check for UpText?

Good work though. I bet it took a long time getting all those co-ordinates.

R0b0t1
08-09-2007, 08:38 PM
Dunno, the begins were just to be safe. (Methinks more than one command needs begin-end; Like in an If statement).

It didn't take that long... I used a for loop to create the case statement :).

ZephyrsFury
08-10-2007, 08:49 AM
I like it. :) Maybe you could replace the numbers with the actually names of the spells so people won't have to count the spell numbers. ;)

R0b0t1
08-11-2007, 12:37 AM
When I feel like it...

But for the anti-ban part of it, making a random number to hover over the spell would be easier than a random case.

Sp0rky
08-11-2007, 01:07 AM
This is nice, can I use it in a script if I credit fully?

R0b0t1
08-11-2007, 02:38 AM
Yes... Thats why I posted it here :) feel free.

I'd like to see my name somewhere too.

TravisV10
08-11-2007, 02:54 AM
that sucks

R0b0t1
08-15-2007, 11:39 PM
What sucks? Tell me more.

Really... Post something usefull.

Santa_Clause
08-16-2007, 11:54 AM
that sucks

Shutup Travis. I'd like to see you try.

Also, r0bot...you could do something like:

case which of

1: Spell := WindStrike;

2: Spell := WaterStrike;

end;

R0b0t1
08-16-2007, 06:33 PM
*gasp*


That would take a long time.

But I could do it... when I'm bored :p

Santa_Clause
08-17-2007, 09:34 AM
Ask if you need help.

R0b0t1
08-17-2007, 05:36 PM
Nah. I don't think I do, but thats a pretty big case... And I can use a loop to generate it!