SRL Archive - OSR Help

Old 'SaikekChickens' fixed and updated, but need some help


matthew1993

2014-12-06 17:10:13

In lack of scripts I started to hack some scripts together, and try to make the best of it. So far so good. Still using some old methods. Can I get some feedback on this? I think the anti-ban is kinda bad and so is the finding of chickens, but like I said, in lack of better it seems to work. But still needs some work. Anyone got some tips?

I works on the Unusual Chickens in Lumby.

I'm looking to turn this into an effective Combat exp script for low combat accounts. Without feather pickup support since that became easy to buy anyway nows.
I've been out of SRL for a while so any tips and pointers are nice.

Script originally taken from: https://villavu.com/forum/showthread.php?t=100028

program SaikekChickens;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}


var
GFailSafe: Integer;
const
//Begin User-config
PLAYER_USERNAME ='LOGIN HERE';
PLAYER_PASSWORD ='PASSWORD HERE';
PLAYER_NICK = 'NICKNAME HERE'; //THIS MUST BE SET OR SCRIPT WILL CRASH!
PICKUP_FEATHERS = False;
//End User-config
HPCOLOUR = 65280;
//CHICKENCOLOUR1 = 1682130;
//CHICKENCOLOUR2 = 1056403;
//CHICKENCOLOUR3 = 1122202;
//CHICKENCOLOUR4 = 5360868;

CHICKENCOLOUR1 = 3166313;
CHICKENCOLOUR2 = 3892354;
CHICKENCOLOUR3 = 3364463;
CHICKENCOLOUR4 = 4632772;
FEATHERCOLOUR2 = 9472;
GFAILSAFE_THRESHOLD = 25;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
Players[0].Name := PLAYER_USERNAME;
Players[0].Pass := PLAYER_PASSWORD;
Players[0].Nick := PLAYER_NICK;
Players[0].Active := True;
end;

//Simple function which checks for HPCOLOUR in a defined area.
//May bug out when multiple players are in area.
function InCombat: Boolean;
var x, y: Integer;
begin
if(FindColor(x, y, HPCOLOUR, 200, 100, 300, 200)) then
Result := true
else
Result := false
end;

//Searches for and attacks seagull, easy enough? Searches for GULLCOLOUR1 and GULLCOLOUR2
//Provides for two failsafes when searching and waiting on combat to begin.
procedure AttackChicken;
var x, y, failsafe: Integer;
begin
if(not InCombat) then
begin
if(FindObjCustom(x, y, ['Attack', 'Unusual', 'Chicken'], [CHICKENCOLOUR1, CHICKENCOLOUR2, CHICKENCOLOUR3, CHICKENCOLOUR4], 7)) then

begin
GFailSafe := 0;
MMouse(x, y, 3, 3);
ClickMouse2(mouse_left);
repeat
wait(randomrange(300,800));
inc(failsafe);
until((InCombat) or (failsafe >= 5));
end else
begin
writeln('No Chickens found. Rotating camera.');
MakeCompass(randomrange(0,360));
inc(GFailSafe);
wait(randomrange(200,800));
end;
end;
end;

procedure CheckLoot;
var x, y: Integer;
begin
if((not InCombat) and (PICKUP_FEATHERS)) then
begin
if(FindObjCustom(x, y, ['eather'], [FEATHERCOLOUR2], 3)) then
begin
Mousebox(x, y, x, y, mouse_left);
wait(randomrange(1000,1500));
end;
end;
end;

//Gets our current in-game state.
function GetState: Integer;
begin
if (GFailSafe >= GFAILSAFE_THRESHOLD) then
Result := 3
else if(not LoggedIn) then
Result := 2
else if(InCombat) then
Result := 1
else if(not InCombat) then
Result := 0
end;

//Sets camera angle to maximum and sets auto-retaliate.
procedure Setup;
var x, y: Integer;
begin
KeyDown(VK_UP);
wait(randomrange(1500,2500));
KeyUp(VK_UP);
//Retaliate(true);
wait(randomrange(300,500));
MakeCompass('N');
end;

function RandomCombatSkill : String;
var ran: Integer;
begin
ran := randomrange(0,4);
case(ran) of
0:
Result := 'Attack';
1:
Result := 'Strength';
2:
Result := 'Defence';
3:
Result := 'Hitpoints';
4:
Result := 'Ranged';
end;
end;

//Our quick and simple anti-ban. Could use some work.
procedure AntiBan;
var ran1, ran2: Integer;
begin
ran1 := random(900);
if(ran1 <= 5) then
begin
SetRun(True);
writeln('Anti-Ban Engaged.');
ran2 := random(10);
case(ran2) of
1: BoredHuman;
2: RandomRClick;
3: wait(1500 + randomrange(1000,3000));
4: BoredHuman;
5: PickUpMouse;
6: wait(1500 + randomrange(1000,3000));
7: RandomRClick;
8: HoverSkill(RandomCombatSkill, false);
9: HoverSkill(RandomCombatSkill, false);
end;
wait(randomrange(500,1000));
end;
end;

begin
DeclarePlayers;
SetupSRL;
SetScreenName(Players[0].Nick);
ActivateClient;
wait(1000);
if(LoggedIn) then
Setup;
while(GFailSafe < GFAILSAFE_THRESHOLD) do
begin
case (GetState) of
0:
begin
if(not InCombat) then
FindNormalRandoms;
if(PICKUP_FEATHERS) then
CheckLoot;
AttackChicken;
wait(randomrange(500,1000));
end;
1:
begin
AntiBan;
wait(randomrange(50,200));
end;
2:
begin
LoginPlayer;
wait(randomrange(300,800));
Setup;
end;
3:
begin
break;
end;
end;
end;
writeln('FailSafe initiated! Possibly stuck or in random? Terminating script.');
TerminateScript;
end.

levunit

2014-12-07 01:32:19

Heya! You could look into TPAs for finding the chickens and feathers(could always keep feather finding in the script because it's optional). You can also use pixelshift in the incombat function to make it more reliable. There's some tutorials in the help section, or you can PM me if you need help with something. Cheers

King

2014-12-09 11:34:43

Honestly, I would be very careful about releasing someone else script, have you contacted him to make sure that it is okay?

As for the script, the best way to find the chickens in OSRS would be using TPA color finding in combination with Uptext.

Here are some good tutorials

https://villavu.com/forum/showthread.php?t=49067

http://villavu.com/forum/showthread.php?t=58300

http://villavu.com/forum/showthread.php?t=33111