Daniel.Blaze
06-30-2006, 11:15 PM
Hi all,
this is my first scar script which is acually constructive and does something :D
Its still in the making, and i would really like some feedback and stuff on it and how to improve on it, cos it sux at the moment :p
I have a bit of past coding experience in other languages but not much. Sorry for the bad scar standards
program CosmicCrafter;
{.include SRL\SRL.scar}
// Wear tiera and start at bank
const
Banker = 4737101; //Banker fairy type thing shirt color
Altar = 4735048; //Grey Altar color on the runescape screen
Portal = 10405063; //Portal color
Banksymbol = 123456; //Bank symbol color on the round small map
Floor = 4804952; //Floor color in the altar on the round small map
WaterSymbol = 14498311; //Water symbol color on the round small map
Tripp = 5; // how many trips to do
Rundirection = 'N'; //direction to run away in
var
Trips:integer;
Area:String;
Procedure PrintProgressReport;
Begin
SRLRandomsReport;
End;
Procedure MMouse2(x,y: Integer); //stolen from osi and modified :)
begin
if(x<=789)and(x>=0)and(y<= 592)and(y>=0)then
begin
wait(10);
MoveMouseSmoothEx(x,y,1,6,15,20,10);
getmousepos(x,y);
end;
end;
Procedure Findrandoms;
begin
findnormalrandoms;
if(FindFight)then
begin
RunAwayDirection(RunDirection);
Wait(5000+random(1000));
RunBack;
end;
end;
Procedure TalkIfNeeded;
Var C:integer;
Begin
If(Findcolorspiral(x,y,16711680,212,426,400,463))t hen
Begin
Mouse(x+7,y,18,1,true);
wait(700 + random(900));
Mouse(148,390,20,2,true);
C:=0;
repeat
wait(100);
C:=C+1;
until(Bankscreen)or(C>19)
end;
end;
Procedure Openbank4;
Var C:Integer;
Begin
If(Findobj(x,y,'Talk',Banker,3))then
Begin
Mouse(x,y,1,1,false);
if(ChooseOption(x,y,'Bank'))then
begin
Flag;
C:=0;
repeat
Wait(100);
c:=c+1;
TalkIfNeeded;
until(BankScreen)or(c>=50)
end;
end;
end;
Procedure CloseBank2;
Var CloseBankScreen,C:Integer;
begin
CloseBankScreen := BitmapFromString(73, 15, 'z78DAE598E10E82300' +
'C845F89B8C5E07F7DFF57320A3FB61C576EEBA8A8982C6616 2CFD' +
'766DD33CA7474A19D75B9E520E5D9927D7744F979D95DDEB5 9E32' +
'3E08952BCCF1E5EFF468D452CFE84FC04B5797A7DCE406DF1 84F9' +
'D3E0E711A480DAEA8FF97CC5C6436DB942A911228B27C8A8C 1CF8' +
'3799544567F4C6AB64D1FBB506AA682D08772671835372F0F B51D' +
'F57D1535E5DF99659557CDE85596C085FEEAD011B3418E767 5C03' +
'795A2215799D62AE9A146F32A569677FC27B84A5EA54DC5CE A1A3' +
'561BBB3AE09B4AD1904FBEAE5C3F35BA53E4435D6548B095D AE09' +
'DBE7717764AA67DF9D63E5D9D7E029D0D1D15D4369428740E A576' +
'366242F2E11938B2EFADBD25E664A51BC1BA86D98FEAC8569 CDC2' +
'DB07B917E1F35560195BA66DBD8967ABF579D76B0B7F76D95 D936' +
'D4523E7BBA5AEDFE84ED607CA468E8DE8E9D63B43E61506FF F81F' +
'94CDF44257E3EE69FF9F87921B5E3E69C9134CF40CD3E5DA3 5416' +
'339DFE2A764F2F25481A');
If Findbitmapin(CloseBankScreen,x,y,411,27,500,55)the n
Begin
Mouse(x+5,y+3,2,0,true);
C:=0;
repeat
wait(100);
C:=C+1;
Until not(IsTextAt2(185,36,'The Bank of RuneScape',100))or(c>19)
end;
Freebitmap(CloseBankScreen);
end;
Function ColorFromBottom(Color:Integer):Boolean;
Var A:integer;
begin A:= 162;
Repeat
If(Findcolorspiral(x,y,Color,570,A,725,162))then begin
Result:=true; end
else A:= A-5;
until(Result=true)or(A<=5)
If(A<=5)then
Result:=false;
end;
Function CircleMouse(StartAngle,EndAngle,Color:integer;Want Color:Boolean):Boolean;
var StopPoint,Counter:integer;
Begin
Counter:=0;
If(StartAngle=360)then
Startangle:=0;
StopPoint:= (EndAngle-StartAngle);
StartAngle:=StartAngle-90;
Repeat
Mmouse2(Round(60*cos(Startangle * (pi/180)))+646,Round(60*sin(Startangle * (pi/180)))+81);
GetmousePos(x,y);
If((Not(Getcolor(x,y)=Color))and(WantColor=False)) or
((Getcolor(x,y)=Color)and(WantColor=true))then
begin
result:=true; Mouse(x,y,1,1,true); Exit;
end;
StartAngle:=Startangle+1;
Counter:=counter+1;
Until(Startangle>270)or(Counter=StopPoint)
end;
Procedure WalktoAltar; //sometimes walking dont work
begin
Status('Walking to Altar');
Findrandoms;
Mouse(708,109,4,2,true);
Setrun(true);
wait(1200);
flag;
Mouse(672,101,5,5,true);
flag;
If(ColorfromBottom(WaterSymbol))then
Begin
Mouse(x+3,y-3,1,1,true);
flag;
If(ColorfromBottom(WaterSymbol))then
Begin
Mouse(x+31,y+38,1,1,true);
flag;
If(CircleMouse(163,195,0,false))then flag;
If(CircleMouse(185,270,0,false))then flag;
If(CircleMouse(265,275,0,false))then flag;
If(CircleMouse(160,270,0,false))then
Begin
Repeat wait(100); until not(Flagpresent)
Repeat Wait(100); until(flagpresent);
wait(2000); flag;
If(CircleMouse(170,270,0,false))then flag;
If(Findobj(x,y,'Enter',Altar,3))then
Begin
Mouse(x,y,2,2,true);
repeat
wait(100);
until (Findcolorspiral(x,y,floor,570,5,725,162))
end;
end;
end;
end;
end;
Procedure DetectArea;
Begin
Status('Finding Where We Are');
Area:='';
Repeat
If not(Getcolor(646, 151)=0)and(area='')then
Begin
Area:='N'; Mouse(646,153,3,3,true); wait(2000); flag; exit;
end;
If not(Getcolor(584,84)=0)and(area='')then
Begin
Area:='E'; Mouse(584, 84,3,3,true); wait(2000); flag; exit;
end;
If not(Getcolor(713, 80)=0)and(area='')then
Begin
Area:='W'; Mouse(713,80,3,3,true); wait(2000); flag; exit;
end;
If not(Getcolor(653, 18)=0)and(area='')then
Begin
Area:='S'; Mouse(653,18,3,3,true); wait(2000); flag; exit;
end;
Until not(area='')
end;
Procedure CraftandBack;
begin
Status('Crafting');
Findrandoms;
If(Findobj(x,y,'Craft',Altar,5))then
Begin
Mouse(x,y,2,2,true);
repeat
wait(100);
until(inventorycount=1)
wait(1700 + random(600));
RunAwayDirection(Area);
gametab(4);
If(Findcolorspiral(x,y,floor,614,40,689,112))then
Begin
Mouse(x,y,2,2,true);
flag;
wait(1300 + random(400));
end;
end;
end;
Procedure PortalOut;
begin
Status('Finding Portal');
repeat
Findrandoms;
until(Findcolorspiraltolerance(x,y,portal,1,1,512, 336,5));
If(Findobj(x,y,'Use',Portal,5))then
Begin
Mouse(x,y,1,1,true);
flag;
repeat
wait(100);
Findrandoms;
until not(Findcolorspiral(x,y,floor,570,5,725,162))
end;
end;
Procedure AltartoBank; //sometimes walking dont work
begin
wait(random(500));
If(CircleMouse(270,360,0,false))then wait(2000); flag;
If(CircleMouse(30,45,0,false))then
Begin
wait(1600);
Repeat wait(100); until not(Flagpresent)
Repeat Wait(100); until(flagpresent);
wait(3000 + random(1000)); flag;
If(CircleMouse(30,90,0,false))then flag;
If(CircleMouse(0,0,0,false))then wait(8000); flag;
Mouse(635,49,5,5,true);
flag;
If(ColorfromBottom(WaterSymbol))then
Begin
Mouse(x-5,y-9,1,1,true);
flag;
repeat
Mouse(594,57,10,10,true);
flag;
until(Findcolorspiral(x,y,Banksymbol,570,5,725,162 ))
If(Findcolorspiral(x,y,Banksymbol,570,5,725,162))t hen
Begin
Mouse(x,y,2,2,true);
wait(1400);
flag;
Findrandoms;
end;
end;
end;
end;
begin
Activateclient;
SetupSRL;
ChatsOff;
Repeat
Openbank4;
Deposit(1,28,2);
wait(random(500));
withdraw(1,1,0);
wait(500 + random(200));
Closebank2;
GameTab(4);
WalktoAltar;
DetectArea;
CraftandBack;
PortalOut;
AltartoBank;
Trips:=trips+1;
PrintProgressReport;
Until(Trips>=Tripp)
Logout;
end.
i have tried my best, i still need some help with the multi player stuff and making it switch players. I also need better walking since the circlemouse sucks a bit.
I would appreciate if anyone could help me on IM. My IM is
Daniel.Blaze.100@googlemail.com
I hope to get lots better at scripting :D
Thank you
Dan
this is my first scar script which is acually constructive and does something :D
Its still in the making, and i would really like some feedback and stuff on it and how to improve on it, cos it sux at the moment :p
I have a bit of past coding experience in other languages but not much. Sorry for the bad scar standards
program CosmicCrafter;
{.include SRL\SRL.scar}
// Wear tiera and start at bank
const
Banker = 4737101; //Banker fairy type thing shirt color
Altar = 4735048; //Grey Altar color on the runescape screen
Portal = 10405063; //Portal color
Banksymbol = 123456; //Bank symbol color on the round small map
Floor = 4804952; //Floor color in the altar on the round small map
WaterSymbol = 14498311; //Water symbol color on the round small map
Tripp = 5; // how many trips to do
Rundirection = 'N'; //direction to run away in
var
Trips:integer;
Area:String;
Procedure PrintProgressReport;
Begin
SRLRandomsReport;
End;
Procedure MMouse2(x,y: Integer); //stolen from osi and modified :)
begin
if(x<=789)and(x>=0)and(y<= 592)and(y>=0)then
begin
wait(10);
MoveMouseSmoothEx(x,y,1,6,15,20,10);
getmousepos(x,y);
end;
end;
Procedure Findrandoms;
begin
findnormalrandoms;
if(FindFight)then
begin
RunAwayDirection(RunDirection);
Wait(5000+random(1000));
RunBack;
end;
end;
Procedure TalkIfNeeded;
Var C:integer;
Begin
If(Findcolorspiral(x,y,16711680,212,426,400,463))t hen
Begin
Mouse(x+7,y,18,1,true);
wait(700 + random(900));
Mouse(148,390,20,2,true);
C:=0;
repeat
wait(100);
C:=C+1;
until(Bankscreen)or(C>19)
end;
end;
Procedure Openbank4;
Var C:Integer;
Begin
If(Findobj(x,y,'Talk',Banker,3))then
Begin
Mouse(x,y,1,1,false);
if(ChooseOption(x,y,'Bank'))then
begin
Flag;
C:=0;
repeat
Wait(100);
c:=c+1;
TalkIfNeeded;
until(BankScreen)or(c>=50)
end;
end;
end;
Procedure CloseBank2;
Var CloseBankScreen,C:Integer;
begin
CloseBankScreen := BitmapFromString(73, 15, 'z78DAE598E10E82300' +
'C845F89B8C5E07F7DFF57320A3FB61C576EEBA8A8982C6616 2CFD' +
'766DD33CA7474A19D75B9E520E5D9927D7744F979D95DDEB5 9E32' +
'3E08952BCCF1E5EFF468D452CFE84FC04B5797A7DCE406DF1 84F9' +
'D3E0E711A480DAEA8FF97CC5C6436DB942A911228B27C8A8C 1CF8' +
'3799544567F4C6AB64D1FBB506AA682D08772671835372F0F B51D' +
'F57D1535E5DF99659557CDE85596C085FEEAD011B3418E767 5C03' +
'795A2215799D62AE9A146F32A569677FC27B84A5EA54DC5CE A1A3' +
'561BBB3AE09B4AD1904FBEAE5C3F35BA53E4435D6548B095D AE09' +
'DBE7717764AA67DF9D63E5D9D7E029D0D1D15D4369428740E A576' +
'366242F2E11938B2EFADBD25E664A51BC1BA86D98FEAC8569 CDC2' +
'DB07B917E1F35560195BA66DBD8967ABF579D76B0B7F76D95 D936' +
'D4523E7BBA5AEDFE84ED607CA468E8DE8E9D63B43E61506FF F81F' +
'94CDF44257E3EE69FF9F87921B5E3E69C9134CF40CD3E5DA3 5416' +
'339DFE2A764F2F25481A');
If Findbitmapin(CloseBankScreen,x,y,411,27,500,55)the n
Begin
Mouse(x+5,y+3,2,0,true);
C:=0;
repeat
wait(100);
C:=C+1;
Until not(IsTextAt2(185,36,'The Bank of RuneScape',100))or(c>19)
end;
Freebitmap(CloseBankScreen);
end;
Function ColorFromBottom(Color:Integer):Boolean;
Var A:integer;
begin A:= 162;
Repeat
If(Findcolorspiral(x,y,Color,570,A,725,162))then begin
Result:=true; end
else A:= A-5;
until(Result=true)or(A<=5)
If(A<=5)then
Result:=false;
end;
Function CircleMouse(StartAngle,EndAngle,Color:integer;Want Color:Boolean):Boolean;
var StopPoint,Counter:integer;
Begin
Counter:=0;
If(StartAngle=360)then
Startangle:=0;
StopPoint:= (EndAngle-StartAngle);
StartAngle:=StartAngle-90;
Repeat
Mmouse2(Round(60*cos(Startangle * (pi/180)))+646,Round(60*sin(Startangle * (pi/180)))+81);
GetmousePos(x,y);
If((Not(Getcolor(x,y)=Color))and(WantColor=False)) or
((Getcolor(x,y)=Color)and(WantColor=true))then
begin
result:=true; Mouse(x,y,1,1,true); Exit;
end;
StartAngle:=Startangle+1;
Counter:=counter+1;
Until(Startangle>270)or(Counter=StopPoint)
end;
Procedure WalktoAltar; //sometimes walking dont work
begin
Status('Walking to Altar');
Findrandoms;
Mouse(708,109,4,2,true);
Setrun(true);
wait(1200);
flag;
Mouse(672,101,5,5,true);
flag;
If(ColorfromBottom(WaterSymbol))then
Begin
Mouse(x+3,y-3,1,1,true);
flag;
If(ColorfromBottom(WaterSymbol))then
Begin
Mouse(x+31,y+38,1,1,true);
flag;
If(CircleMouse(163,195,0,false))then flag;
If(CircleMouse(185,270,0,false))then flag;
If(CircleMouse(265,275,0,false))then flag;
If(CircleMouse(160,270,0,false))then
Begin
Repeat wait(100); until not(Flagpresent)
Repeat Wait(100); until(flagpresent);
wait(2000); flag;
If(CircleMouse(170,270,0,false))then flag;
If(Findobj(x,y,'Enter',Altar,3))then
Begin
Mouse(x,y,2,2,true);
repeat
wait(100);
until (Findcolorspiral(x,y,floor,570,5,725,162))
end;
end;
end;
end;
end;
Procedure DetectArea;
Begin
Status('Finding Where We Are');
Area:='';
Repeat
If not(Getcolor(646, 151)=0)and(area='')then
Begin
Area:='N'; Mouse(646,153,3,3,true); wait(2000); flag; exit;
end;
If not(Getcolor(584,84)=0)and(area='')then
Begin
Area:='E'; Mouse(584, 84,3,3,true); wait(2000); flag; exit;
end;
If not(Getcolor(713, 80)=0)and(area='')then
Begin
Area:='W'; Mouse(713,80,3,3,true); wait(2000); flag; exit;
end;
If not(Getcolor(653, 18)=0)and(area='')then
Begin
Area:='S'; Mouse(653,18,3,3,true); wait(2000); flag; exit;
end;
Until not(area='')
end;
Procedure CraftandBack;
begin
Status('Crafting');
Findrandoms;
If(Findobj(x,y,'Craft',Altar,5))then
Begin
Mouse(x,y,2,2,true);
repeat
wait(100);
until(inventorycount=1)
wait(1700 + random(600));
RunAwayDirection(Area);
gametab(4);
If(Findcolorspiral(x,y,floor,614,40,689,112))then
Begin
Mouse(x,y,2,2,true);
flag;
wait(1300 + random(400));
end;
end;
end;
Procedure PortalOut;
begin
Status('Finding Portal');
repeat
Findrandoms;
until(Findcolorspiraltolerance(x,y,portal,1,1,512, 336,5));
If(Findobj(x,y,'Use',Portal,5))then
Begin
Mouse(x,y,1,1,true);
flag;
repeat
wait(100);
Findrandoms;
until not(Findcolorspiral(x,y,floor,570,5,725,162))
end;
end;
Procedure AltartoBank; //sometimes walking dont work
begin
wait(random(500));
If(CircleMouse(270,360,0,false))then wait(2000); flag;
If(CircleMouse(30,45,0,false))then
Begin
wait(1600);
Repeat wait(100); until not(Flagpresent)
Repeat Wait(100); until(flagpresent);
wait(3000 + random(1000)); flag;
If(CircleMouse(30,90,0,false))then flag;
If(CircleMouse(0,0,0,false))then wait(8000); flag;
Mouse(635,49,5,5,true);
flag;
If(ColorfromBottom(WaterSymbol))then
Begin
Mouse(x-5,y-9,1,1,true);
flag;
repeat
Mouse(594,57,10,10,true);
flag;
until(Findcolorspiral(x,y,Banksymbol,570,5,725,162 ))
If(Findcolorspiral(x,y,Banksymbol,570,5,725,162))t hen
Begin
Mouse(x,y,2,2,true);
wait(1400);
flag;
Findrandoms;
end;
end;
end;
end;
begin
Activateclient;
SetupSRL;
ChatsOff;
Repeat
Openbank4;
Deposit(1,28,2);
wait(random(500));
withdraw(1,1,0);
wait(500 + random(200));
Closebank2;
GameTab(4);
WalktoAltar;
DetectArea;
CraftandBack;
PortalOut;
AltartoBank;
Trips:=trips+1;
PrintProgressReport;
Until(Trips>=Tripp)
Logout;
end.
i have tried my best, i still need some help with the multi player stuff and making it switch players. I also need better walking since the circlemouse sucks a bit.
I would appreciate if anyone could help me on IM. My IM is
Daniel.Blaze.100@googlemail.com
I hope to get lots better at scripting :D
Thank you
Dan