SRL Archive - Help and Support

And it just keeps screwing up...


R0b0t1

2008-04-24 21:57:06


program New;
{.include SRL/SRL.scar}
const
ScriptURL = 'isnotregistered';
BoltType = 'Diamond';
type
TBoltCont = record
B: TBox;
P: TPoint;
end;
var
BB: TBoltCont;

procedure SetBoltBounds;
begin
case LowerCase(BoltType) of
'opal' :begin;BB.B := PointToBox(IntToPoint(35,65),IntToPoint(80,175));
BB.P := IntToPoint(60,115);end;
'sapphire',
'sapph' :begin;BB.B := PointToBox(IntToPoint(110,60),IntToPoint(200,180));
BB.P := IntToPoint(155,115);end;
'jade' :begin;BB.B := PointToBox(IntToPoint(220,65),IntToPoint(280,180));
BB.P := IntToPoint(255,120);end;
'pearl' :begin;BB.B := PointToBox(IntToPoint(320,65),IntToPoint(380,180));
BB.P := IntToPoint(355,115);end;
'emerald',
'emer' :begin;BB.B := PointToBox(IntToPoint(410,60),IntToPoint(495,180));
BB.P := IntToPoint(445,115);end;
'red topaz',
'red top':begin;BB.B := PointToBox(IntToPoint(30,195),IntToPoint(95,310));
BB.P := IntToPoint(70,250);end;
'ruby' :begin;BB.B := PointToBox(IntToPoint(115,190),IntToPoint(195,310));
BB.P := IntToPoint(155,250);end;
'diamond',
'diam' :begin;BB.B := PointToBox(IntToPoint(210,195),IntToPoint(295,310));
BB.P := IntToPoint(250,250);end;
'dragonstone',
'drag',
'ds' :begin;BB.B := PointToBox(IntToPoint(310,190),IntToPoint(390,310));
BB.P := IntToPoint(355,245);end;
'onyx' :begin;BB.B := PointToBox(IntToPoint(410,195),IntToPoint(490,310));
BB.P := IntToPoint(445,250);end;
end;
end;

procedure ClickBow(BowTol, WMS: Integer);
var x, y: Integer;
begin
if not FindColorTolerance(x, y, 1523812, 635, 230, 650, 245, BowTol) then
begin
WriteLn('Did not find crossbow color, stopping!');
WriteLn('Please relocate your mouse and switch to the correct screen.');
repeat
Wait(1);
until(FindColorTolerance(x, y, 1523812, 635, 230, 650, 245, BowTol));
end;
Mouse(x, y, -5, 5, True); //640, 235
Wait(WMS + Random(100));
end;

function BoltsUp(BoltTol, ST: Integer): Boolean;
var x, y, TTS: Integer;
begin
Result:= True;
if not FindColorTolerance(x, y, 2070783, 240, 30, 245, 40, BoltTol) then
begin
WriteLn('Event: Screen not up, waiting...');
TTS := 0;
repeat
Wait(1);
Inc(TTS);
if TTS>ST then //If searching >S(afe)T(ime), stop.
begin
WriteLn('Error: Enchant screen not found!');
Result:= False;
Break;
end;
until(FindColorTolerance(x, y, 2070783, 240, 30, 245, 40, BoltTol));
end;
end;

procedure ClickBolts(RTol, WST: Integer);
var x, y: Integer;
begin
if FindColorTolerance(x, y, BB.B.x1, BB.B.y1, BB.B.x2, BB.B.y2, 310, RTol) then
begin
WriteLn('Event: Not enough runes!');
WriteLn('MSG : Do you have the correct co-ords for your bolts?');
TerminateScript;
end;
Mouse(BB.P.x, BB.P.y, 10, 10, True);
Wait(WST+Random(100));
end;

procedure ScriptTerminate;
begin
WriteLn('Event: Script terminated.');
WriteLn('MSG : If this is a recurring error, please go to');
WriteLn(' '+ScriptURL+' for help or email the creator');
WriteLn(' at [email]R030t1@gmail.com[/email] (ctrl+click to follow)');
end;

begin
MouseSpeed:= 12;
SetBoltBounds;
repeat
ClickBow(5, 600);
if BoltsUp(5, 10000) then
ClickBolts(10, 50);
until(IsFKeyDown(12))
end.

Seems like it should work! Someone help me see why it isn't?

EvilChicken!

2008-04-24 22:44:35

I don't know what doesn't work, it compils fine.. Added standards at least..

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

const
ScriptURL = 'isnotregistered';
BoltType = 'Diamond';

type
TBoltCont = record
B: TBox;
P: TPoint;
end;

var
BB: TBoltCont;

procedure SetBoltBounds;
begin
case LowerCase(BoltType) of
'opal': begin
BB.B := PointToBox(IntToPoint(35, 65), IntToPoint(80, 175));
BB.P := IntToPoint(60, 115);
end;
'sapphire',
'sapph': begin
BB.B := PointToBox(IntToPoint(110, 60), IntToPoint(200, 180));
BB.P := IntToPoint(155, 115);
end;
'jade': begin
BB.B := PointToBox(IntToPoint(220, 65), IntToPoint(280, 180));
BB.P := IntToPoint(255, 120);
end;
'pearl': begin
BB.B := PointToBox(IntToPoint(320, 65), IntToPoint(380, 180));
BB.P := IntToPoint(355, 115);
end;
'emerald',
'emer': begin
BB.B := PointToBox(IntToPoint(410, 60), IntToPoint(495, 180));
BB.P := IntToPoint(445, 115);
end;
'red topaz',
'red top': begin
BB.B := PointToBox(IntToPoint(30, 195), IntToPoint(95, 310));
BB.P := IntToPoint(70, 250);
end;
'ruby': begin
BB.B := PointToBox(IntToPoint(115, 190), IntToPoint(195, 310));
BB.P := IntToPoint(155, 250);
end;
'diamond',
'diam': begin
BB.B := PointToBox(IntToPoint(210, 195), IntToPoint(295, 310));
BB.P := IntToPoint(250, 250);
end;
'dragonstone',
'drag',
'ds': begin
BB.B := PointToBox(IntToPoint(310, 190), IntToPoint(390, 310));
BB.P := IntToPoint(355, 245);
end;
'onyx': begin
BB.B := PointToBox(IntToPoint(410, 195), IntToPoint(490, 310));
BB.P := IntToPoint(445, 250);
end;
end;
end;

procedure ClickBow(BowTol, WMS: Integer);
var
X, Y: Integer;

begin
if not FindColorTolerance(x, y, 1523812, 635, 230, 650, 245, BowTol) then
begin
WriteLn('Did not find crossbow color, stopping!');
WriteLn('Please relocate your mouse and switch to the correct screen.');
repeat
Wait(500);
until (FindColorTolerance(x, y, 1523812, 635, 230, 650, 245, BowTol));
end;
Mouse(x, y, -5, 5, True); //640, 235
Wait(WMS + Random(100));
end;

function BoltsUp(BoltTol, ST: Integer): Boolean;
var x, y, TTS: Integer;
begin
Result := True;
if not FindColorTolerance(x, y, 2070783, 240, 30, 245, 40, BoltTol) then
begin
WriteLn('Event: Screen not up, waiting...');
TTS := 0;
repeat
Wait(1);
Inc(TTS);
if TTS > ST then //If searching >S(afe)T(ime), stop.
begin
WriteLn('Error: Enchant screen not found!');
Result := False;
Break;
end;
until (FindColorTolerance(x, y, 2070783, 240, 30, 245, 40, BoltTol));
end;
end;

procedure ClickBolts(RTol, WST: Integer);
var x, y: Integer;
begin
if FindColorTolerance(x, y, BB.B.x1, BB.B.y1, BB.B.x2, BB.B.y2, 310, RTol) then
begin
WriteLn('Event: Not enough runes!');
WriteLn('MSG : Do you have the correct co-ords for your bolts?');
TerminateScript;
end;
Mouse(BB.P.x, BB.P.y, 10, 10, True);
Wait(WST + Random(100));
end;

procedure ScriptTerminate;
begin
WriteLn('Event: Script terminated.');
WriteLn('MSG : If this is a recurring error, please go to');
WriteLn(' ' + ScriptURL + ' for help or email the creator');
WriteLn(' at <a href="mailto:R030t1@gmail.com">R030t1@gmail.com</a> (ctrl+click to follow)');
end;

begin
MouseSpeed := 12;
SetBoltBounds;
repeat
ClickBow(5, 600);
if BoltsUp(5, 10000) then
ClickBolts(10, 50);
until (IsFKeyDown(12))
end.

mixster

2008-04-25 02:11:45

Try changing the negative Mouse ("Mouse(x, y, -5, 5, True)") in ClickBow to a positive value as I tested moving to 500,500 with negative 10 and it just skipped to the edge of the screen, so if that's the problem, then that's the solution.

The Claw

2008-04-25 09:59:17

Does a negative random value work? I dont see the point really as it -5,5 would have the same effect as 5,5 just in the opposite direction. why not do Mouse(x, y, RandomRange(-5,5), RandomRange(-5,5)) or something?

Markus

2008-04-25 10:50:10


program New;
begin
writeln(inttostr(random(-5)));
end.
Output:

Successfully compiled (28 ms)
1908922073
Successfully executed
Successfully compiled (28 ms)
-628055480
Successfully executed
Successfully compiled (28 ms)
1391124352
Successfully executed

JuKKa

2008-04-25 11:15:11

No, the problem is when using it with the mouse procedure. I had this same problem yesterday, that the mouse just flipped out and went totally the other direction, change it to a positive number and it should work.

R0b0t1

2008-04-25 20:38:44

okay, well, it still didn't work when that value WASN'T a negative value.


-removed-

Bobarkinator

2008-04-25 22:32:30

IMO everybody should have their own standards loosely based on the right ones, I sure do

R0b0t1

2008-04-26 19:07:46

And I do. So I don't think this will ever be fixed…

Bobarkinator

2008-04-26 23:12:32

From: R0b0t1
And I do. So I don't think this will ever be fixed…


I keep meaning to look at this and always forget, PM me around 7:00 PM tomorrow so I remember.

mixster

2008-04-27 06:03:20

Can you share with what part in particular is giving you problems? I'm guessing it compiles but screws up as some point and is it's so small there doesn't seem to be any bit that should give errors, so it must be something very small…

R0b0t1

2008-04-27 11:52:14

When it moves the mouse it goes funkeh.


But that could be any number of things.

Hobbit

2008-04-27 19:12:43

Ok Ok everyone calm down, seriously. Is this trivial thing really worth getting upset over?

Last/only warning.

Santa_Clause

2008-04-28 02:39:03

Have you tried SetupSRL?

And Hobbit…I don't see anyone angry :p

Hobbit Edit… look above
Last edited by Hobbit : 04-27-2008 at 04:11 PM.

R0b0t1

2008-04-29 20:20:35

I was angry, because he was directly insulting me by saying I did not follow the standards?