Jump to content
jojofromjory

My First Script: Al Kharid Lobby Cooker

Recommended Posts

This is the first script I've ever made, well, the first one I've ever finished (:

 

Start it in Al Kharid Bank, have your food (can be anything) in the first slot of a bank tab or your bank and make sure it's visible as the first slot.

Have your compass on north and your camera up most.

For your video modus: Click Min and Fixed, then click Custom and click Software.

 

Have fun!

 

Greetings, Jojo

 

program KharidCook;
var x,y,ChoiceColor,CookedColor:Integer;
var BankColor,RawLobColor,PanColor:Integer;
var StoveColor,ChairColor,BankIcon:Integer;
//-------------------------//
procedure DeclareColors;
begin
BankColor := 10012657; //Color of Bank Booth
CookedColor := 1596086; //Color of Cooked Lobster
RawLobColor := 2046567; //Color of Raw Lobster
PanColor := 1194595; //Color of Pan on mini-map
StoveColor := 925118; //Color of the red flames out of the stove
ChairColor := 1328747; //Color of the chair left of the most left bank booth
BankIcon := 806245; //Color of the $ sign on the mini-map
ChoiceColor := 4345687; //Color of the 'Cook All' select menu (right side of button)
end;
//-------------------------//
Procedure BankTrue;
begin
If Findcolor(x,y,2765112,490,135,515,160) then

else
Wait(100);
end;

//-------------------------//
Procedure Bankk;
begin
Wait(1500);
FindColor(x,y,BankColor,114,58+Random(75)+Random(75),239,271);
MoveWindMouse(x,y,Random(4),Random(4));
Wait(Random(1000));
Wait(500);
GetMousePos(x,y);
ClickMouse(x,y,False);
Wait(Random(1000));
Wait(Random(1000));
Wait(500);
MoveWindMouse(x,y+44,Random(6),Random(6));
Wait(Random(1000));
Wait(Random(1000));
Wait(Random(1000));
Wait(500);
GetMousePos(x,y);
ClickMouse(x,y,True);
repeat
BankTrue;
until true;
Wait(Random(1000));
Wait(500);
MoveWindMouse(398,306,Random(7),Random(7));
GetMousePos(x,y);
Wait(Random(1000));
Wait(500);
ClickMouse(x,y,True);
Wait(Random(1000));
Wait(500);
end;
//-------------------------//
procedure ChangePos;
begin
MoveWindMouse(157,167,Random(10),Random(10));
Wait(Random(1000));
Wait(500);
GetMousePos(x,y);
ClickMouse(x,y,True);
end;
//-------------------------//
procedure OpenBank;
begin
If FindColor(x,y,BankColor,114,58,239,271)=False then
ChangePos;
Wait(1000);
Wait(Random(1000));
end;
//-------------------------//
procedure GetRaw;
begin
MoveWindMouse(53,104,Random(10),Random(10));
Wait(500);
Wait(Random(1000));
GetMousePos(x,y);
ClickMouse(x,y,False);
Wait(500);
Wait(Random(1000));
MoveWindMouse(x,y+108,Random(6),Random(6));
Wait(500);
Wait(Random(1000));
GetMousePos(x,y);
ClickMouse(x,y,True);
end;
//-------------------------//
procedure CloseBank;
begin
MoveWindMouse(488,33,Random(5),Random(5));
Wait(Random(1000));
Wait(600);
GetMousePos(x,y);
ClickMouse(x,y,True);
end;
//-------------------------//
procedure ToStove;
begin
FindColor(x,y,PanColor,564,14,684,147);
MoveWindMouse(x+Random(5),y+Random(10),Random(5),Random(5));
Wait(500);
Wait(Random(1000));
GetMousePos(x,y);
ClickMouse(x,y,True);
end;
//-------------------------//
procedure StartFire;
begin
MoveWindMouse(581,227,Random(7),Random(7));
Wait(500);
Wait(Random(1000));
GetMousePos(x,y);
ClickMouse(x,y,True);
FindColor(x,y,StoveColor,21,112,146,239);
Wait(500);
Wait(Random(1000));
MoveWindMouse(x,y,Random(5),Random(5));
GetMousePos(x,y);
Wait(500);
Wait(Random(1000));
ClickMouse(x,y,True);
Repeat
if (FindColor(x,y,ChoiceColor,380,420,395,435)=False) THEN
Wait(100);
until (FindColor(x,y,ChoiceColor,380,420,395,435));
MoveWindMouse(263,420,Random(20),Random(20));
GetMousePos(x,y);
Wait(500);
Wait(Random(1000));
ClickMouse(x,y,True);
end;
//-------------------------//
procedure WaitFinish;
begin
Repeat
Wait(Random(1000));
Wait(100);
until (FindColor(x,y,CookedCOlor,691,435,715,453)=True);
end;
//-------------------------//
procedure GoBack;
begin
FindColor(x,y,BankIcon,590,112,640,160);
MoveWindMouse(x,y,Random(5),Random(5));
GetMousePos(x,y);
Wait(500);
Wait(Random(1000));
ClickMouse(x,y,True);
end;
//-------------------------//
procedure Cycle;
begin
DeclareColors;
OpenBank;
Bankk;
GetRaw;
CloseBank;
Wait(Random(1000));
Wait(500);
ToStove;
Wait(10000);
Wait(Random(2000));
StartFire;
WaitFinish;
GoBack;
Wait(10000);
Wait(Random(2000));
end;
{//-------------------------//
procedure
begin
end;
{//-------------------------//
procedure
begin
end;
//-------------------------//   }
begin
Repeat
Cycle;
until false;
end.

Edited by Freddy
Additional Information
Link to comment
Share on other sites

Nice work, been ags since I've seen a script that didn't use any includes :D

Simply because I don't know how to use them yet haha

I prefer not to use others' work when learning to script so I can learn everything myself (:

 

Greetings, Jojo

 

P.S.: Hey you're the owner and creator of Scar! And hey you're also Belgian! :D

Link to comment
Share on other sites

Simply because I don't know how to use them yet haha

I prefer not to use others' work when learning to script so I can learn everything myself (:

 

Greetings, Jojo

 

P.S.: Hey you're the owner and creator of Scar! And hey you're also Belgian! :D

Well, that is the best way to learn :)

I didn't create SCAR originally, only every version from 3.00 and up, but yeah, I'm Belgian :P

Link to comment
Share on other sites

Cool to see someone actually trying to write scripts this early on.

 

Unfortunately the techniques you are using are very robot like and not humanlike. Clickmouse clicks the mouse at super human speeds. Jagex probably can detect that and ban you eventually.

 

There's nothing wrong at all with using the functions I have for you in OSI to make your scripts not be bannable or better, in fact that is the whole purpose of OSI and this community.

 

I will show you an OSI version of your script shortly so you can learn even more.

 

Edit:

 

program Cooker;

{$DEFINE RS2}
{$DEFINE OSI_Color_Anti_Randoms}
//{$DEFINE SMART}                   // Comment out to disable SMART

{.include OSI\OSI.scar}

const
 BankColor = 10012657;    //Color of Bank Booth
 CookedColor = 1596086;   //Color of Cooked Lobster
 RawLobColor = 2046567;   //Color of Raw Lobster
 PanColor = 1194595;      //Color of Pan on mini-map
 StoveColor = 925118;     //Color of the red flames out of the stove
 ChairColor = 1328747;    //Color of the chair left of the most left bank booth
 BankIcon = 806245;       //Color of the $ sign on the mini-map
 ChoiceColor = 4345687;   //Color of the 'Cook All' select menu (right side of button)

procedure DeclarePlayers;
var
 I: LongInt;
begin
 SetLength(Players, 1); // Adjust length to add more players

 with Players[0] do
 begin
   Name := '';                    // Characters full RS login username.
   Pass := '';                    // Characters RS password.
   LampSkill := 'Cooking';        // Skill to choose for genie lamp
   WorldInfo := [False, False];   // Either [Memebers, PVP] for random world or [Members, WorldNumber, PVP]
   Active := True;                // Use player?
 end;

 //<-- To use more players, uncomment this section and change HowManyPlayers
 //to match with the current amount of players declared.

{
 with Players[1] do
 begin
   Name := '';                    // Characters full RS login username.
   Pass := '';                    // Characters RS password.
   LampSkill := 'Cooking';        // Skill to choose for genie lamp
   WorldInfo := [False, False];   // Either [Memebers, PVP] for random world or [Members, WorldNumber, PVP]
   Active := True;                // Use player?
 end;
}
{
 with Players[2] do
 begin
   Name := '';                    // Characters full RS login username.
   Pass := '';                    // Characters RS password.
   LampSkill := 'Cooking';        // Skill to choose for genie lamp
   WorldInfo := [False, False];   // Either [Memebers, PVP] for random world or [Members, WorldNumber, PVP]
   Active := True;                // Use player?
 end;
}
{
 with Players[3] do
 begin
   Name := '';                    // Characters full RS login username.
   Pass := '';                    // Characters RS password.
   LampSkill := 'Cooking';        // Skill to choose for genie lamp
   WorldInfo := [False, False];   // Either [Memebers, PVP] for random world or [Members, WorldNumber, PVP]
   Active := True;                // Use player?
 end;
}
{
 with Players[4] do
 begin
   Name := '';                    // Characters full RS login username.
   Pass := '';                    // Characters RS password.
   LampSkill := 'Cooking';        // Skill to choose for genie lamp
   WorldInfo := [False, False];   // Either [Memebers, PVP] for random world or [Members, WorldNumber, PVP]
   Active := True;                // Use player?
 end;
}

 for I := 0 to High(Players) do
 begin
   //SetLength(Players[i].Integers, 11);       // Don't edit this.
   Players[i].Loc := 'Not yet started autoing.';
 end;

end;

procedure ScriptTerminate;
begin
 FreeOSI;
end;

function FindBank(var X, Y: Integer): Boolean;
begin
 Result := FindMMColorTolerance(X, Y, 2765112, 0);
end;

procedure DoBank;
var
 X, Y: Integer;
begin
 WaitRR(1500, 2000);
 if (FindBank(X, Y)) then
   Mouse(X, Y, 5, 5, True);
 WaitRR(1000, 2000);   // Replace with Flag; when OSI has it ready
end;

begin
 SetUpOSI;
 repeat     // Player loop
   if (AllPlayersInActive) then
     Break;
   if (Players[CurrentPlayer].Active) then
     Login;
   repeat  // Autoing loop
     //Cook;
     Bank;
   until (False);
 until (False);
end.

 

Obviously this won't compile, and it's not your whole script but if you look at it you can learn

 

Use Mouse not ClickMouse

Use FindMMColorTolerance

Use local vairables and constants instead of global variables unless necessary

SMART optional, use OSI's declare player template and Login functions with player loops

OSI RR (Randomrange) variance waits

Flag instead of arbitrary wait guessing.

 

This may seem intimidating now but it really isn't hard at all, it's quite fundamental and some of the most important stuff to learn in your entire scripting career.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...