SRL Archive - First Scripts

Autologin Script


deathie

2007-10-24 01:51:13

This is my first script that I made to practice finding colors, moving and clicking the mouse, timed delays, debugging, and standards. I wanted to make something generic that could be built on for later scripting.

Update in v0.2: Chat modes are changed, compass is set, special bar is set if on members world and holding a weapon with that option.

What It Does
  • Turns annoying splashscreen music off if desired (control by a constant)
  • Selects the most quiet member world, or f2p if a constant is changed
  • Logs in using the SRL login procedure
  • Sets run energy to ON after login

Notes:
credit for the music procedure goes to Nikize, although it was modified

To do list:
Make antirandom
Decide on what in-game skill procedures to use

Done checklist:
Change chat modes
Set special bar if the correct weapon is equipped


Please say if this is a good or bad start. (Oh and tell me how I can make this efficient.) Also I was looking around and saw that the WorldSwitcher SRL scarscript wasn't mentioned in the wiki. Could someone care to explain the WorldSelect function in it a little better? thanks!


{ Auto login script by Deathie
Description:Turns off annoying music button, picks a quiet world, logs in, and sets run to true.
New in v0.2: Also sets up chat and special attack settings.

To setup this script go to the procedure DeclarePlayers, scroll down,
and set username and password.
}
program LoginNow;
{.include SRL\SRL.scar}

// Variables
var
x, y, WorldColor: integer;

{.include SRL\srl\misc\WorldSwitcher.scar}

// Constants
const
MembWorld = True; //True: Find quiet member world -- False: Find quiet free world
MusicOff = True; //True for splash screen music off, false to keep it on
Sign = 1315974; //Constant used in music procedure (red cancel mark color)

procedure DeclarePlayers;
begin
HowManyPlayers := 1; //How many players there are
NumberOfPlayers(HowManyPlayers); //Leave this alone
CurrentPlayer := 0; //The player to start with
Players[0].Name := 'cookie monster'; //Player username
Players[0].Pass := 'c is for cookie'; //Player password
Players[0].Nick := 'ooki'; //3-4 letters of username, NO capitals or spaces
Players[0].Pin := 0000; //Runescape bank pin number. If none just enter 0000
Players[0].Active := True; //Do you want to use this player?

//Multiplayer can be added by adding on to the array...
{
Players[1].Name := ''; //Alt. Player username
Players[1].Pass := ''; // Alt. Player password
Players[1].Nick := ''; //3-4 letters of username, NO capitals or spaces
Players[1].Pin := 0000; //Runescape bank pin number. If none just enter 0000
Players[1].Active := True;
}
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
// Writeln ('There are ' + Inttostr(HowManyPlayers)+ ' Player(s)');
end;


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\\
procedure SplashScreen; begin
cleardebug;
WriteLn('//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\\');
WriteLn('// Autologin Script for Runescape 2 by Deathie');
WriteLn('//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\\');
end;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\\

// Credit to Nikize for the music procedure -- modified by Deathie
procedure Music;
begin
Writeln('*******Music procedure*************');
if (MusicOff=False) then
begin
Writeln('You have requested to put music on.');
if (FindColor(x,y,Sign,734,482,741,491))
then begin
Writeln('Music is currently set to off..');
Writeln('Setting music on..');
MMouse(740+random(5),480+random(5),2,4);
Wait(25+random(144)); //Simulate real human delay in click
Mouse(742+random(2),482+random(2),1,3,true);
end
Writeln('***********************************');
end;
if (MusicOff=True) then begin
if (FindColor(x,y,Sign,734,482,741,491)) then
begin
Writeln('Color found, music is already off!');
Writeln('**********************************');
end else
Mouse(731+random(10),472+random(20),0,0,true);
Writeln('Logging in with music off.');
Writeln('****************************************');
end;
end;

//Find least populated world and autologin
procedure WorldLogin;
begin
// Mouse(8+random(15),352+random(30),0,0,true); //Move mouse near World Select button
Music;
Wait(100+random(99));
ClickWorldSwitchButton;
OrderBy('players', 'down');
if(MembWorld=True) then
begin
WriteLn('Searching for quiet member world.')
WorldColor := 5143442; //11711154 = f2p worlds, 5143442 = member world
OrderBy('type', 'up'); //orderby type: up = sort membs top, down = sort f2p top
end;
if(MembWorld=False) then
begin
WriteLn('Searching for quiet f2p world.')
WorldColor := 11711154; //11711154 = f2p worlds, 5143442 = member world
OrderBy('type', 'down'); //orderby type: up = sort membs top, down = sort f2p top
end;
if(FindColor(x,y,WorldColor,0,0,200,200)) then begin
Mouse(x+3+random(75),y+3+random(5),0,0,true);
WriteLn('Found a World');
WriteLn('****************************************');
WriteLn('Logging In');
LoginPlayer;
end;
end;

procedure SpecAttack(SetSpec:Boolean);
var
x,y:Integer;
begin
GameTab(1);
if SetSpec then
begin
If not FindColor(x,y,65535,575, 420, 710, 425) then
begin
Mouse(666,421,8,8, True);
WriteLn('Activated Spec');
end;
end;
if not SetSpec then
begin
If FindColor(x,y,65535,575, 420, 710, 425) then
begin
Mouse(666,421,8,8, True);
WriteLn('Deactivated Spec');
end;
end;
end;


procedure SetupIngame;
begin
Makecompass('N');
HighestAngle;
if (not(LoggedIn)) then Exit;;
Writeln('Setting chats and run');
SetChat('on', 1); //Set public chat: on, off, hide
Wait(200+random(700));
SetChat('friends', 2); //Set private chat: on, friends, off
Wait(200+random(700));
SetChat('off', 3); //Set trade messages: on, friends, off
Wait(200+random(700));
SetChat('off', 4); //Set clan chat: on, off
Wait(200+random(700));
SetRun(true);
if (MembWorld=True) then
begin
SpecAttack(true);
end;
end;

procedure Proggy; //Make a progress report in debugger
begin
SRLRandomsReport;
Writeln('Script Exited Normally');
end;

procedure MainLoop;
begin
SplashScreen;
ActivateClient;
Wait(250);
SetUpSRL;
DeclarePlayers;
if(not(loggedin))then begin
WorldLogin;
SetupIngame;
end;
Proggy;
end;

begin
MainLoop;
end.

ZaSz

2007-10-24 01:54:28

not bad for a first script! I think you did quite well.

Reeces844

2007-10-24 02:23:00

From: zasz
not bad for a first script! I think you did quite well.

Pretty good, but there are already tons of these but good starting scripts

camdo2

2007-10-24 13:40:46

Very clever to have music off. Nice script.

.Cameron.

2007-10-24 20:12:04

Good script. You thought of some interesting features to make it better than expected.

Pntbllfrk

2007-10-24 22:02:04

Very impressed, for first script. good start

deathie

2007-10-24 23:31:50

Thanks for the support, I really appreciate it. :)

Updates in v0.2:
I made it so changing worlds for either memb or f2p is a lot easier, just a boolean now. Also made a function to set special atk bar on just because I felt like it heh. Oh and of course, compass changing and setting up chat modes.

I'm currently playing with radialwalk and loving it. Still deciding what skill library to make my 2nd script with.