Log in

View Full Version : Login script.



seany
09-03-2010, 01:30 PM
ive looked around and even looked in other peoples scripts but i cant find any which actually logs in.

can anyone point me in the right direction?


this isnt actually for Runescape but instead Battlescape, but the login page is pretty much the same.

Cstrike
09-03-2010, 02:42 PM
Does SRL even make scripts for battlescape O_o ?


[I've never played it]

Frement
09-03-2010, 03:41 PM
Heres a script I have made (Doesn't work 100%):
program BSScript;
{$I SRL/SRL.scar}

var HP_Check: Integer;

const Username = '';
Password = '';
Script = 1; // 1 = Paladin Thiever
// 2 = Black Knight Killer
// 3 = Magic Axe Killer
// 4 = Hill Giant Killer
// 5 = Fire Rune Buyer
// 6 = Nature Rune Buyer
Eating = True; // Defines if the script eats (Sharks).

GTAB_COMBAT = 'combat';
GTAB_STATS = 'stats';
GTAB_QUEST = 'quest';
GTAB_INV = 'inventory';
GTAB_EQUIP = 'equip';
GTAB_PRAYER = 'prayer';
GTAB_MAGIC = 'magic';
GTAB_FRIENDS = 'friends';
GTAB_IGNORE = 'ignore';
GTAB_LOGOUT = 'logout';
GTAB_OPTIONS = 'options';
GTAB_EMOTES = 'emotes';
GTAB_MUSIC = 'music';

FMSX1 = 7; //Main Screen top-left corner X value.
FMSY1 = 5; //Main Screen top-left corner Y value.
FMSX2 = 517; //Main Screen bottom-right corner X value.
FMSY2 = 337; //Main Screen bottom-right corner Y value.

FMMX1 = 555;
FMMY1 = 5;
FMMX2 = 724;
FMMY2 = 151;

FMSCX = 263; //Main Screen center X value.
FMSCY = 206; //Main Screen center Y value.

FMIX1 = 547; //Inventory top-left corner X value.
FMIY1 = 205; //Inventory top-left corner Y value.
FMIX2 = 740; //Inventory bottom-right corner X value.
FMIY2 = 467; //Inventory bottom-right corner Y value.

procedure ClickTab(x, y: Integer);
begin
if not (GetColor(x, y) = 1778795) then begin
Mouse(x, y, 1, 1, True);
end;
end;

procedure F_SetAngle(Highest : Boolean);
begin
KeyDown((Integer(not Highest) * 2) + 38);
Sleep(1000 + Random(300));
KeyUp((Integer(not Highest) * 2) + 38);
Wait(500 + Random(100));
end;

procedure F_GameTab(GTab: String);
begin
case GTab of
'combat': ClickTab(532, 176);
'stats': ClickTab(567, 171);
'quest': ClickTab(599, 172);
'inventory': ClickTab(632, 171);
'equip': ClickTab(666, 171);
'prayer': ClickTab(706, 174);
'magic': ClickTab(737, 171);
'friends': ClickTab(569, 469);
'ignore': ClickTab(598, 470);
'logout': ClickTab(632, 470);
'options': ClickTab(671, 476);
'emotes': ClickTab(698, 482);
'music': ClickTab(740, 469);
end;
end;

function FullHP: Boolean;
begin
F_GameTab(GTAB_STATS);
if (CountColorTolerance(65535, 647, 209, 661, 222, 15) = CountColorTolerance(65535, 659, 221, 673, 234, 15)) then begin
Result := True;
end else begin
F_GameTab(GTAB_INV);
Result := False;
end;
end;

procedure AlchAddyPlate;
var x, y: Integer;
begin
if (FindColorTolerance(x, y, 4873802, FMIX1, FMIY1, FMIX2, FMIY2, 5)) then begin
Mouse(x, y, 2, 3, True);
end;
end;

procedure Alch;
var x, y: Integer;
begin
if (FindColorTolerance(x, y, 4873802, FMIX1, FMIY1, FMIX2, FMIY2, 5)) then begin
F_GameTab(GTAB_MAGIC);
Mouse(716, 335, 1, 1, True);
Wait(400+Random(100));
AlchAddyPlate;
Wait(1700+Random(100));
F_GameTab(GTAB_INV);
end;
end;

procedure ClickAttack(x, y: Integer);
begin
Mouse(x, y, 0, 0, True);
Wait(200 + Random(500));
Wait(2200 + Random(500));
end;

procedure ClickPickpocket(x, y: Integer);
begin
Mouse(x, y, 0, 0, False);
Wait(200 + Random(500));
Mouse(x, y+40, 1, 1, True);
Wait(1500 + Random(300));
end;

function F_InFight: Boolean;
var x, y: Integer;
begin
Result := False;
if (FindColorTolerance(x, y, 65280, 221, 119, 283, 169, 5)) then begin
Result := True;
end;
end;

procedure RelocateToNPC;
var x, y: Integer;
begin
if (FindColorTolerance(x, y, 195836, FMMX1, FMMY1, FMMX2, FMMY2, 10)) then begin
Mouse(x, y, 1, 1, True);
Wait(2500+Random(500));
end;
end;

function F_FightAt(x, y: Integer): Boolean;
begin
Result := False;
{if (FindColorTolerance(x, y, 65280, x-30, y-10, x+30, y, 5)) then begin
Result := True;
end;}
end;

// Black Knight: 460553 (CCT: 150);
// Paladin: 7434875 (CCT: 150);
// Magic Axe: 2843259 (CCT: 100);
// Hill Giant: 8039378 (CCT: 100);
procedure Attack(Color, CCT: Integer; Click: String);
var AttackTP: TPoint;
AttackTPA: TPointArray;
AttackATPA: T2DPointArray;
i, x, y, AttackHigh: Integer;
begin
if (FindColorsSpiralTolerance(x, y, AttackTPA, Color, FMSX1, FMSY1, FMSX2, FMSY2, 15)) then
begin
SortTPAFrom(AttackTPA, Point(MSCX, MSCY));
AttackATPA := TPAtoATPAEx(AttackTPA, 10, 10);
AttackHigh := High(AttackATPA);
for i := 0 to AttackHigh do
begin
if (i > 15) then begin
RelocateToNPC;
Break;
end;
AttackTP := MiddleTPA(AttackATPA[i]);
if not (F_FightAt(AttackTP.X, AttackTP.Y)) then begin
MMouse(AttackTP.X, AttackTP.Y, 3, 3);
Wait(100);
if (CountColorTolerance(1040102, 73, 3, 381, 19, 70)>CCT) then
begin
GetMousePos(x, y);
case Click of
'pickpocket': ClickPickpocket(x, y);
'attack': ClickAttack(x, y);
end;
Break;
end;
end;
end;
end;
end;

function HP_Checks: Boolean;
begin
Result := False;
if (HP_Check >= 5) then begin
HP_Check := 0;
Result := True;
end;
Inc(HP_Check);
end;

procedure Eat;
var x, y: Integer;
begin
if (HP_Checks) then begin
if not (FullHP) then begin
F_GameTab(GTAB_INV);
if (FindColorTolerance(x, y, 6782103, FMIX1, FMIY1, FMIX2, FMIY2, 9)) then begin
Mouse(x, y, 2, 3, True);
end;
end else begin
Writeln('HP is full.');
end;
F_GameTab(GTAB_INV);
end;
end;

function F_LoggedIn: Boolean;
begin
Result := True;
if (GetColor(180, 112) = 11184810) then begin
Result := False;
end;
end;

procedure F_LogIn;
begin
Mouse(273, 193, 2, 2, True);
TypeSend(Username);
Wait(300);
TypeSend(Password);
Wait(2000);
Wait(500+Random(500));
end;

procedure F_LogOut;
begin
F_GameTab(GTAB_LOGOUT);
Wait(100);
Mouse(639, 376, 1, 1, True);
end;

procedure PaladinThiever;
begin
repeat
ClearDebug;
Writeln('Preparing to pickpocket.');
Attack(5552103, 100, 'pickpocket');
Alch;
if (Eating) then begin
Eat;
end;
until(False);
end;

procedure BlackKnightKiller;
begin
repeat
ClearDebug;
Writeln('Preparing to attack.');
Attack(1184277, 150, 'attack');
F_GameTab(GTAB_INV);
F_GameTab(GTAB_STATS);
while (F_InFight) do begin
if (Eating) then begin
Eat;
end;
Wait(1000);
ClearDebug;
Writeln('We are fighting.');
end;
until(False);
end;

procedure MagicAxeKiller;
begin
repeat
ClearDebug;
Writeln('Preparing to attack.');
Attack(2843259, 100, 'attack');
F_GameTab(GTAB_INV);
F_GameTab(GTAB_STATS);
while (F_InFight) do begin
if (Eating) then begin
Eat;
end;
Wait(1000);
ClearDebug;
Writeln('We are fighting.');
end;
until(False);
end;

procedure HillGiantKiller;
begin
repeat
ClearDebug;
Writeln('Preparing to attack.');
Attack(8039378, 100, 'attack');
F_GameTab(GTAB_INV);
F_GameTab(GTAB_STATS);
while (F_InFight) do begin
if (Eating) then begin
Eat;
end;
Wait(1000);
ClearDebug;
Writeln('We are fighting.');
end;
until(False);
end;

procedure FireBuyer;
begin
repeat
Mouse(284, 84, 0, 0, False);
Wait(150);
Mouse(284, 164, 0, 0, True);
Wait(150);
until(False);
end;

procedure NatureBuyer;
begin
repeat
Mouse(333, 132, 0, 0, False);
Wait(150);
Mouse(333, 212, 0, 0, True);
Wait(150);
until(False);
end;

procedure Debug;
begin
Writeln(IntToStr(CountColorTolerance(65535, 710, 210, 741, 236, 15)));
end;

begin
SetupSRL;
if not (F_LoggedIn) then begin F_LogIn; end;
case Script of
0: Debug;
1: PaladinThiever;
2: BlackKnightKiller;
3: MagicAxeKiller;
4: HillGiantKiller;
5: FireBuyer;
6: NatureBuyer;
end;
end.

The width and height of the browser need to be exactly the same as runescape (Or atleast 95% the same).

Heavenguard
09-03-2010, 05:02 PM
Wow ^^ thats really clever Frement.

If you want you can just try this and see if the SRL function for logging into runescape works. If it logs in your player then the function to login works, if it still sais your not loggedin then the function for checking to see if your logged in doesn't work, but it should be really easy to make your own.


program new;
{$i srl\srl.scar}

procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := 'YourUser';
Players[0].Pass := 'YourPass';
Players[0].Nick := 'ser';
Players[0].Active := True;
end;

function LogMeIn: Boolean;
begin
LoginPlayer;
Result := LoggedIn;
if (not(Result)) then
Writeln('Our Player is not LoggedIn');
end;

begin
//ClearDebug;
SetupSRL;
DeclarePlayers;
LogMeIn;
end.

Frement
09-03-2010, 05:12 PM
Wow ^^ thats really clever Frement.

If you want you can just try this and see if the SRL function for logging into runescape works. If it logs in your player then the function to login works, if it still sais your not loggedin then the function for checking to see if your logged in doesn't work, but it should be really easy to make your own.


program new;
{$i srl\srl.scar}

procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := 'YourUser';
Players[0].Pass := 'YourPass';
Players[0].Nick := 'ser';
Players[0].Active := True;
end;

function LogMeIn: Boolean;
begin
LoginPlayer;
Result := LoggedIn;
if (not(Result)) then
Writeln('Our Player is not LoggedIn');
end;

begin
//ClearDebug;
SetupSRL;
DeclarePlayers;
LogMeIn;
end.


It doesn't ;)

seany
09-07-2010, 01:16 AM
still needing help with this.