SRL Archive - Archive

DarkCoder - SRL Member Application


DarkCoder

2011-12-18 15:02:34

How Long have You Played Runescape?
4 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
A bit of HTML and Javascript to start with then went into Java.


Are you a member of any other communities?
Powerbot (Script Writer)


Tell us about yourself…
From: DarkCoder
Hmm, basically I am a 'script writer' rank from Powerbot whom has a good knowledge of Java whom has come over as this is both a working bot but also an amazing community! Logically I am very good a programming in terms of figuring the flow and stuff of scripts although have never had a single lesson on programming in my life.

I script because I enjoy scripting, the 'buzz' and the challenge really appeals to me, along with being able to see the results in the end working. I am competitive, and do a fair share of sports but generally a honest and nice guy. My main interest other than coding would have to be sleeping :)

Thanks and look forward to the feedback!

(I can provide links to pb scripts which I have made using reflection if interested)



Please show us one (or multiple) of your scripts.
// !!!!!!!!!!! BEFORE PUBLISIHING REMOVE USER AND PASSWORD !!!!!!!!!!!!

program iSmelter;
{$i srl/srl/misc/smart.scar}
{.include srl/srl.scar}

const
TOLERANCE = 35; // Change to min which works!

var
X, Y: integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].BoxRewards := ['Xp', 'ostume', 'oins', 'aphire', 'ssence']; // change to whatever suits
end;

// maybe one for open bank, one for running and one for smelting?!?!
procedure Antiban; // make this far more dynamic asap
begin
case Random(480) of // Random(x) generates a random integer from 0 to (x - 1)
0: Wait(100+random(750));
10: RandomRClick;
20: HoverSkill('smithing', False);
30: PickUpMouse;
40..42: RandomMovement;
50..52: BoredHuman;
60: ExamineInv;
70: RandomAngle(1);
80..89: mMouse(0, 0, random(750), random(500));
90: case Random(150) of
0: Typesend('cmon');
1: Typesend('lol');
2: Typesend('lagg');
3: Typesend('hmm');
4: Typesend('hurry');
5: Typesend('bored :P');
end;
100: GameTab(RandomRange(tab_Combat, tab_Notes));
end;
end;

procedure SetCompass;
var Deg: Variant;
begin
Deg := rs_GetCompassAngleDegrees;
if (Deg > 9) or (Deg < 3) then // works as an approx
begin
MakeCompass(7);
end;
end;

procedure CloseBankNow;
begin
CloseBank;
Wait(200+random(350)); // sleep?
end;

procedure DepositAllNow;
begin
DepositAll;
Wait(1000+random(250));
end;

procedure WithdrawOresNow;
begin
Withdraw(0, 0, 28); // collum, row, amount
Wait(1000+random(250));
end;

procedure ClickGoldBar;
var GoldBar: Integer;
begin
GoldBar := BitmapFromString(17, 8, 'meJyTaFkmgRvJr76OiUhVj0cLddX' +
'z+SYCEfHqFTbchWhBRvjVE6kFWT3xWuDqgQgAUyW6TQ==');
X := 590;
Y := 227;
if (FindBitmapSpiralTolerance(GoldBar, X, Y, 560, 214, 734, 457, TOLERANCE)) then
begin
Mouse(X, Y, 6, 6, true);
Wait(1000+random(250)); // shorten
end;
FreeBitmap(GoldBar);
end;

procedure StartCraft;
begin
X := 245;
Y := 135;
if (FindColorSpiralTolerance(X, Y, 7569541, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
Mouse(X, Y, 0, 0, false);
ChooseOption('forge');
Wait(500+random(250));
while (Flag) do
begin
if not LoggedIn then exit;
if FindNormalRandoms then exit;
Wait(200+random(350));
end;
Wait(1000+random(250));
end;

procedure StartSmelt;
begin
X := 500;
Y := 60;
if (FindColorSpiralTolerance(X, Y, 7040957, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
Mouse(X, Y, 0, 0, false);
ChooseOption('melt-ore');
Wait(500+random(250));
X := (220+random(80));
Y := (380+random(80));
Mmouse(X,Y, 0, 0);
while (Flag) do
begin
if not LoggedIn then exit;
if FindNormalRandoms then exit;
Wait(200+random(350));
end;
Wait(1000+random(250));
end;

procedure OpenBankBox;
begin
X := 16;
Y := 280;
if (FindColorSpiralTolerance(X, Y, 7303028, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
Mouse(X, Y, 0, 0, false);
ChooseOption('se');
Wait(500+random(250));
X := (375+random(40));
Y := (290+random(35));
Mmouse(X,Y, 0, 0);
while (Flag) do
begin
if not LoggedIn then exit;
if FindNormalRandoms then exit;
Wait(200+random(350));
end;
Wait(900+random(150));
end;

procedure RelocateMouse;
begin
X := (235+random(45));
Y := (400+random(50));
Mmouse(X,Y, 0, 0);
Wait(200+random(150)); // shorten
end;

function CheckItems:boolean;
// Checks if an item within the inventory has been left clicked
var count: Integer;
begin
for count := 1 to 28 do
begin
if (ItemActivated(count)) then
begin
Result := true;
Exit;
end;
end;
Result := false;
end;

function MakeSelect:boolean;
var MakeY: Integer;
begin
MakeY := BitmapFromString(19, 18, 'meJyFkmlLAkEcxv0SoXu5Hh+194' +
'WhloVpaSaJWYaJ5pGmeG6akimJYRiFkiQVRBH0jCubjGbLvNDd+c1' +
'z/EelmjysM8p5UtpoU1foy8vY+lb993D7ad6fF06qCqUvPwPkj6UF' +
'FOuKC6EatMRkZ5qS1wKWdSeF07ou94j9MkWBc1mNNQCfQvhal38yN' +
'r8oasIGyupVDwUytiDnzWgjDWgZ6u/Gm08F1FdH+ssXfWmAr+xuTG' +
'P20c0cZBEQG7DNUHszND5wAn7IIJyI53foDZ1rNo4oVnvW0mUfSEB' +
'pSFgFlIZ4L17cEzZUgzfGHqZYMd3FHqJbHRFWBksD9CZmeviKzqGL' +
'EdCiiTZOJt1KQ4IAv3qFE/TGmqOsJcauJ7nNNETVJi8tmuzgcDksF' +
'lQ4X+6XsqW4rYwQrGAQFIjDkQVtEFFpCGOMKTxNcfYs78hj7kvLtl' +
'nDclJIIw6zFgE4TWljt7P9TAwjaaGPTjA44tMaJ9HGFO8skvcW/1w' +
'QKeAWtjG4iU/IbedA8S6JPyyqV/bmgsQwLny6Sy4M5MY+idxOWXBX' +
'cD//opSGEQfjIGPCEDM9/IVPxhFZDMq6ZCXa2A+H0AKlzOIHTVFw2g==');
Result := (FindBitmapToleranceIn(MakeY, X, Y, MSX1, MSY1, MSX2, MSY2, TOLERANCE)); // narrow this down on screen?!?
FreeBitmap(MakeY);
end;

function SelectOnScreen:boolean;
var MakeX: Integer;
begin
MakeX := BitmapFromString(17, 8, 'meJyTaFkmgRvJr76OiUhVj0cLddX' +
'z+SYCEfHqFTbchWhBRvjVE6kFWT3xWuDqgQgAUyW6TQ==');
Result := (FindBitmapToleranceIn(MakeX, X, Y, MCX1, MCY1, MCX2, MCY2, TOLERANCE));
FreeBitmap(MakeX);
end;

function ContainsBar:boolean;
var
ChosenBar: Integer;
begin
GameTab(25);
ChosenBar := BitmapFromString(17, 8, 'meJyTaFkmgRvJr76OiUhVj0cLddX' +
'z+SYCEfHqFTbchWhBRvjVE6kFWT3xWuDqgQgAUyW6TQ==');
Result := (FindBitmapToleranceIn(ChosenBar, X, Y, 560, 214, 734, 457, TOLERANCE));
FreeBitmap(ChosenBar);
end;

function ContainsOre:boolean;
var
ChosenOre: Integer;
begin
GameTab(25);
ChosenOre := BitmapFromString(18, 12, 'meJxNkv8rA3EYx6/7Bzh2t/ui7D' +
'fJplFsSEu+JF+a72k/rNVI+MW3rPmyEAuZtY1ZtxZJJBKRJpKl/F3' +
'e56Pn7np3PXf3vD7P+3mec/r8tW19PMc5HG7cywOLYjQnrmQQk/CJ' +
'CXGNp7uhZ9LVMVzXPkCUEIpKa7p9+1KKnYuRLCHc34VHJHv84frOU' +
'afPT1TFVMygdq/lg3t5/w4xz5kX4sbeQPNgyN01gXJEVc7FDWrnSj' +
'l6VFOvkLRZ4C0U7IFqHZtFOaJsCwn09U+dvmu5Ly3/DcNWEGoZmQF' +
'OlLh6go7k+K1y/KxlP6oKP5peUjNv8EwgMr1D07BKlLSeRwKzBwqF' +
'GKUknnAUgaAgouxbF/LejXz4oCRfDId6iSjrLjBGiFHMNprC9JCmp' +
'ova2SdaA8WSMSsmIJiJlWIyTYJKF/GmbHxeCEZsyyl4AAI19QdZMr' +
'aAXRDLxshiIbyBWWFKOI0S8Ktg3UAw0mqXlzo1l7KUhHPUBfgLpLa' +
'UPA==');
Result := (FindBitmapToleranceIn(ChosenOre, X, Y, 560, 214, 734, 457, TOLERANCE));
FreeBitmap(ChosenOre);
end;

begin
Smart_Server := 35; // Having the same world in all your scripts allows you to change scripts without smart restarting.
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

ClearDebug;
SetupSRL;
DeclarePlayers; // Calls the procedure, you can't forget this!
LoginPlayer; // You want your player to login, right?

// wait before this!?!?
SetAngle(true);
repeat
if FindNormalRandoms then Break; // meant to be exit or break?!?
if not LoggedIn then Break;// Try and make it log back in?

SetCompass;

/////////// IF BANK IS OPEN ////////////
if (BankScreen) then
begin
if (InvFull) then
begin
if (ContainsOre) then
CloseBankNow
else
DepositAllNow;
end else
WithdrawOresNow;

////// IF INVENTORY CONTAINS ORE ///////
end else if (ContainsOre) then
begin
if (SelectOnScreen) then
begin
if(IsUpText('ake All'))then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, true);
while (ContainsOre) do // design fail safe
begin
if not LoggedIn then exit;
if FindNormalRandoms then exit; // perhaps do not need ths line
LevelUp; // does not work?!?
LampSkill := 'summoning';
Antiban;
Wait(350+random(150));
end;
end else
RelocateMouse;
end else
StartSmelt

////// IF INVENTORY CONTAINS BAR ///////
end else if (ContainsBar) then
begin
if (MakeSelect) then
begin
X := (122+random(16)); // perhaps more dynamic
Y := (280+random(16));
Mouse(X, Y, 0, 0, false);
if (ChooseOption('ake All')) then
begin
Wait(1000+random(150));// if select2 on screen then make all things
While (ContainsBar) do
begin
if not LoggedIn then exit;
if FindNormalRandoms then exit; // perhaps do not need ths line
LevelUp; // does not work?!?
LampSkill := 'summoning';
Antiban;
Wait(350+random(150));
end;
end else
Wait(350+random(150)); // CheckItems
end else if (CheckItems) then
begin
StartCraft; // else if selected gold bar - use on furnace
Wait(200+random(150));
end else // select a gold bar
ClickGoldBar // ';' here?

////// ELSE OPEN OUR BANK ///////
end else
OpenBankBox;
until(false);
end.

Dynamite

2011-12-18 15:21:20

Try to learn TPA's.
Also, things like:
procedure CloseBankNow;
begin
CloseBank;
Wait(200+random(350)); // sleep?
end;

procedure DepositAllNow;
begin
DepositAll;
Wait(1000+random(250));
end;

procedure WithdrawOresNow;
begin
Withdraw(0, 0, 28); // collum, row, amount
Wait(1000+random(250));
end;

Either put it straight into your loop or put it all in 1 function

It's a no from me, but you show potential.

-Boom

marpis

2011-12-18 15:24:52

I'm only saying No due to your longevity on this forum. The script is very well structured, although there are a few little things to fix in your standards and nesting.
Also I recommend you learn to use TPointArrays and FindColorsTolerance() to find mainscreen objects, it's more reliable and accurate.

Just hang around for a while longer and you will certainly get in. :)

Here I fixed a couple of things:

procedure SetCompass;
var
Deg: Variant; // note the standards
begin
Deg := rs_GetCompassAngleDegrees;
if (Deg > 9) or (Deg < 3) then
MakeCompass(7); // no need for begin end when there's only one statement after "then"
end;


function CheckItems:boolean;
// Checks if an item within the inventory has been left clicked
var
count: Integer;
begin
for count := 1 to 28 do
begin
Result := ItemActivated(count); // made this a little shorter and removed an unnecessary nesting
if Result then Exit;
end;
end;


// You should use function parameters here to remove one unnecessary function
procedure ClickFurnace(OptionText: string);
begin
X := 245;
Y := 135;
if (FindColorSpiralTolerance(X, Y, 7569541, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
begin // added a missing begin-end
Mouse(X, Y, 0, 0, false);
ChooseOption(OptionText); // now you can use the same procedure for smelting
Wait(500+random(250));
while (Flag) do
begin
if not LoggedIn then exit;
if FindNormalRandoms then exit;
Wait(200+random(350));
end;
Wait(1000+random(250));
end;
end;

—

For Dynamite:
I like leaving all Wait()s out of the main loops, to make the loop itself easier to read, so those miniprocedures are OK.

Sabzi

2011-12-18 15:29:58

Agreed with Dynamite, I would like to see some TPAs.

Also you do realize that with this:
  if (FindColorSpiralTolerance(X, Y, 7303028, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
Mouse(X, Y, 0, 0, false);
you will only skip the right-clicking if you fail to find the color, right? So all the other things will be done no matter what.
There are begins and ends missing.

Lacking of fail-safes it looks like for me.

No.

EDIT: Damn, marpis, in a long time I actually take my time to look at the script a little closer, I catch something and you ninja me? :D

Kyle Undefined

2011-12-18 15:30:43

I voted no because you haven't established yourself here enough, you're only 1 month in. As for the script, as Marpis said, it's not bad and a good start.

BraK

2011-12-18 15:33:16

I voted Yes because I can ;)

DarkCoder

2011-12-18 16:25:00

@ Dynamite
"Either put it straight into your loop or put it all in 1 function" - I took them out the loop as it looks messy with them in and less clear, as a scripter I don't see either a significant advantage of having those examples in the loop!? You say put them into one function, but that would be actually more counter productive in those cases (marpis has an example where one function is suitable).

I will look into TPA's though, thanks nevertheless!

@ marpis
Thanks! The first one I forgot to clean up after some debugging, the second one is a good change (not use to Pascel so I wrote it like I would in Java). The last one was a good change and I cannot think why I missed the chance to use Parameters as would to almost the other extreme in java, although considering the different starting locations to spiral from I will need to add two more paramenters :redface:

But cheers for the feedback and will help me settle and adapt :D

@ Sabzi
The script works next to flawlessly so I am slowly implementing fail safes as I think them up. I have added a degree of failsafes, but yes as I think them up or occur problems I will add them. Thanks also in regards to the other pieces of feedback.

@ BraK
Thanks for the vote!

Harry

2011-12-18 16:55:41

    90: case Random(150) of
0: Typesend('cmon');
1: Typesend('lol');
2: Typesend('lagg');
3: Typesend('hmm');
4: Typesend('hurry');
5: Typesend('bored :P');
end;
I suggest against doing this. Though it won't happen that often, all Jagex has to do is search who said those when running your script and get a nice group of users banned.

if (FindColorSpiralTolerance(X, Y, 7569541, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
Mouse(X, Y, 0, 0, false);
You're clicking right on the color, don't do that. Same as the one below it, and below it again. You also don't have the begin/ends on it.

ClickGoldBar // ';' here?
Yes, you should.

You need more failsafes, and more "protection" if an object finding fails.

Probably some other stuff I skimmed over, but it's looking decent so far. Please work on this stuff and I look forward to your next application if you don't get in this time.

Blumblebee

2011-12-18 17:12:32

Yes. You get the general idea, assuming you continue learning at the present rate you should be fine.

Goodluck :)

Sir R. M8gic1an

2011-12-19 10:04:09


X := (375+random(40));
Y := (290+random(35));
Mmouse(X,Y, 0, 0);

This would be the same as MMouse(375, 290, 40, 35);

And the way you are searching for bitmaps is unhealthy,

function ContainsBar:boolean;
var
ChosenBar: Integer;
begin
GameTab(25);
ChosenBar := BitmapFromString(17, 8, 'meJyTaFkmgRvJr76OiUhVj0cLddX' +
'z+SYCEfHqFTbchWhBRvjVE6kFWT3xWuDqgQgAUyW6TQ==');
Result := (FindBitmapToleranceIn(ChosenBar, X, Y, 560, 214, 734, 457, TOLERANCE));
FreeBitmap(ChosenBar);
end;

You are loading and freeing it at every time, eating up memory because each time you free it there's a little bit that doesn't get freed, so it ends up wasted. Also, I suggest you make LampSkill a constant, and make it by default smithing as it surely won't offend the autoer, and summoning is members only :p

Other then that, I see a lot of potential, and good use of the basics and structure, so I'm going with a yes ;)

-RM

WT-Fakawi

2011-12-19 10:40:02

Good enough for me. Always was, and always will be.

DarkCoder

2011-12-20 11:39:25

@marpis
In regards to your third point after pondering on the code and the fact it would need to have four variables in the parameter, on top of one needing to hover the mouse while the other does not (which takes up potentially half the code anyway), it would be (in my eyes) counter productive to add now so instead I make the loop and wait its own procedure to be more efficient.

@WT-Fakawi
Goody good good :)

@Sir R. M8gic1an
Thanks for the feedback! The first one has saved me a lot of lines :P, bearing in mind this was my first attempt at bitmaps how would one not waste memory (I have followed what tutorials have said largely)? Thanks again :D

@Blumblebee
Thanks!

@Harry
I have made it optional for the next version, I think providing one speaks normally them saying random thinngs can nicely work alongside such, but it is the users choice now. Agreed on the failsafes.


Two quick questions:

    if (FindColorSpiralTolerance(X, Y, 7303028, MSX1, MSY1, MSX2, MSY2, TOLERANCE)) then
    Mouse(X, Y, 3, 3, false);
    Does the above right click the object without the need of the line "Mouse(X, Y, 0, 0, false)" and therefore this line is irrelevant (yet does not randomize clicking if it ignores it)?
  1. Is LampSkill a prodecedure or just something one must declare, by the source code it seems to be something to declare but would like confirmation because I declare it at the start :P

Harry

2011-12-20 12:10:58

1) You should use a getmousepos.
2) You don't have to, it's just a global var that chooses what skill you level with a lamp (default mining).

Hobbit

2012-01-03 15:44:08

Sorry the poll has closed and you didn't make it in this time. Please read the comments left for you and read some more tutorials and improve on the script and reapply in 2 weeks! :)

Cheers
Hobbit