SRL Archive - RS3 Help

How do I start?


SRLnoob

2014-12-09 00:27:09

I have read many tutorials about how to do basic scripting, and I understand how to do just about everything I want to do in my first script. What I don't know how to do, however, is what code to write to start it up. Basically I am asking what I have to put in the begging of my script to get it to sign in all my accounts, open multiple SMART clients and stuff like that. I have looked everywhere for an answer on this and I have no idea. Thank you.

Ross

2014-12-09 00:36:57

program new;

{$DEFINE SMART}
{$i srl-6/srl.simba}



begin
clearDebug();
smartEnableDrawing := true;
smartShowConsole := false;
setupSRL();
end.

what I do.

KeepBotting

2014-12-09 07:49:05

I've got some time before I leave for school so I'll build on Ross's code a bit.

To flesh it out a bit more:


program scriptSkeleton;
{$define smart}
{$i srl-6/srl.simba}
{$i sps/lib/sps-rs3.simba}
{$define debug_on}

///////////////////////////////////Start setting up the script here. Refer to the comments if you don't know what you're doing.
///////////////////////////////////
/////// Start Setup ///////
///////////////////////////////////
///////////////////////////////////Start setting up the script here. Refer to the comments if you don't know what you're doing.

const
(* player info *)
playerName = ['']; //Put your player's name (or nickname, if you set one) here.
playerFile = 'default'; //Put your playerfile's name here. Default is 'default'.
desiredWorld = 0; //Enter your desired world number here.

(* globals *)


(* options *)


///////////////////////////////////Don't modify the script ANY FURTHER unless you know what you're doing. You could break stuff!
///////////////////////////////////
/////// Stop Setup ///////
///////////////////////////////////
///////////////////////////////////Don't modify the script ANY FURTHER unless you know what you're doing. You could break stuff!

var
placeHolder:integer;

procedure writeDebug(text:string);
begin
{$IFDEF debug_on}
writeLn('[DEBUG] : ' + text);
{$ENDIF}
end;

procedure writeWarn(text:string);
begin
{$IFDEF debug_on}
writeln('');
writeLn('[WARNING] : ' + text);
writeln('');
{$ENDIF}
end;

procedure writeError(text:string);
begin
{$IFDEF debug_on}
writeln('');
writeLn('[ERROR] : ' + text);
writeln('');
{$ENDIF}
end;

procedure initScript();
var
i:integer;
begin
clearDebug();
addOnTerminate('stop');
smartEnableDrawing := true;
smartShowConsole := false;
smartPlugins := ['opengl32.dll', 'd3d9.dll'];
writeDebug('Spawning SMART client...');
setupSrl();
disableSrlDebug := true;
players.setup(playerName, playerFile);
currentPlayer := 0;
for i := 0 to high(players) do
begin
players[i].world := desiredWorld;
players[i].isActive := true;
writeDebug('Logging in...');
end;
begin
if (not players[currentPlayer].login()) then
exit;
exitTreasure();
writeDebug('Setup complete - player is logged in.');
end;
end;

procedure initPlayer();
begin
writeDebug('Setting camera.');
minimap.clickCompass;
minimap.setAngle(MS_ANGLE_HIGH);

writeDebug('Setting run.');
if not (minimap.isRunEnabled()) then
minimap.toggleRun(true);

writeDebug('Setting gametab.');
if (not gameTabs.isTabActive(TAB_BACKPACK)) then
gameTabs.openTab(TAB_BACKPACK);
end;

procedure stop(); //hammer time
begin
writeWarn('*** Terminating script ***');
if isLoggedIn() then
writeDebug('Logging out');
players[currentPlayer].logout();
writeDebug('Freeing BMPs');
writeDebug('Freeing DTMs');
writeWarn('*** Terminated script ***');
end;

begin
initScript();
initPlayer();
end.

That snippet will start SMART, log you in, and run some basic init routines.

As far as your questions; signing in all of your accounts depends on how you write the script - namely, whether or not you decide to include multiplayer handling. If yes, it's as easy as declaring more than one playerName.

If no, you'll have to run separate instances which can be achieved by opening a separate Simba tab/window and starting a new script.

SRLnoob

2014-12-09 18:56:49

From: KeepBotting
I've got some time before I leave for school so I'll build on Ross's code a bit.

To flesh it out a bit more:


program scriptSkeleton;
{$define smart}
{$i srl-6/srl.simba}
{$i sps/lib/sps-rs3.simba}
{$define debug_on}

///////////////////////////////////Start setting up the script here. Refer to the comments if you don't know what you're doing.
///////////////////////////////////
/////// Start Setup ///////
///////////////////////////////////
///////////////////////////////////Start setting up the script here. Refer to the comments if you don't know what you're doing.

const
(* player info *)
playerName = ['']; //Put your player's name (or nickname, if you set one) here.
playerFile = 'default'; //Put your playerfile's name here. Default is 'default'.
desiredWorld = 0; //Enter your desired world number here.

(* globals *)


(* options *)


///////////////////////////////////Don't modify the script ANY FURTHER unless you know what you're doing. You could break stuff!
///////////////////////////////////
/////// Stop Setup ///////
///////////////////////////////////
///////////////////////////////////Don't modify the script ANY FURTHER unless you know what you're doing. You could break stuff!

var
placeHolder:integer;

procedure writeDebug(text:string);
begin
{$IFDEF debug_on}
writeLn('[DEBUG] : ' + text);
{$ENDIF}
end;

procedure writeWarn(text:string);
begin
{$IFDEF debug_on}
writeln('');
writeLn('[WARNING] : ' + text);
writeln('');
{$ENDIF}
end;

procedure writeError(text:string);
begin
{$IFDEF debug_on}
writeln('');
writeLn('[ERROR] : ' + text);
writeln('');
{$ENDIF}
end;

procedure initScript();
var
i:integer;
begin
clearDebug();
addOnTerminate('stop');
smartEnableDrawing := true;
smartShowConsole := false;
smartPlugins := ['opengl32.dll', 'd3d9.dll'];
writeDebug('Spawning SMART client...');
setupSrl();
disableSrlDebug := true;
players.setup(playerName, playerFile);
currentPlayer := 0;
for i := 0 to high(players) do
begin
players[i].world := desiredWorld;
players[i].isActive := true;
writeDebug('Logging in...');
end;
begin
if (not players[currentPlayer].login()) then
exit;
exitTreasure();
writeDebug('Setup complete - player is logged in.');
end;
end;

procedure initPlayer();
begin
writeDebug('Setting camera.');
minimap.clickCompass;
minimap.setAngle(MS_ANGLE_HIGH);

writeDebug('Setting run.');
if not (minimap.isRunEnabled()) then
minimap.toggleRun(true);

writeDebug('Setting gametab.');
if (not gameTabs.isTabActive(TAB_BACKPACK)) then
gameTabs.openTab(TAB_BACKPACK);
end;

procedure stop(); //hammer time
begin
writeWarn('*** Terminating script ***');
if isLoggedIn() then
writeDebug('Logging out');
players[currentPlayer].logout();
writeDebug('Freeing BMPs');
writeDebug('Freeing DTMs');
writeWarn('*** Terminated script ***');
end;

begin
initScript();
initPlayer();
end.

That snippet will start SMART, log you in, and run some basic init routines.

As far as your questions; signing in all of your accounts depends on how you write the script - namely, whether or not you decide to include multiplayer handling. If yes, it's as easy as declaring more than one playerName.

If no, you'll have to run separate instances which can be achieved by opening a separate Simba tab/window and starting a new script.


And what is "multiplayer handling"? Is that like one line of code I can wright, or something that is more complicated?

KeepBotting

2014-12-09 19:17:41

From: SRLnoob
And what is "multiplayer handling"? Is that like one line of code I can wright, or something that is more complicated?


Handling multiple players running on one instance of one script. At SRL, "multiplayer" is commonly used to refer to a script's ability to micromanage several accounts consecutively (not at the same time).

So a script that handles multiple players would be able to load more than one player and run them in order based on a factor which could be any number of things - failure, run time, skill xp, supplies, etc. Logging one player out if it fails, setting it inactive, logging the next one in, and continuing.

I wrote some posts about it in this thread & plan to write a tutorial on it soon. It's not complicated, but it's not one line of code either :P

SRLnoob

2014-12-10 17:57:14

From: KeepBotting
Handling multiple players running on one instance of one script. At SRL, "multiplayer" is commonly used to refer to a script's ability to micromanage several accounts consecutively (not at the same time).

So a script that handles multiple players would be able to load more than one player and run them in order based on a factor which could be any number of things - failure, run time, skill xp, supplies, etc. Logging one player out if it fails, setting it inactive, logging the next one in, and continuing.

I wrote some posts about it in this thread & plan to write a tutorial on it soon. It's not complicated, but it's not one line of code either :P


I can't paste what you put into simba. Is there a way around that?

KeepBotting

2014-12-10 18:02:23

From: SRLnoob
I can't paste what you put into simba. Is there a way around that?


What do you mean you can't paste? Is your clipboard not working? o_O

The Mayor

2014-12-10 18:22:54

From: SRLnoob
I have looked everywhere for an answer


Looks like you didn't read section 4 of my AIO tutorial :p