SRL Archive - OSR Help

Little help...


Element17

2012-06-25 02:42:50

It is late and I'm sure I'm missing something simple. Sorry but I'm driving myself to a massive head ache. I swear the points on the loadstone screen are changing. I made mouseboxes but the points are always off after I go to test them and I don't see how.

Function TeleportTo(Which: string): Boolean;
Var
Color, i, x, y: integer;
Coords: TIntegerArray;
Loc: string;
Clan: boolean;
Begin
If(Not(LoggedIn)) Then Exit;
Case lowercase(Which) Of
'Cath':
Begin
Color := 11567676;
Coords := [223, 181] ;
Loc := 'Catherby';
End;

'Fally': //explorer ring inv
Begin
GameTab(tab_EQUIP);
If WaitColor(725, 564, 8881791, 5, 5000) Then
Begin
Color := 8881791;
Coords := [705, 551, 732, 577];
Loc := 'Cabbage Patch';
End;
End;

'Adru':
Begin
Color := 1447231;
Coords := [175, 385, 194, 411];
Loc := 'Ardougne';
End;
End;
FindNormalRandoms;
AntiBan;
Writeln('Teleporting to '+ Loc);
GameTab(tab_magic);
If GameTab(tab_magic) Then
Result := True;
If Result Then
Begin
If FindHomeTeleport(x, y) Then
HumanMMouse(x, y, 2, 2); //Moves mouse to click home telepore
ClickMouse2(True);
If DidRedClick Then
Begin
Wait(500+Random(250));
Writeln('Clicked Home Teleport...');
End;
If LodestoneScreen Then
Begin
WriteLn('Lodestone Network screen is open!');
Wait(1000);
for i := 0 to 1 do
MMouse(Coords[i].x, Coords[i].y, 2, 2);
Writeln('Found Color');
GetMousePos(x, y);
HumanMMouse(x, y, 0,0);
ClickMouse2(True);
//MarkTime(z);
// Repeat //Random Fact generator here maybe
Writeln('Waiting till we are done teleporting..');
Wait(2500+Random(2000));
Writeln('Still teleporting..');
Wait(2000+Random(2500));
Writeln('Boo!~!');
//Until(TimeFromMark(z) > 16000);
//If Idle Then //Get idle pixelshift
Begin
//Writeln('Yay Teleported to' + Loc +);
GameTab(tab_Inv);
End;
End;
End;
End;

**Yes I have MMouse instead of mousebox because I couldn't get either or to work…

riwu

2012-06-25 03:23:34

Your coordinate for fally (Coords := [705, 551, 732, 577];) seems too large so you probably took the coordinate without dragging the crosshair to the RS window first.

Also there is already a lodestone teleport function in srl includes so there is no need to make a custom one urself ;)


(*
LodestoneTeleport
~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function LodestoneTeleport(Where: String): Boolean;

Teleports you to chosen location via Lodestone teleport.

.. note::

Author: Home

Example:

.. code-block:: pascal

If CastHomeTeleport then
Lodestoneteleport('Lumbridge');
*)
function LodestoneTeleport(Where: String): Boolean;
var
TPA: TPointArray;
TSA: TStringArray;
CTS, I: Integer;
begin
If not LoggedIn then Exit;
If not LodestoneScreen then Exit;

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

TSA := ['Lunar Isle', 'Yanille', 'Ardougne', 'Seers Village', 'Catherby', 'Taverley',
'Burthorpe', 'Edgeville', 'Falador', 'Port Sarim', 'Draynor Village', 'Lumbridge',
'Varrock', 'Al Kharid', 'Bandit Camp'];

TPA := [Point(45, 78), Point(160, 262), Point(167, 211), Point(192, 158), Point(223, 181),
Point(253, 180), Point(251, 145), Point(293, 160), Point(278, 206), Point(276, 249), Point(308, 211),
Point(327, 243), Point(345, 182), Point(362, 229), Point(326, 297)];

for I := 0 to 14 do
if Capitalize(Where) = TSA[I] then
begin
MMouse(TPA[I].X, TPA[I].Y, 2, 2);

if (WaitUptextMulti(['Teleport', 'ele', 'ort', 'lepo', 'epor'], 400)) then
begin
ClickMouse2(Mouse_Left);
Result := true;
end;
end;

ColorToleranceSpeed(CTS);
end;

Element17

2012-06-25 11:34:56

Yeah I know there is one, but I like creating my own stuff lol. As for the fally one, that is the coords for the ring slot as I'm using the explorers ring/

Runaway

2012-06-25 11:50:07

Hey there,

I know this isn't very direct help, but this might be able to help you in some way. This is a teleport snippet from my Lumb fisher (uses lumb lodestone tele):


function Teleport(Which: String; Tries: Integer): Boolean;
var
CoordBox, LodeBox: TBox;
Click, Tab, Color, x, y, i: Integer;
Area: String;
Lodestone: Boolean;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'lumb':
begin
Color := TeleColor; CoordBox := IntToBox(568, 223, 580, 235); Tab := tab_MAGIC;
Click := mouse_left; Lodestone := True; Area := 'lumbridge';
end;
'dung':
begin
Color := KinColor; CoordBox := IntToBox(683, 371, 713, 386); Tab := tab_EQUIP;
Click := mouse_right; Lodestone := False; Area := 'daemonheim';
end;
end;
i := 0;
repeat
AntiBan;
Currently('Teleporting to '+ Area +': Attempt '+ IntToStr(i + 1) +'...');
TabWait(1000, Tab);
if ColorWait(2000, Color, 10, CoordBox) then
begin
MouseTBox(CoordBox, mouse_move);
ClickMouse2(Click);
if Lodestone then
begin
LodeBox := IntToBox(318, 230, 334, 248);
if ColorWait(4000, LumbColor, 10, LodeBox) then
begin
MouseTBox(LodeBox, mouse_left);
Result := True;
Break;
end;
end else
begin
Result := WaitOptionMulti(['ele','port'], 1000);
if Result then
Break
else
begin
GetMousePos(x, y);
MMouse((x+RandomRange(-30,30)), (y-50-Random(50)), 5, 5);
Wait(250+Random(250));
end;
end;
end;
Inc(i);
until(i > Tries);
TabWait(1000, tab_INV);
if Result then
Currently('Teleported to '+ Area +'!')
else
Currently('Failed to teleport to '+ Area +'!');
end;

Element17

2012-06-25 17:55:01

I'm on my phone but it looks great! I think I'll be able to get some ideas from it, but have you ever noticed the coords of the icons on the loadstone screen change? I swear mine are slighting moving every other time.

P1ng

2012-06-25 19:05:51

Perhaps make a DTM or bitmap for each icon and then have it click that. Or alternatively use a predominant colour and separate it from the others with TPA?

Runaway

2012-06-25 19:24:07

From: 14578
I'm on my phone but it looks great! I think I'll be able to get some ideas from it, but have you ever noticed the coords of the icons on the loadstone screen change? I swear mine are slighting moving every other time.


Hmm, never had any issues using a static box with the lumb tele. You could try what p1ng mentioned about the TPA though; search for all of the lodestone colors, combine them into one TPA, use TPAToATPAEx to separate the TPA into boxes of the exact size of the lodestone you're looking for, use SortATPASize to sort the ATPA's from biggest to smallest, and the first TPA in your ATPA will certainly be the one you're looking for :)