DemiseScythe
2012-03-18 22:30:53
The Spin the Wheel widget has been glitching my merching scripts lately causing them to get stuck so I made some code to spin the wheel for us. It should remove the wheel interface if it exists or just proceed as normal. Works as FindNormalRandoms but should only be run once right after login in due to the fact that it actually moves the mouse. At this time it is set to discard all rewards, partially because I found them to be crappy most of the time but because I was unabled to grab or search the text on the reward interphase after trying out all fonts. It is still crude but it works for me, may be it can be incorporated into SRL for people to use.
Fine, this is a revision for those who requested it, it sees if the wheel is active and it clicks the X, so that it disappears until next time you log in. Then you can spin the wheel on your own time if you so wish to and whilest logged in and the script is running, this should not get in the way.
I think that is the best solution for this issue.
function Spin: boolean;
var
x, y, i, t: Integer;
begin
MouseBox(397, 275, 414, 293, 3);
Result := WaitUpText('Play', 300);
if Result then
begin
Writeln('Squal of Fortune is Active');
GetMousePos(x, y);
Mouse(x, y, 3, 3, false);
WaitOption('Play', 300);
t := 0;
repeat
Wait(100 + Random(50));
Inc(t);
until FindColorTolerance(x, y, 2425017, 649, 300, 664, 322, 5) or (t > 15);
repeat
i := CountColor(4503538, 372, 80, 409, 112);
//Writeln(IntToStr(i));
// 119 = '2'
// 93 = '1'
case i of
119:
begin
Writeln('We have 2 attempts left');
Writeln('Spinning the Wheel');
FindColorTolerance(x, y, 2307555, 648, 355, 662, 371, 40);
Mouse(x, y, 3, 3, true);
repeat
Wait(100 + Random(50));
until FindColorTolerance(x, y, 9920813, 462, 215, 585, 268, 20);
Writeln('Discarding Loot');
Mouse(527, 258, 3, 3, true);
Wait(1500 + Random(500));
Writeln('Starting next attempt');
if FindColorTolerance(x, y, 2656589, 483, 293, 588, 315, 20) then
Mouse(x, y, 3, 3, true);
t := 0;
repeat
Wait(100 + Random(50));
Inc(t);
until FindColorTolerance(x, y, 2425017, 649, 300, 664, 322, 5) or (t > 15);
end;
93:
begin
Writeln('We have 1 attempt left');
Writeln('Spinning the Wheel');
FindColorTolerance(x, y, 2307555, 648, 355, 662, 371, 40);
Mouse(x, y, 3, 3, true);
repeat
Wait(100 + Random(50));
until FindColorTolerance(x, y, 9920813, 462, 215, 585, 268, 20);
Writeln('Discarding Loot');
Mouse(527, 258, 3, 3, true);
Wait(750 + Random(250));
Writeln('Closing Interphase');
if FindColorTolerance(x, y, 2237137, 483, 326, 588, 350, 20) then
Mouse(x, y, 3, 3, true);
Exit;
end;
end;
until (i = 0);
end;
end; Fine, this is a revision for those who requested it, it sees if the wheel is active and it clicks the X, so that it disappears until next time you log in. Then you can spin the wheel on your own time if you so wish to and whilest logged in and the script is running, this should not get in the way.
function Spin: Boolean;
begin
MMouse(407, 282, 3, 3);
Result := WaitUpText('Play', 500);
if Result then
begin
Mouse(464, 283, 1, 1, False);
WaitOption('Select', 500);
Wait(500 + Random(250));
end;
end;
I think that is the best solution for this issue.