bg5
2012-01-03 12:51:26
How Long have You Played Runescape?
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
-
What is your general programming knowledge?
I have experience in C++ and C ,I used to work with ucontrollers ,making electronic devices and programming them ( usually in AVRGCC) ,so I know some how computers works:) I also know basics of assembler (basics and no more). I didn't have much to do with Pascal before I registered on this side (excluding one simple GUI game in Delphi for credit),but I don't see much differents to other languages.
Are you a member of any other communities?
No
Tell us about yourself…
Please show us one (or multiple) of your scripts.
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
-
What is your general programming knowledge?
I have experience in C++ and C ,I used to work with ucontrollers ,making electronic devices and programming them ( usually in AVRGCC) ,so I know some how computers works:) I also know basics of assembler (basics and no more). I didn't have much to do with Pascal before I registered on this side (excluding one simple GUI game in Delphi for credit),but I don't see much differents to other languages.
Are you a member of any other communities?
No
Tell us about yourself…
From: beginner5
Hello,
I'm currently student of university of technology. I have a little bit free time so I want to to raise my programming skills. I think I found good place. I'm interested into basic working mechanism and complicated algorithms rather then making eye candy painting.
And I apologize for me english ,it's sometimes sucks ,but it's not my primary language.
About scripts :
Plank Maker is my first script I have been ever made in Simba and at once one most cared for .Current version is a child of several nights:) I made this script for my own purpose and made about 50k planks on my main. I'm paranoid about security ,so I tried to make it as human-like as I can.
Antiban:
Almost everything in this script is randomized:
- all time intervals are randomized
- two ways to click a plank
- custom mouseclick function which make trace like human
- sometimes misses cast icon/plank
- always search for missed plank ,if found fix it in random moment
- aiming in middle (not gauss ,but good too)
- random short breaks
- standart package of antibans like hooverskill ,rotate camera ,exmine object etc.
Optimalization:
- Average exp. is 130k/h
- Delays are perfectly fitted by uses of WaitFunc
- You can change base time between casts ,if you think thats its too slow/fast
Fail safe:
- Laggs should not affect the script (tested on 350 ping server)
- Will logout if out of supply or something goes wrong
Other:
- You can choose between DTM banking or banking from declared slot.
- Switch on/off debug mode for additional informations
Setup:
- Place your guy in bank with runes in slots 1,2 and inventory full of logs.
- Disable combat and teleport spells
To run the script you need to copy MyFunc.scar to Simba\Includes\ ! It's repository of my own usefull functions.
Example of proggy:Successfully made 1222 planks. It is 118440 exp.
Running for 49 Minutes and 38 Seconds. It is 129600 exp/h and 1477 planks/h
Please show us one (or multiple) of your scripts.
program PlankMakerv3;
{ Plank Maker v.3
Start it with full inventory of logs !
Runes must be at first 2 spots.
Logs must be visible in your bank.
You must hide all except skill spells !
//////Credits:
Banking function is partially taken from neeger's Herblore Pro
///////Known Bugs:
Sometimes can't find log's DTM in bank. Propably when uptext is less visible on the background.
Sometimes misses spell icon. However I miss too ,more often then bot :) So I let
it missing to be more human-like.
///////To Do
Increase speed by reducing time between particular activitis --- DONE
Add slow mode antiban (decrease speed for few loops after some time of working ,like tired human)
Optionally - replace DTM banking by banking from declared slot --- DONE
Add more complex sequence of planks
Add dynamic missclick-checker --- DONE
}
{$DEFINE SRL5}
{$DEFINE SMART}
//{$I SRL/SRL.scar}
{$I SRL/srl.simba}
{$I MyFunc.scar}
////////////////////////////SETUP///////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
const
RS_World = 139; // select world
MyBank = 'feb'; // define your bank (list of supported locations: [url]http://docs.wizzup.org/srl-5/bank.html#openbank[/url] )
Banking_Slot = 37; // 0 - DTM based banking or write number of bank slot with logs
Debug_mode = True;
Debug2_mode = False;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
BASE_WAIT_TIME = 1600; // It's base waiting time between spells. Better do not tounch.
var
InvPos : TInvenItemArr;
a,b,x,y,loop ,CastTime:integer;
MahoDTM , PlankMakeDTM ,PMunactiveDTM ,PlankDTM: integer;
deb,deb2 :boolean;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := 'Nick';
Pass := 'Password';
Pin := '';
BoxRewards := ['XP','xp','lamp'];
LampSkill := 'Summoning';
Active := True;
end;
end;
procedure start;
begin
ClearDebug;
Smart_Server := RS_World;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
//activateclient;
SetupSRL;
DeclarePlayers;
Players[0].Active:= True;
deb := Debug_mode;
deb2 := Debug2_mode;
end;
procedure ItemDTM;
begin
PlankDTM := DTMFromString('mbQAAAHicY2VgYEhlZGBIAuI8Rgg7C4gvAsXPA/FhID4IxIcYQICJISvACkyDsJOhCgM2wIgFgwEATC8Hiw==');
PMunactiveDTM := DTMFromString('mggAAAHicdcMhCoBAEEDRPwbvNskgCIZB8GwmQVhMHs8PJsM+eCNwDHD7cfPl00vA5Nm7V2+G+M1Mqoqe6Py8FlkIPA==');
MahoDTM := DTMFromString('mQwAAAHicY2ZgYOBkZGAQBWJhID4F5J8A4gNAHKjPzbCyL55hw5RkBmUgH4YZkTAQAAAArwa+');
PlankMakeDTM := DTMFromString('mggAAAHicY2NgYFjHxMCwHohXAPFSIN4MxNuBuIyRgaEWiKuAuBSIc4G4EIhPbZ7A8G5nPcP3C2vA9IpyR4Yifx0GXIARB4YAANwwEgw=');
end;
procedure click;
begin
HClick(x,y,1,40,50,4);
end;
procedure AntiBan2;
begin
case random(1000) of
0..10: begin Writeln('Little break'); Wait2(500,random(8000)); end;
end;
end;
function IsInvTab : Boolean;
var
a :integer;
begin
a := GetCurrentTab;
if (a = tab_inv ) then Result:=True else Result:=False;
end;
function IsMagTab : Boolean;
var
a :integer;
begin
a := GetCurrentTab;
if (a = tab_Magic ) then Result:=True else Result:=False;
end;
procedure Check_End;
begin
if (not(26=CountItems('dtm', MahoDTM, []))) then
begin
Free_all([MahoDTM , PlankMakeDTM ,PMunactiveDTM ,PlankDTM]);
end_script('Not enought logs in inventory.',True);
end;
end;
procedure MakePos(Nr:integer); // makes random cord. for all inv positions ,aiming at middle
// I know currently SLR version has Gauss-aiming ,but it was written before slr5
begin
x:=InvPos[Nr-1].centerPoint.x+random (InvPos[Nr-1].width/2-2)-random(InvPos[Nr-1].width/2-2);
y:=InvPos[Nr-1].centerPoint.y+random (InvPos[Nr-1].height/2-2)-random(InvPos[Nr-1].height/2-2);
// Writeln(inttostr(x)+' '+inttostr(y));
end;
function Bank: Boolean;
var a: integer;
begin
FindNormalRandoms;
if (not(BankScreen)) then
begin
if (not(OpenBank(MyBank, False, False))) then
WriteLn('Error: Cant open bank');
Wait2(200,300);
if BankScreen then
begin
Wait2(200,300);
FixBank;
end;
end;
a:=4 + random (12);
Deposit(a, a, True);
Wait2(500,1200);
if (random(10)>7) then
a := 0 else
a := 26;
if (Banking_Slot = 0) then
begin //Withdrawing by DTM
if (not(WithdrawItem(MahoDTM, 'dtm', a, 'log', []))) then
begin
wait(300);
if (not(WithdrawItem(MahoDTM, 'dtm', a, 'log', []))) then //try again
begin
Writeln ('Can t find log s DTM in bank');
Result := False;
exit;
end; //Withdrawing by slot
end;
end else begin
WithrawBankSlot(Banking_Slot,a);
end;
WaitFunc(@InvFull, 50, 4000);
if (not(InvFull)) then
begin
Writeln('Out of suply ?');
Result := False;
exit;
end;
Wait2(200,300);
WaitFunc(@CloseBank, 20, 500);
FindNormalRandoms;
end;
procedure FirstSteps;
begin
if (not(LoggedIn)) then
begin
LoginPlayer;
end;
if (not(26=CountItems('dtm', MahoDTM, []))) then
begin
Bank;
Wait2(1000,200);
Check_End;
end;
if (not(GetCurrentTab = tab_Inv)) then
begin
debug('switching tab to Inv',deb);
GameTab(tab_Inv);
end;
InvPos := GetInventoryArray;
wait2(500,1000);
end;
procedure CastClick;
var
PmPos :TPoint;
begin
GameTab(Tab_Magic);
if(not(findDTM(PlankMakeDTM,PMpos.x,PMpos.y,542,208,739,442))) then
begin
if(findDTM(PMunactiveDTM,x,y,542,205,739,442)) then
begin
Free_all([MahoDTM , PlankMakeDTM ,PMunactiveDTM ,PlankDTM]);
end_script('You have no runes to cast spell',False);
end else
begin
if(FindNormalRandoms) then exit;
Free_all([MahoDTM , PlankMakeDTM ,PMunactiveDTM ,PlankDTM]);
end_script('Spell icon is not detected',False);
end;
end;
x:=PMpos.x + random (9) - random (2);
y:=PMpos.y + random (13) - random (10);
/////////Forced missclick//////////////////////////////
if ((random(300)<2)and(not(a=28))) then
begin
x:=x+ random (30) - random (30);
y:=y+ random (30) - random (30);
debug('Forced missclick antiban',deb);
end;
///////////////////////////////////////////////////////
HClick(x,y,1,40,50,2);
end;
{procedure MakePlank(Nr : integer ;Miss : Boolean); // old func
begin
if(not(Miss)) then CastClick;
MakePos(Nr);
if (random(10)<5) then
begin // Move mouse to neighborhood of plank pos. before tab is switched to inv
wait2(50,200);
MMouse(x+random(50)-random(50),y+random(50)-random(50),2,2);
wait2(400,300);
click;
wait2(1000,random(900));
end else begin // Wait till tab change to inv
wait2(800,300);
Click;
wait2(1000,random(900));
end;
end;}
{ function MissClickCheck2 : Boolean; //Dynamic missclick check - broken by laggs
begin
if (ExistsItemDTMSlot(a-1,MahoDTM)) then
begin
Result:=True;
end;
end;}
function MakePlank2(Nr : integer ;Miss : Boolean) : integer;
var
P2:TPoint;
MissedPlanks : array of integer;
begin
if(not(Miss)) then CastClick;
MakePos(Nr);
if (random(10)<5) then
begin // Move mouse to neighborhood of plank pos. before tab is switched to inv
wait2(30,60);
P2.x:=x+random(50)-random(50);
P2.y:=y+random(50)-random(50);
MMouse(P2.x,P2.y,2,2);
if (PointInBox(P2,InvBox(Nr))) then
begin
x:=P2.x;
y:=P2.y;
end;
WaitFunc(@IsInvTab,20,1000);
end else begin // Wait till tab change to inv and click after
WaitFunc(@IsInvTab,20,1000);
end;
if( (a>4)and(FindInventoryDTM(MissedPlanks,MahoDTM,3,a-2,False))and(random(10)>7) ) then //Searching for missed plank with
Result := MissedPlanks[0]; //30% chance it will fix it atm.
//debug(inttostr(TimeFromMark(ClickTime))+' '+inttostr(Nr)+' before',deb);
while (TimeFromMark(CastTime) < BASE_WAIT_TIME) do wait(10);
wait2(50,random(300));
debug(('Time interval : '+inttostr(TimeFromMark(CastTime))+' pos: '+inttostr(Nr)),deb2);
MarkTime(CastTime);
click;
WaitFunc(@IsMagTab,20,3000);
Wait2(100,random(400))
end;
function CheckForMissAndFix : Boolean; // final checker function with dynamic randomization
var
MissedPlanks : array of integer;
a:integer;
begin
GameTab(tab_Inv);
if(FindInventoryDTM(MissedPlanks,MahoDTM,1,27,deb)) then
begin
Result:= True;
MissedPlanks:=RandArray(MissedPlanks);
for a:=0 to (Length(MissedPlanks)-1) do
begin
if (a=0) then
MakePlank2(MissedPlanks[a],True)
else
MakePlank2(MissedPlanks[a],False);
end;
end;
end;
///////////////////////////Start Section////////////////////////////////////////
begin
start;
ItemDTM;
FirstSteps;
for loop:= 1 to 1000 do
begin
FindNormalRandoms;
////////////////////////////Making Planks Section///////////////////////////////
for a:=3 to 28 do
begin
b:=(MakePlank2(a,False));
if(b>0) then
begin
MakePlank2(b,False);
b:= 0;
Debug('Fixing...',deb);
end;
Antiban2;
end;
WaitFunc(@IsMagTab,20,3000);
CastClick;
WaitFunc(@IsInvTab,20,3000);
Wait2(500,100);
CheckForMissAndFix;
//////////////////////////////Report////////////////////////////////////////////
WriteLn('Successfully made ' +inttostr(loop*26)+' planks. It is ' +inttostr(loop*28*90)+' exp.');
Writeln('Running for '+TimeRunning+'. It is '+inttostr((loop*26*90*1000)/GetTimeRunning*3600)+' exp/h and '+inttostr((loop*26*3600)/(GetTimeRunning/1000))+' planks/h');
////////////////////////////////////////////////////////////////////////////////
Bank;
Wait2(500,random(3000));
Check_End;
Antiban(2000,'Magic');
end;
Free_all([MahoDTM , PlankMakeDTM ,PMunactiveDTM ,PlankDTM]);
end. MyFunc.scar procedure Wait2(Base,RandomTime:integer);
begin
Wait(Base+random(RandomTime));
end;
function CheckSign (a :integer) :integer ; // Returns 1 for positive and -1 for negative arguments
begin
if (a<>0) then
begin
a := a shr ((sizeof(a))*8-1);
Result:=(-a)+((-a+10)/10)*1;
end else Result:= 0;
end;
procedure HClick(x,y,button,HoldTime,HoldRandomTime,MFlow:integer); //human click
var
x0 ,y0,dx,dy :integer;
begin
GetMousePos(x0,y0);
dx:= x-x0;
dy:=y-y0;
// Writeln(inttostr(dx) + ' ' +inttostr(dy));
x0:=(CheckSign( round (abs(dx)) -round(abs(dy)) )+10)/10;
y0:=(CheckSign( round (abs(dy)) -round(abs(dx)) )+10)/10;
if (random (10) > 7) then //chance of smudge
begin
x0:=x0*CheckSign(dx)*random(4);
y0:=y0*CheckSign(dy)*random(4);
end;
// Writeln(inttostr(x0)+' '+inttostr(y0));
MMouse(x,y,MFlow,MFlow);
HoldMouse(x,y,button);
MoveMouse(x+x0,y+y0);
Wait(HoldTime+random(HoldRandomTime));
ReleaseMouse(x,y,button);
end;
function AntiBan (Rate:integer;SKillName:string):Boolean;
begin
Result:=True;
case random(Rate) of
0..50: HoverSkill(SkillName,false);
51..80: PickupMouse;
81..100: RandomMovement;
101..220: BoredHuman;
221..240: ExamineInv;
241..260: RandomRClick;
else Result:= False;
end;
end;
procedure WritePos (Description:string;x,y:integer); // Writing mouse pos
begin
writeln(Description+' x : '+inttostr(x)+' ,y : '+inttostr(y) );
end;
function end_script(Reason :String;Instant:boolean):boolean; //ending script instantly or after 30 sec. (usefull in testing)
var
ins :string;
begin
Result :=true;
ins :='after 30 seconds.';
if (Instant) then ins :='instantly.';
writeln('Error. Script will logout '+ins+' Reason: '+Reason);
if (BankScreen) then WaitFunc(@CloseBank, 20, 500);
if (not(Instant)) then Wait2(30000,1000);
if (not(Waitfunc(@Logout,2000,8000))) then
begin
writeln('Logout fails. Are you in combat?')
Result:=False;
end else
Terminatescript;
end;
procedure Free_all (dtms : array of integer); // Free all DTMs with one line
var
a :integer;
begin
for a:=0 to Length(dtms)-1 do
begin
FreeDTM(dtms[a]);
end;
end;
procedure Debug (Message:String;On:Boolean);
begin
If (not(On)) then exit
else writeln (Message);
end;
function WithrawBankSlot(Slot_number,amount :integer):Boolean; // Withdraw item from bank slot
var
BPoint : Tpoint;
begin
Result:=True;
BPoint:=BankIndexToBankPoint(Slot_number)
If(not(Withdraw(BPoint.x,BPoint.y,amount))) then Result:=False;
end;
function ExistsItemDTMSlot(Slot_number,dtm: Integer): Boolean; // Checking if dtm exist in inv slot
var
x,y :integer;
SBox :TBox;
begin
SBox:=InvBox(Slot_number);
Result := FindDTM(dtm, x, y, Sbox.x1, Sbox.y1, Sbox.x2, Sbox.y2);
end;
function RandArray(IntArray:array of integer):array of integer; //Randomize sequence of elements in array
var
RandomizedArray: array of integer;
BoolArr: array of boolean;
a,b,Len:integer;
begin
Len:=Length(IntArray);
SetArrayLength(RandomizedArray, Len)
SetArrayLength(BoolArr, Len)
for a:=0 to Len-1 do
begin
b:= random(Len);
if (not(BoolArr[b])) then
begin
BoolArr[b]:=True;
RandomizedArray[a]:=IntArray[b];
end else
a:=a-1;
Result:=RandomizedArray;
end;
end;
//Makes array of inventory slots containing DTM. Returns True if find any.
function FindInventoryDTM(var InvSlotArray : array of integer;dtm,Slot_from,Slot_to:integer;AllowDebug:boolean) : Boolean;
var
a,LCounter:integer;
DebugString : string;
begin
DebugString := 'Found DTM at pos: ';
LCounter := 0;
SetArrayLength(InvSlotArray, 28);
for a:=Slot_from to Slot_to do
begin
if (ExistsItemDTMSlot(a,dtm)) then
begin
InvSlotArray[LCounter] := a;
LCounter := LCounter + 1;
end;
end;
SetArrayLength(InvSlotArray,LCounter);
if (LCounter>0) then
begin
if (AllowDebug) then
begin
for a:=0 to LCounter-1 do
begin
DebugString := DebugString +' '+inttostr(InvSlotArray[a]);
end;
writeln(DebugString);
end;
Result:=True;
end else Result:=False;
end;
function RandomPointInBox (box :Tbox) :Tpoint; //Returns random point in box
begin
Result.x:=box.x1+random(box.x2-box.x1);
Result.y:=box.y1+random(box.y2-box.y1);
end;
// Modification of FindObjEx. Added: var DeadPixelArr: TPointArray . Now will not move mouse to pixel
//,which was before checked for UpText with negative result.
function FindObjEx2(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer ; var DeadPixelArr: TPointArray): Boolean;
var
CurX, CurY, a, b, c, i ,d: Integer;
Start: Boolean;
cPoint: TPoint;
begin
SetLength(DeadPixelArr,100);
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorSpiralTolerance(cx, cy, color[b], xs, ys, xe, ye, Tol)) then
begin
Start := True;
Break;
end;
end;
if (Start) then
begin
CurX := Round((xs + xe) div 2);
CurY := Round((ys + ye) div 2) - Step;
i := 1;
repeat
for c := 1 to i do
begin
case a of
0: begin //To allow for beginning offset and loop
a := a + 1;
i := 0;
CurY := CurY + Step;
end;
1: CurX := CurX + Step;
2: CurY := CurY - Step;
3: CurX := CurX - Step;
4: CurY := CurY + Step;
end;
if (CurX >= xs) and (CurX <= xe) and (CurY >= ys) and (CurY <= ye) then
begin
try
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorTolerance(cx, cy, Color[b], CurX-(Step div 2), CurY-(Step div 2), CurX+(Step div 2), CurY+(Step div 2), Tol)) then
begin
cPoint := Point (cx , cy );
// writepos('Pix b: ',cPoint.x,cPoint.y);
if (not(PointInTPA(cPoint ,DeadPixelArr ))) then
begin
MMouse(cx, cy, 3, 3);
If (WaitUptextMulti(Text, 300)) then
begin
GetMousePos(cx, cy);
Result := True;
Exit;
end else // Add point to dead pixels if not found UpText
begin
while (DeadPixelArr[d].x<>0) do
d:=d+1;
DeadPixelArr[d] := cPoint;
writepos(('Added dead pix no.'+inttostr(d)),DeadPixelArr[d].x,DeadPixelArr[d].y);
end;
end;
end;
end;
except
end;
end;
end;
a := a + 1;
if a mod 5 = 0 then a := 1;
if (a = 1) or (a = 3) then i := i + 1;
until (Result) or ((CurX > xe) and (CurY > ye))
end;
end;
procedure ClearTPA (var TPA :TPointArray);
var
a :integer;
begin
for a:=1 to Length(TPa) do
begin
TPA[a-1].x := 0;
TPA[a-1].y := 0;
end;
end;