Er1k
2012-01-20 06:29:38
How Long have You Played Runescape?
3 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
No
What is your general programming knowledge?
C/C++/Perl/Java and a bit MASM
Are you a member of any other communities?
None
Tell us about yourself…
Please show us one (or multiple) of your scripts.
The second one is a gatestone maker which is unreleased for now because I'm still testing it.
3 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
No
What is your general programming knowledge?
C/C++/Perl/Java and a bit MASM
Are you a member of any other communities?
None
Tell us about yourself…
From: nosaj.421
Hi my name is Erik, aka nosaj421. I'm from Hong Kong and I'm an undergraduate student majoring in Finance. I started out RS some few years ago when I was in high school. Got fond of it and played legit for a couple of years to burn time. Wasn't until when I got into university when I started learning programming. I have a bit of experience in many things, but never really in-depth so I thought scripting bots and participating in an open-source community can give me more solid development experience to develop my skills.
Apart from small projects, I'm also a PC FPS gamer. Was at some time playing competitively in Asian COD4 scene, but due to time commitment I am now only playing BF3 for leisure.
Please show us one (or multiple) of your scripts.
The first script is a Al-Kharid tanner which is my first released script in the first scripts section. It was an attempt to remake Cruzin's iTanner as the colors back then break from time to time.
////////////////////////////////////////////////////////////////////////////////
// AKTan Tanning Script F2P Only //
// Written by nosaj421 //
// Turns cowhides into soft or hard leather //
// //
// Instructions: //
// 1. Cowhides in first tab first slot //
// 2. Put enough money in the money pouch //
// 3. Be inside Al-Kharid Bank //
// 5. Run //
// //
// Things to note: //
// No anti-ban, no breaks, nothing //
// Restart simba if SPS walking is acting strangely //
// //
// Known Bugs //
// Player stepping on Ellis to be fixed - TODO? //
// SPS Walking sometimes doesn't work //
// //
////////////////////////////////////////////////////////////////////////////////
Program AKTan;
{$DEFINE SRL5}
{$DEFINE SMART}
{$I SRL/SRL/misc/SMART.simba}
{$I SRL/SRL.simba}
{$i sps/sps.simba}
const
//Fill in these
Loads2Do = 179; //1k-5k: 36, 72, 108, 143, 179
HideType = 0; //0:soft, 1:hard, F2P only
//SMART Setup
SmartWorld = 1;
Members = False;
SignedClient = True;
HighDetail = False;
var
Tanner, Bank: TPointArray;
n: integer;
procedure DeclarePlayers; //Forgot where I copied from :(
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
With Players[0] Do
Begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Pin := '';
Active := True;
End;
End;
procedure DoLogin;
var t: integer;
begin
MarkTime(t);
while (not LoggedIn) do
begin
if LogInPlayer then
break;
wait(10000+random(500));
if (TimeFromMark(t) > 180000) then
begin
writeln('Failed to login after 180s... Terminating');
TerminateScript;
end;
end;
end;
{*******************************************************************************
function BankAndWithdraw: Boolean;
by; nosaj421
Description: Bank at AKB and withdraw cowhides at 0,0
*******************************************************************************}
function BankAndWithdraw: Boolean;
var mx, my, t: integer;
begin
Result:=False;
if not LoggedIn then Exit;
//Locate banker/booth and open it
MarkTime(t);
writeln('Trying to open bank...');
repeat
if FindObj(mx,my,'ank',6974575,5) then //7829627 t 10
Mouse(mx,my,2,2,mouse_right);
wait(100+random(50));
until (ChooseOptionMulti(['uick','ank ']) or (TimeFromMark(t)>8000));
if(TimeFromMark(t)>8000) then
begin
writeln('Open bank timed out...');
Exit;
end;
//Wait until the bank screen appears
MarkTime(t);
repeat
wait(200+random(20));
until (BankScreen or (TimeFromMark(t) > 10000));
if(TimeFromMark(t) > 10000) then
begin
writeln('Looks like we have a false positive...');
Exit;
end;
//Bank leathers and get cowhides
wait(250+random(150));
DepositAll;
// MouseBox(360, 305, 375, 315, 1); //Quickfix
wait(250+random(150));
Withdraw(0,0,0);
wait(250+random(150));
CloseBank;
Result:=True;
end;
{*******************************************************************************
function TanScreen: Boolean;
by; nosaj421
Description: Returns true if tanning screen is found
*******************************************************************************}
function TanScreen: Boolean;
var X, Y: Integer;
begin
Result := FindText(x, y, 'hides', UpCharsEx, 92, 29, 396, 54);
end;
{*******************************************************************************
function FindEllisAndTan: Boolean;
by; nosaj421
Description: Returns true if tanning is successfully done
*******************************************************************************}
function FindEllisAndTan: Boolean;
var mx, my, t: integer;
b1: Boolean;
begin
Result:=False;
if not LoggedIn then Exit;
//Find Ellis
MarkTime(t);
repeat
if FindObjCustom(mx,my,['llis'],[5605313,4352977],20) then
Mouse(mx,my,2,2,mouse_right);
until (ChooseOption('rade') or (TimeFromMark(t)>8000));//maybe can add safety?
//Timed out, we try failsafe before giving up
if (TimeFromMark(t)>8000) then
begin
b1:=False;
//We might be stepping over Ellis, so we click on Player position
MMouse(MSCX, MSCY,3,3);
if WaitUpText('llis',1000) then
begin
ClickMouse2(mouse_right);
if WaitOption('rade',1000) then
b1:=True;
end;
//We can use a relative marker to find Ellis //notes: 2501500 tol 20
//TODO?
if(not b1) then
begin
writeln('Timed out finding Ellis...');
Exit;
end;
writeln('We still found him... but through failsafe');
end;
//If successful we tan
MarkTime(t);
repeat
wait(200+random(20));
until (TanScreen or (TimeFromMark(t)>8000));
if (TimeFromMark(t)>8000) then
Exit;
case HideType of
0: MouseBox(70, 80, 120, 130, mouse_right); //soft leather
1: MouseBox(185, 80, 235, 130, mouse_right); //hard leather
end;
if ChooseOption('ll') then
begin
writeln('Tanning successful');
Result:=True;
end;
end;
{*******************************************************************************
function WalkPath(path: TPointArray): Boolean;
by; nosaj421
Description: SPS walk wrapper with FindNormalRandoms
*******************************************************************************}
function WalkPath(path: TPointArray): Boolean;
begin
Result:=False;
if not LoggedIn then Exit;
if not FindNormalRandoms then
if SPS_WalkPath(path) then
begin
Result:=True;
Exit;
end;
if not LoggedIn then
begin
writeln('We terminate as we failed random!');
TerminateScript;
end;
end;
procedure initWalker;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_9']);
Tanner := [{Point(4915,3995),} Point(4945,3950), Point(4936,3894)];
Bank:= [Point(4936,3894), Point(4945,3950), Point(4915,3995)];
end;
{*******************************************************************************
procedure ClickSomewhere;
by; nosaj421
Description: Clicks a MM point to faciliate SPS to work again
*******************************************************************************}
procedure ClickSomewhere;
var n: integer;
begin
if not LoggedIn then Exit;
n:=randomRange(40,50);
MMouse(MMCX+floor(45*cos(n*3.1415/180)),MMCY-floor(45*sin(n*3.1415/180)),4,4);
ClickMouse2(True);
end;
procedure WaitTillStationary;
begin
if not LoggedIn then Exit;
repeat
wait(200+random(50));
until not IsMoving;
end;
begin
Smart_Server := SmartWorld;
Smart_Members := Members;
Smart_Signed := SignedClient;
Smart_SuperDetail := HighDetail;
setupSRL();
DeclarePlayers;
DoLogin;
initWalker;
repeat
if not LoggedIn then
TerminateScript;
ClickNorth(srl_angle_HIGH);
wait(500);
if FindNormalRandoms then
if not LoggedIn then
begin
writeln('We terminate as we failed random!');
TerminateScript;
end;
if BankAndWithdraw then
begin
ClickSomewhere;
wait(1000+random(200));
if WalkPath(Tanner) then
begin
WaitTillStationary;
if FindEllisAndTan then
begin
inc(n);
end;
end;
WalkPath(Bank);
WaitTillStationary;
end
else begin
WalkPath(Bank);
WaitTillStationary;
end;
until(n > Loads2Do);
Logout;
end.
The second one is a gatestone maker which is unreleased for now because I'm still testing it.
{*******************************************************************************
program GateStoner;
by; nosaj421
Description: Trains Magic by Creating Gatestones in Dungeoneering
Instructions: 1. Fill in user info and make sure you have fulfilled all reqs
2. Start in the spot where you jump down the broken stairs (MUST)
3. Make sure Dungeoneering tab is opened
4. Save and Run
Status: Working BETA
Notes: Tweak colors if location finders are not working
Blind finding stairs might timeout
Blind finding dungeon entrance might timeout
IMPORTANT ChooseOption in Spellbook is known to break sometimes due to
recent updates. Restart script or Uncomment the fix indicated in the code
if you want to get it working. If all else fails, check out SRL updates
*******************************************************************************}
program GateStoner;
{$DEFINE SRL5}
{$DEFINE SMART}
//{$DEFINE DEBUG} //Uncomment if you think location finders are not working
{$I SRL/SRL/misc/SMART.simba}
{$I SRL/SRL.simba}
{$i sps/sps.simba}
const
CastsPerRun= 40; //125 cosmics = 41 cast -> You put 40 = (cast - 1)
GateStoneSlot = 2; //This is where your gatestone is supposed to be created
//I'm Complexity 4, so it is Slot 2.
//Sorry but that's the highest dung complx I got :(
NumbOfPlayers= 1;
StartPlayer= 0;
//SMART Setup
SmartWorld = 7;
Members = False;
SignedClient = True;
HighDetail = False;
var t, t1, fail: integer;
procedure DeclarePlayers; //Already forgot where I copied this :(
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];
with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
end;
end;
procedure DoLogin;
var t: integer;
begin
MarkTime(t);
while (not LoggedIn) do
begin
if LogInPlayer then
break;
wait(10000+random(500));
if (TimeFromMark(t) > 180000) then
begin
writeln('Failed to login after 180s... Terminating');
TerminateScript;
end;
end;
end;
procedure WaitTillStationary;
begin
if not LoggedIn then Exit;
repeat
wait(200+random(50));
until not IsMoving;
end;
{*******************************************************************************
procedure IsScreen: Boolean;
by; nosaj421
Description: Checks if the Select Level or Select Complexity Dung Screens are up
*******************************************************************************}
function IsScreen(text: String): Boolean;
var
X, Y: Integer;
begin
Result := FindText(x, y, text, UpCharsEx, 92, 3, 396, 29);
end;
{*******************************************************************************
procedure In***: Boolean;
by; nosaj421
Description: Returns true if player is in said location
*******************************************************************************}
function InLobby: Boolean;
var T: TPointArray;
begin
//Stable
//Bank symbol color from SRL
Result:= FindMMColorsSpiralTolerance(T, 2216175, 20);
{$IfDef DEBUG}
if Result then
writeln('*** In Dung Lobby ***')
else writeln('*** NOT In Dung Lobby ***');
{$EndIf}
end;
function InDungeon: Boolean;
var T: TPointArray;
begin
//Change colors if not working!
//Door red color and Bank symbol
Result:= FindMMColorsSpiralTolerance(T, 328172, 30) and
not FindMMColorsSpiralTolerance(T, 2216175, 20);
{$IfDef DEBUG}
if Result then
writeln('*** In Dungeon ***')
else writeln('*** NOT In Dungeon ***');
{$EndIf}
end;
function InLadder: Boolean;
var T: TPointArray;
begin
//Change colors if not working!
//Current method is to find the door red
Result:= not FindMMColorsSpiralTolerance(T, 132076, 10);
{$IfDef DEBUG}
if Result then
writeln('*** In Broken stairs ***')
else writeln('*** NOT In Broken stairs ***');
{$EndIf}
end;
{*******************************************************************************
function OpenPartyInterface: Boolean;
by; nosaj421
Description: Returns true if open party is successful
*******************************************************************************}
function OpenPartyInterface: Boolean;
var mx, my, RoK: integer;
begin
Result:=False;
if not LoggedIn then Exit;
RoK:= DTMFromString('mrAAAAHic42BgYLBhZmBwZobQpkBsCcROQGwBxLZAPJGJgWEKEHcDcT'+
'8QTwfiOUA8D4gXA/G3ABWgKUw4sQgDfsBIAMMAABY4CFg=');
GameTab(tab_inv);
wait(randomRange(500,1000));
if FindDTM(RoK, mx, my, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(mx, my, 2, 2, mouse_right);
if WaitOption('face',1000) then
begin
writeln('Opening party interface');
wait(1500);
Result:= FindText(mx, my, 'Party', UpCharsEx, MIX1, MIY1, MIX2, MIY2);
end
end
else
begin
GameTab(tab_equip);
wait(randomRange(500,1000));
if FindDTM(RoK, mx, my, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(mx, my, 2, 2, mouse_right);
if WaitOption('face',1000) then
begin
writeln('Opening party interface');
wait(1500);
Result:= FindText(mx, my, 'Party', UpCharsEx, MIX1, MIY1, MIX2, MIY2);
end
end
else srl_warn('OpenPartyInterface', 'RoK is not found!' , warn_AllVersions);
end;
FreeDTM(RoK);
end;
{*******************************************************************************
function ToTab(tab: integer): Boolean;
by; nosaj421
Description: Wrapper to change tabs using FTab
*******************************************************************************}
function ToTab(tab: integer): Boolean;
var t: integer;
begin
Result:=False;
if Ftab(tab) then
begin
Result:=True;
Exit;
end;
MarkTime(t);
while getCurrentTab <> tab do
begin
wait(20);
if TimeFromMark(t) >= 160 then //tweak depending on connection
Exit;
end;
Result:=True;
end;
{*******************************************************************************
function CastGateStone: Boolean;
by; nosaj421
Description: Returns true if casts Gatestone spell is successful
*******************************************************************************}
function CastGateStone: Boolean;
var i, mx, my: integer;
tpa: TPointArray;
begin
Result:=False;
if not toTab(tab_magic) then Exit;
setColorToleranceSpeed(2);
setColorSpeed2Modifiers(0.2, 0.2);
if FindColorsTolerance(tpa, 12042009, MIX1, MIY1, MIX2, MIY2, 35) then
begin
if getCurrentTab <> tab_magic then Exit
else
begin
i := random(high(tpa));
Mouse(tpa[i].x , tpa[i].y , 4, 4, mouse_right);
// add wait depending on connection
// GetMousePos(mx, my);
// Mouse(mx, my+ 40, 5, 0, mouse_left);
if WaitOption('ick', 500) then //if this breaks, use the above
Result:=True;
end;
end;
setColorToleranceSpeed(1);
end;
{*******************************************************************************
function DropGateStone: Boolean;
by; nosaj421
Description: Returns true if gatestone is successfully dropped
The slot you drop your gatestone is set in Const
*******************************************************************************}
function DropGateStone: Boolean;
var mx, my: integer;
tb: Tbox;
begin
Result:=False;
tb := InvBox(GateStoneSlot);
GetMousePos(mx, my);
if not PointInBox(Point(mx, my), tb) then
MouseBox(tb.X1, tb.Y1, tb.X2, tb.Y2, mouse_move);
if not toTab(tab_inv) then Exit;
//Dropping routine is too slow with DTMs
if getCurrentTab = tab_inv then
begin
if not ExistsItem(GateStoneSlot) then
Exit;
end
else Exit;
ClickMouse2(mouse_right);
// add wait depending on connection
// GetMousePos(mx, my);
// Mouse(mx, my+ 40, 5, 0, mouse_left);
if ChooseOption('rop') then //if this breaks use above
Result:=True;
end;
{*******************************************************************************
procedure MakeGatestone;
by; nosaj421
Description: Casts Create Gatestone spell for CastsPerRun times.
Set CastsPerRun in Const
*******************************************************************************}
//Not using DTMs because too slow / detection
//I needed the speed :(
procedure MakeGatestone;
var a, t: integer;
action: integer;
begin
if not LoggedIn then Exit;
if not InDungeon then Exit;
action:=1;
MarkTime(t);
repeat
case action of
1: if CastGateStone then
begin
if a=CastsPerRun then Exit;
action:= 2;
end;
2: if DropGateStone then
begin
inc(a);
action:= 1;
end;
end;
wait(50);
until TimeFromMark(t) > 180000;
end;
{*******************************************************************************
function QuitDungeon: Boolean;
by; nosaj421
Description: Returns true if we have successfully left the Dungeon.
Leaves the Dungeon by using the leave party option on the Dung tab.
*******************************************************************************}
function QuitDungeon: Boolean;
var mx, my, t: integer;
begin
Result:=False;
if not LoggedIn then Exit;
if not InDungeon then Exit;
//Find and click the RoK tab // equals Quest tab in dung
GameTab(tab_Quest);
//Click leave party
MouseBox(590, 325, 690, 345,1);
//Click continue
repeat
wait(200+random(20));
until ClickContinue(True, False);
//Num 1, finding the highlight orange color //lazy
MMouse(265,410,randomRange(-25,25),randomRange(-5,5));
repeat
wait(200+random(20));
until FindColorSpiralTolerance(mx,my,37083,MCX1,MCY1,MCX2,MCY2,45);
TypeByte(49); //1
//If we are in the broken stairs area, then we're out
wait(4000); //avoid InLadder going wrong //change if still too fast
MarkTime(t);
repeat
if InLadder then
begin
Result:=True;
Exit;
end;
wait(1500+random(50));
until (TimeFromMark(t) > 10000);
end;
{*******************************************************************************
function SlideDownLadder: Boolean;
by; nosaj421
Description: Returns true if we have successfully slided down and return to lob.
It works by blind walking near the exit and repetitively move the
mouse to search for the Uptext to slide down
*******************************************************************************}
function SlideDownLadder: Boolean;
var t: integer;
begin
Result:=False;
if not LoggedIn then Exit;
if not InLadder then Exit;
//Blind walk near the exit, good news is it almost always ends in 2 tiles
//Alternative is radial walk, but not really necessary
// RadialWalk( ,270,270+randomRange(16, 21), 50, 0, 0);
MMouse(MMCX-randomRange(45,50),MMCY-randomRange(15,20),2,2);
ClickMouse2(True);
wait(1000); //so that we move first, then we detect stationary
WaitTillStationary;
MarkTime(t);
repeat
//Look for slide
MMouse(MSCX - 25, MSCY - 25, 20, 20);
if WaitUpText('ump',1000) then
begin
ClickMouse2(True);
if DidRedClick then
break;
end;
wait(500);
until (TimeFromMark(t) > 30000);
//We cheat this for the next step //need tweaking, still not working
MouseBox(590, 325, 690, 345, mouse_move);
MarkTime(t);
repeat
if InLobby then
begin
Result:=True;
Exit;
end;
wait(500);
until (TimeFromMark(t) > 10000);
end;
{*******************************************************************************
function ReenterDungeon: Boolean;
by; nosaj421
Description: Returns true if we have successfully reentered the Dungeon.
It works by creating Party using the RoK and then attempt to blind
find the Enter Dungeon region right at the spot we slided down.
Then we do select the level and complexity and get back in.
*******************************************************************************}
function ReenterDungeon: Boolean;
var mx, my, t: integer;
begin
Result:=False;
if not LoggedIn then Exit;
if not InLobby then Exit;
//Select dung tab
GameTab(tab_Quest);
if not FindText(mx, my, 'Party', UpCharsEx, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Cannot find party interface');
OpenPartyInterface;
Exit;
end;
//Form party
if (getCurrentTab = tab_Quest) and
(not FindColorTolerance(mx, my, 120, MIX1, MIY1 + 50, MIX2, MIY2, 20)) then
MouseBox(590, 325, 690, 345, mouse_left);
wait(1000+random(200));
//Climb down
MarkTime(t);
repeat
//This is blind finding
MMouse(MSCX + 45, MSCY + 25, randomRange(-10,10), randomRange(-10,10));
ClickMouse2(False);
until (WaitOption('imb', 1500) or (TimeFromMark(t) > 5000));
if (TimeFromMark(t) > 5000) then Exit;
//Change level
MarkTime(t);
repeat
wait(20+random(20));
until (isScreen('Select Floor') or (TimeFromMark(t) > 5000));
if (TimeFromMark(t) > 5000) then Exit;
MouseBox(186, 276, 236, 290, 1);
//Change complexity
MarkTime(t);
repeat
wait(20+random(20));
until (isScreen('Select Complexity') or (TimeFromMark(t) > 5000));
if (TimeFromMark(t) > 5000) then Exit;
MouseBox(186, 276, 236, 290, 1);
//Enter dungeon
MarkTime(t);
repeat
wait(500);
until InDungeon or (TimeFromMark(t) > 4000);
if not (TimeFromMark(t) > 4000) then
Result:= True;
end;
begin
Smart_Server := SmartWorld;
Smart_Members := Members;
Smart_Signed := SignedClient;
Smart_SuperDetail := HighDetail;
setupSRL();
DeclarePlayers;
DoLogin;
ClickNorth(SRL_ANGLE_HIGH); //will only do this once!
wait(500);
MarkTime(t);
repeat
//Normal Start up
if InLobby and ReenterDungeon then
begin
fail:=0;
MarkTime(t1);
MakeGateStone;
writeln(format('Took %d',[TimeFromMark(t1)]));
if QuitDungeon then
if not SlideDownLadder then
begin
writeln('Failed to slide down ladder. Terminate');
Logout;
writeln(format('Script was alive for %d',[TimeFromMark(t)]));
TerminateScript;
end;
end
else Inc(fail);
if fail >= 5 then
begin
writeln('We have failed quite a lot! Terminate for safety!');
TerminateScript;
end;
wait(4000+random(500));
until not LoggedIn;
writeln(format('Script was alive for %d',[TimeFromMark(t)]));
end.