Hamish
03-14-2013, 08:57 PM
Hey guys, first ever script here. Works quite well from what iv'e tested.
Current Features:
Chops Oak tree's
Fletches oak logs into oak longbows
drops all bows
In Progress
Walks to shop and sells bows
option to cut other things
I know this script isn't going to be amazing but i'd really appreciate if I got feedback on my code and how I can improve and where and what problems you had.
Thanks.
program oakFletcher;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
{$I 07symbol.simba}
var
X,Y, knifeDTM,logDTM,longBowDTM: Integer;
procedure P07_DeclarePlayer;
begin
P07_PlayerName := '';
P07_PlayerPass := '';
end;
Procedure DTMshere;
begin
knifeDTM := DTMFromString('mQwAAAHicY2ZgYKhlYWDoBuJWIE5iZGDwBO JQIC7MzGTISU1lyEtPZ+AEqoNhRiQMBAAPugZz');
logDTM := DTMFromString('mrAAAAHic42BgYDjExMCwB4iPAfEpIN4JxF uYIOL7gZiLkYFBEIgZgZgXiJmhND+UXZ9gyTC50ImhMdkKTPfk ODIsbIoG0y2pNgyEACMBDAMAPmkQRw==');
longBowDTM := DTMFromString('mbQAAAHicY2VgYMhlYmAoA+JEIM4G4kIgZm FkYBAC4t9A+f9AzAlkH18kzjC5QpChPo2XYec0EaAoUBALYMSC wQAAlZIJQw==');
end;
Procedure shopWalk;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If FindSymbol(x, y, Symbol07_shop) then
begin
writeln('Walking to general store');
MMouse(x, y, 3, 3);
ClickMouse2(Mouse_Left);
end;
p07_FFlag;
wait (1000+Random(500));
end;
Procedure FindShopKeeper;
var
tmpCTS, l, r:Integer;
ObjectTPA:TPointArray;
begin
MouseSpeed:=15;
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.05, 0.14);
if FindColorsTolerance(ObjectTPA, 2178910, 8, 25, 518, 359, 4) then
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(ObjectTPA);
mmouse((ObjectTPA[r].x), (ObjectTPA[r].y), 2, 2);
wait(randomrange(100, 150));
clickmouse2(mouse_right);
Writeln('Found the Shop keeper');
wait(randomrange(500, 600));
P07_ChooseOptionMulti(['rade', 'tra']);
wait(randomrange(2000, 2500));
end else
Writeln('couldnt find the Shop keeper');
end;
Procedure sellBows;
begin
if(FindDTM(longBowDTM, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2)) then
mmouse(x, y, 2, 2);
clickmouse2(mouse_right);
Repeat
P07_ChooseOptionMulti(['ell 10', '10']);
until
not (findDTM(longbowDTM, x, y, 565, 7, 717, 157))
end;
procedure treeWalk;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
mmouse(620, 90, 4, 4);
wait(350+random(125));
clickmouse2(mouse_left);
wait(350+random(125));
end;
Procedure ChopOak;
Begin
P07_MakeCameraAngleHigh;
repeat
if p07_findobjCustom(x,y, ['Oak'], [933173, 1863263, 2505017], 5) then
writeln('Found Oak');
Wait(500 + Random(153));
mmouse(x, y, 5, 5); //Moves Mouse to tree
clickmouse2(mouse_left);
Writeln('Clicked Oak');
P07_MakeCompassDegree(RandomRange(25,260));
Wait (RandomRange(7000,8000))
until(P07_InvFull)
end;
Procedure FletchBows;
Begin
wait(random(900));
if(findDTM(knifeDTM, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2)) then
Begin
MMouse(x, y, 8, 4); // Found and clicked on knife
clickmouse2(mouse_left);
wait(random(400));
if(FindDTM(logDTM, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2)) then
wait(250+random(125));
Begin
MMouse(x, y, 2, 2);
wait(250+random(125));
clickmouse2(mouse_left);
wait(250+random(125));
mmouse( 255, 394, 7, 7);
wait(100+random(8));
clickmouse2(mouse_right);
wait(240+random(35));
P07_ChooseOptionMulti(['e X', 'X']);
Wait(RandomRange(600,999));
SendKeys(IntToStr(RandomRange(30, 99)), 95, 35);
Wait(RandomRange(270, 370));
P07_UseKey(13);
wait(18000+random(12700));
end;
end;
end;
Procedure FreetheDTM;
begin
FreeDTM(knifeDTM);
FreeDTM(logDTM);
FreeDTM(longBowDTM);
end;
Procedure login;
begin
If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
P07_MakeCameraAngleHigh;
end;
end;
begin
DTMshere;
P07_DeclarePlayer;
SetupP07Include;
ActivateClient;
Addonterminate('FreetheDTM');
login;
Wait(100);
repeat
chopoak;
FletchBows;
wait(18000+random(12700));
ShopWalk;
FindShopKeeper;
wait(1000+random(100));
treeWalk;
until(not P07_Loggedin);
end.
Thanks to RJJ95 for his 'guide to scripting on runescape private servers' (http://villavu.com/forum/showthread.php?t=94909)
Place the 07Symbol attatchment into your Simba>Includes folder.
Current Features:
Chops Oak tree's
Fletches oak logs into oak longbows
drops all bows
In Progress
Walks to shop and sells bows
option to cut other things
I know this script isn't going to be amazing but i'd really appreciate if I got feedback on my code and how I can improve and where and what problems you had.
Thanks.
program oakFletcher;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
{$I 07symbol.simba}
var
X,Y, knifeDTM,logDTM,longBowDTM: Integer;
procedure P07_DeclarePlayer;
begin
P07_PlayerName := '';
P07_PlayerPass := '';
end;
Procedure DTMshere;
begin
knifeDTM := DTMFromString('mQwAAAHicY2ZgYKhlYWDoBuJWIE5iZGDwBO JQIC7MzGTISU1lyEtPZ+AEqoNhRiQMBAAPugZz');
logDTM := DTMFromString('mrAAAAHic42BgYDjExMCwB4iPAfEpIN4JxF uYIOL7gZiLkYFBEIgZgZgXiJmhND+UXZ9gyTC50ImhMdkKTPfk ODIsbIoG0y2pNgyEACMBDAMAPmkQRw==');
longBowDTM := DTMFromString('mbQAAAHicY2VgYMhlYmAoA+JEIM4G4kIgZm FkYBAC4t9A+f9AzAlkH18kzjC5QpChPo2XYec0EaAoUBALYMSC wQAAlZIJQw==');
end;
Procedure shopWalk;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If FindSymbol(x, y, Symbol07_shop) then
begin
writeln('Walking to general store');
MMouse(x, y, 3, 3);
ClickMouse2(Mouse_Left);
end;
p07_FFlag;
wait (1000+Random(500));
end;
Procedure FindShopKeeper;
var
tmpCTS, l, r:Integer;
ObjectTPA:TPointArray;
begin
MouseSpeed:=15;
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.05, 0.14);
if FindColorsTolerance(ObjectTPA, 2178910, 8, 25, 518, 359, 4) then
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(ObjectTPA);
mmouse((ObjectTPA[r].x), (ObjectTPA[r].y), 2, 2);
wait(randomrange(100, 150));
clickmouse2(mouse_right);
Writeln('Found the Shop keeper');
wait(randomrange(500, 600));
P07_ChooseOptionMulti(['rade', 'tra']);
wait(randomrange(2000, 2500));
end else
Writeln('couldnt find the Shop keeper');
end;
Procedure sellBows;
begin
if(FindDTM(longBowDTM, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2)) then
mmouse(x, y, 2, 2);
clickmouse2(mouse_right);
Repeat
P07_ChooseOptionMulti(['ell 10', '10']);
until
not (findDTM(longbowDTM, x, y, 565, 7, 717, 157))
end;
procedure treeWalk;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
mmouse(620, 90, 4, 4);
wait(350+random(125));
clickmouse2(mouse_left);
wait(350+random(125));
end;
Procedure ChopOak;
Begin
P07_MakeCameraAngleHigh;
repeat
if p07_findobjCustom(x,y, ['Oak'], [933173, 1863263, 2505017], 5) then
writeln('Found Oak');
Wait(500 + Random(153));
mmouse(x, y, 5, 5); //Moves Mouse to tree
clickmouse2(mouse_left);
Writeln('Clicked Oak');
P07_MakeCompassDegree(RandomRange(25,260));
Wait (RandomRange(7000,8000))
until(P07_InvFull)
end;
Procedure FletchBows;
Begin
wait(random(900));
if(findDTM(knifeDTM, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2)) then
Begin
MMouse(x, y, 8, 4); // Found and clicked on knife
clickmouse2(mouse_left);
wait(random(400));
if(FindDTM(logDTM, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2)) then
wait(250+random(125));
Begin
MMouse(x, y, 2, 2);
wait(250+random(125));
clickmouse2(mouse_left);
wait(250+random(125));
mmouse( 255, 394, 7, 7);
wait(100+random(8));
clickmouse2(mouse_right);
wait(240+random(35));
P07_ChooseOptionMulti(['e X', 'X']);
Wait(RandomRange(600,999));
SendKeys(IntToStr(RandomRange(30, 99)), 95, 35);
Wait(RandomRange(270, 370));
P07_UseKey(13);
wait(18000+random(12700));
end;
end;
end;
Procedure FreetheDTM;
begin
FreeDTM(knifeDTM);
FreeDTM(logDTM);
FreeDTM(longBowDTM);
end;
Procedure login;
begin
If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
P07_MakeCameraAngleHigh;
end;
end;
begin
DTMshere;
P07_DeclarePlayer;
SetupP07Include;
ActivateClient;
Addonterminate('FreetheDTM');
login;
Wait(100);
repeat
chopoak;
FletchBows;
wait(18000+random(12700));
ShopWalk;
FindShopKeeper;
wait(1000+random(100));
treeWalk;
until(not P07_Loggedin);
end.
Thanks to RJJ95 for his 'guide to scripting on runescape private servers' (http://villavu.com/forum/showthread.php?t=94909)
Place the 07Symbol attatchment into your Simba>Includes folder.