SRL Archive - First Scripts

Vannilabear's First script


vannilabear

2013-07-26 11:08:40

This is my first ever script, any constructive criticism and/or help would be gladly taken..
The script kills men at edgeville, I later plan on adding a means to loot the unidentified herbs, and bank them. ( Need help doing this )
and adding antibans, antirandoms when I learn how to. ( Also need help doing this )
I owe alot of this work to Le_Don, for his assistance over skype, and putting up with my general lack of simba knowledge.
anyway, without first adieu, Here is my script:

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

{------------------------------------------------------------------------------}
{-----------------------------------CREDITS----------------------------}
{------------------------------------MYSELF--------------------------------------}
{---------------------------LE_DON-FOR-ASSISTANCE-------------------------}
{------------------------------------------------------------------------------}
const
VER = 0.1;
//PLAYER CREDENTIALS
PLAYER_USERNAME = '';
PLAYER_PASSWORD = '';
//COLOR INFORMATION
HPCOLOR = 65280;
MINIMAPITEMCOLOR1 = 3301261; //PLACEHOLDER
MANCOLOR1 = 5400402; //body color man 1
MANCOLOR2 = 4404533; //body color man 2
MANCOLOR3 = 1123909; //body color man 3
MANCOLOR4 = 1720144; //head color man 1
MANCOLOR5 = 1722480; //head color man 2
MANCOLOR6 = 4226955; //head color man 3
BONECOLOR = 11842750; //best with color tolerance 5
//PLAYER INFORMATION
PLAYER_NICK = 'Jay';

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;

procedure Antiban;
begin
case Random(100) of
1: HoverSkill('magic', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

procedure MiniAntiBan; //WE CALL THIS SPECIFICALLY WHILST WAITING FOR MEN TO DIE
var
x, y: integer;
begin
Case Random(20) of
1: BoredHuman;
2: RandomRClick;
3: RandomMovement;
4: SmallRandomMouse;
7: wait(randomrange(1000,2000));
8: begin end;
end;
end;
procedure MiniBreaker;
begin
case Random(160) of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

function InCombat: Boolean;
var
X,Y:Integer;
begin
if (FindColor(x,y,HPCOLOR,200,100,300,200)) then
Result := true
else
Result := false
end;
procedure FindMan;
var
starttime, x, y: integer;
begin
if (not InCombat) then
begin
Writeln('Looking For Man');
if (FindObjCustom(x, y, ['Attack', 'ttack', 'Man','an'], [MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
begin
Writeln('Found Man. Clicking.');
MMouse(x, y, 3, 3);
ClickMouse2(mouse_left);
starttime := getsystemtime;
repeat
Wait(randomrange(300,700));
until (InCombat) or (getsystemtime - starttime > (randomrange(4000, 10000)))
while (InCombat) do MiniAntiBan;
Writeln('We Probably Killed A Man.');
end;
end;
end;

Function CheckLoot:Boolean;
var
X,Y:Integer;
begin
Writeln('[CheckLoot] START');

if FindObjCustom(x,y,['ake','Take', 'erb', 'Herb'],[BONECOLOR], 5) then
begin
Writeln('[CheckLoot] FOUND Herb');
MMouse(x,y, 0, 0);
ClickMouse2(mouse_right);
Wait(RandomRange(150, 300));
ChooseOption('ake');

mmouse(259, 184, 5, 5);

wait(randomRange(1100,1500));

if IsUpTextMultiCustom(['Herb','erb']) then
begin
repeat
Writeln('[CheckLoot] Taking herbs below you');
ClickMouse2(mouse_left);
Wait(RandomRange(150, 300));
until not IsUpTextMultiCustom(['Herb', 'erb']);
end;

wait(200+ random(100));

end;

wait(randomRange(600,900));
Writeln('[CheckLoot] END');
end;


begin //CALL FUNCTION
DeclarePlayers;
SetupSRL;
ActivateClient;
Wait(2000);
LoginPlayer;
repeat
FindMan;
InCombat;
CheckLoot;
Antiban;
MiniBreaker;
Until(False)
end.

masterBB

2013-07-26 12:03:55

Hi, awesome script! Definatly a good first script.

I fixed the standards a bit and it looked like this:

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

{------------------------------------------------------------------------------}
{-----------------------------------CREDITS----------------------------}
{------------------------------------MYSELF--------------------------------------}
{---------------------------LE_DON-FOR-ASSISTANCE-------------------------}
{------------------------------------------------------------------------------}
const
VER = 0.1;
//PLAYER CREDENTIALS
PLAYER_USERNAME = '';
PLAYER_PASSWORD = '';
//COLOR INFORMATION
HPCOLOR = 65280;
MINIMAPITEMCOLOR1 = 3301261; //PLACEHOLDER
MANCOLOR1 = 5400402; //body color man 1
MANCOLOR2 = 4404533; //body color man 2
MANCOLOR3 = 1123909; //body color man 3
MANCOLOR4 = 1720144; //head color man 1
MANCOLOR5 = 1722480; //head color man 2
MANCOLOR6 = 4226955; //head color man 3
//PLAYER INFORMATION
PLAYER_NICK = '';

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;

function InCombat: Boolean;
var
X,Y:Integer;
begin
Result := FindColor(x,y,HPCOLOR,200,100,300,200);
end;

procedure FindMan;
var
X,Y:Integer;
begin
if (FindObjCustom(x,y, ['Attack','ttack','Man','an'],[MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
ClickMouse2(mouse_left);

while (InCombat) do
wait(randomrange(1000,2000));
end;

begin //CALL FUNCTION
DeclarePlayers;
SetupSRL;
ActivateClient;
Wait(2000);
LoginPlayer;

repeat
FindMan;
until(False)
end.

note: If you don't like the removal of some begin and end statements, that is optional.

I think the next step is some anti ban and removal of the infinity loops. With infinity loops I mean you repeat from the mainLoop and the while loop from the fight function. Here is a list of challenges for you:

Can you think of a way using MarkTime and GetMarkFromTime to make sure the while loop can't last way too long(if inCombat breaks for example).

Can you think of a way using some point on the map (like a symbol), or maybe if it couldn't find a man for a certain amount of time, that it stops the script?

Can you add anti randoms or anti ban?

Can you output an awesome proggy how many man this script has killed?


Good job overal, I love reading first scripts.

vannilabear

2013-07-26 12:11:01

From: masterBB
Hi, awesome script! Definatly a good first script.

I fixed the standards a bit and it looked like this:

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

{------------------------------------------------------------------------------}
{-----------------------------------CREDITS----------------------------}
{------------------------------------MYSELF--------------------------------------}
{---------------------------LE_DON-FOR-ASSISTANCE-------------------------}
{------------------------------------------------------------------------------}
const
VER = 0.1;
//PLAYER CREDENTIALS
PLAYER_USERNAME = '';
PLAYER_PASSWORD = '';
//COLOR INFORMATION
HPCOLOR = 65280;
MINIMAPITEMCOLOR1 = 3301261; //PLACEHOLDER
MANCOLOR1 = 5400402; //body color man 1
MANCOLOR2 = 4404533; //body color man 2
MANCOLOR3 = 1123909; //body color man 3
MANCOLOR4 = 1720144; //head color man 1
MANCOLOR5 = 1722480; //head color man 2
MANCOLOR6 = 4226955; //head color man 3
//PLAYER INFORMATION
PLAYER_NICK = '';

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;

function InCombat: Boolean;
var
X,Y:Integer;
begin
Result := FindColor(x,y,HPCOLOR,200,100,300,200);
end;

procedure FindMan;
var
X,Y:Integer;
begin
if (FindObjCustom(x,y, ['Attack','ttack','Man','an'],[MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
ClickMouse2(mouse_left);

while (InCombat) do
wait(randomrange(1000,2000));
end;

begin //CALL FUNCTION
DeclarePlayers;
SetupSRL;
ActivateClient;
Wait(2000);
LoginPlayer;

repeat
FindMan;
until(False)
end.

note: If you don't like the removal of some begin and end statements, that is optional.

I think the next step is some anti ban and removal of the infinity loops. With infinity loops I mean you repeat from the mainLoop and the while loop from the fight function. Here is a list of challenges for you:

Can you think of a way using MarkTime and GetMarkFromTime to make sure the while loop can't last way too long(if inCombat breaks for example).

Can you think of a way using some point on the map (like a symbol), or maybe if it couldn't find a man for a certain amount of time, that it stops the script?

Can you add anti randoms or anti ban?

Can you output an awesome proggy how many man this script has killed?


Good job overal, I love reading first scripts.


I am currently working on making it loot correctly, I have already added antibans, and minibreaks, and they both work fine, but it is currently looting everything it can find..
Thanks for the compliments on the first script, it means alot!
I will add a proggy, as that is a good idea, as for the rest, I will try!
Cheers for the reply. :)

Rich

2013-07-26 12:15:51

From: vannilabear
I am currently working on making it loot correctly, I have already added antibans, and minibreaks, and they both work fine, but it is currently looting everything it can find..
Thanks for the compliments on the first script, it means alot!
I will add a proggy, as that is a good idea, as for the rest, I will try!
Cheers for the reply. :)
If you're struggling to get it to loot properly, if you want to show us the code you've hopefully we can point you in the right direction :)

vannilabear

2013-07-26 12:19:45

From: Rich
If you're struggling to get it to loot properly, if you want to show us the code you've hopefully we can point you in the right direction :)


Editing original post now :)

Le_don

2013-07-26 12:43:28

Here - Now it only loots herbs:

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

{------------------------------------------------------------------------------}
{-----------------------------------CREDITS----------------------------}
{------------------------------------MYSELF--------------------------------------}
{---------------------------LE_DON-FOR-ASSISTANCE-------------------------}
{------------------------------------------------------------------------------}
const
VER = 0.1;
//PLAYER CREDENTIALS
PLAYER_USERNAME = '';
PLAYER_PASSWORD = '';
//COLOR INFORMATION
HPCOLOR = 65280;
MINIMAPITEMCOLOR1 = 3301261; //PLACEHOLDER
MANCOLOR1 = 5400402; //body color man 1
MANCOLOR2 = 4404533; //body color man 2
MANCOLOR3 = 1123909; //body color man 3
MANCOLOR4 = 1720144; //head color man 1
MANCOLOR5 = 1722480; //head color man 2
MANCOLOR6 = 4226955; //head color man 3
BONECOLOR = 11842750; //best with color tolerance 5
//PLAYER INFORMATION
PLAYER_NICK = 'Jay';

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;

procedure Antiban;
begin
case Random(100) of
1: HoverSkill('magic', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

procedure MiniAntiBan; //WE CALL THIS SPECIFICALLY WHILST WAITING FOR MEN TO DIE
var
x, y: integer;
begin
Case Random(20) of
1: BoredHuman;
2: RandomRClick;
3: RandomMovement;
4: SmallRandomMouse;
7: wait(randomrange(1000,2000));
8: begin end;
end;
end;
procedure MiniBreaker;
begin
case Random(160) of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

function InCombat: Boolean;
var
X,Y:Integer;
begin
if (FindColor(x,y,HPCOLOR,200,100,300,200)) then
Result := true
else
Result := false
end;
procedure FindMan;
var
starttime, x, y: integer;
begin
if (not InCombat) then
begin
Writeln('Looking For Man');
if (FindObjCustom(x, y, ['Attack', 'ttack', 'Man','an'], [MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
begin
Writeln('Found Man. Clicking.');
MMouse(x, y, 3, 3);
ClickMouse2(mouse_left);
starttime := getsystemtime;
repeat
Wait(randomrange(300,700));
until (InCombat) or (getsystemtime - starttime > (randomrange(4000, 10000)))
while (InCombat) do MiniAntiBan;
Writeln('We Probably Killed A Man.');
end;
end;
end;

Function CheckLoot:Boolean;
var
X,Y:Integer;
begin
Writeln('[CheckLoot] START');

if FindObjCustom(x,y,['ake','Take'],[BONECOLOR], 5) then
begin
Writeln('Found loot - checking for herb');
MMouse(x,y, 0, 0);
ClickMouse2(mouse_right);
Wait(RandomRange(150, 300));
ChooseOptionMulti(['erb', 'herb', 'Herb']);

mmouse(259, 184, 5, 5);

wait(randomRange(1100,1500));

if IsUpTextMultiCustom(['Herb','erb']) then
begin
repeat
Writeln('[CheckLoot] Taking herbs below you');
ClickMouse2(mouse_left);
Wait(RandomRange(150, 300));
until not IsUpTextMultiCustom(['Herb', 'erb']);
end;

wait(200+ random(100));

end;

wait(randomRange(600,900));
Writeln('[CheckLoot] END');
end;


begin //CALL FUNCTION
DeclarePlayers;
SetupSRL;
ActivateClient;
Wait(2000);
LoginPlayer;
repeat
FindMan;
InCombat;
CheckLoot;
Antiban;
MiniBreaker;
Until(False)
end.

vannilabear

2013-07-26 12:54:41

From: Le_don
Here - Now it only loots herbs:

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

{------------------------------------------------------------------------------}
{-----------------------------------CREDITS----------------------------}
{------------------------------------MYSELF--------------------------------------}
{---------------------------LE_DON-FOR-ASSISTANCE-------------------------}
{------------------------------------------------------------------------------}
const
VER = 0.1;
//PLAYER CREDENTIALS
PLAYER_USERNAME = '';
PLAYER_PASSWORD = '';
//COLOR INFORMATION
HPCOLOR = 65280;
MINIMAPITEMCOLOR1 = 3301261; //PLACEHOLDER
MANCOLOR1 = 5400402; //body color man 1
MANCOLOR2 = 4404533; //body color man 2
MANCOLOR3 = 1123909; //body color man 3
MANCOLOR4 = 1720144; //head color man 1
MANCOLOR5 = 1722480; //head color man 2
MANCOLOR6 = 4226955; //head color man 3
BONECOLOR = 11842750; //best with color tolerance 5
//PLAYER INFORMATION
PLAYER_NICK = 'Jay';

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;

procedure Antiban;
begin
case Random(100) of
1: HoverSkill('magic', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

procedure MiniAntiBan; //WE CALL THIS SPECIFICALLY WHILST WAITING FOR MEN TO DIE
var
x, y: integer;
begin
Case Random(20) of
1: BoredHuman;
2: RandomRClick;
3: RandomMovement;
4: SmallRandomMouse;
7: wait(randomrange(1000,2000));
8: begin end;
end;
end;
procedure MiniBreaker;
begin
case Random(160) of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

function InCombat: Boolean;
var
X,Y:Integer;
begin
if (FindColor(x,y,HPCOLOR,200,100,300,200)) then
Result := true
else
Result := false
end;
procedure FindMan;
var
starttime, x, y: integer;
begin
if (not InCombat) then
begin
Writeln('Looking For Man');
if (FindObjCustom(x, y, ['Attack', 'ttack', 'Man','an'], [MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
begin
Writeln('Found Man. Clicking.');
MMouse(x, y, 3, 3);
ClickMouse2(mouse_left);
starttime := getsystemtime;
repeat
Wait(randomrange(300,700));
until (InCombat) or (getsystemtime - starttime > (randomrange(4000, 10000)))
while (InCombat) do MiniAntiBan;
Writeln('We Probably Killed A Man.');
end;
end;
end;

Function CheckLoot:Boolean;
var
X,Y:Integer;
begin
Writeln('[CheckLoot] START');

if FindObjCustom(x,y,['ake','Take'],[BONECOLOR], 5) then
begin
Writeln('Found loot - checking for herb');
MMouse(x,y, 0, 0);
ClickMouse2(mouse_right);
Wait(RandomRange(150, 300));
ChooseOptionMulti(['erb', 'herb', 'Herb']);

mmouse(259, 184, 5, 5);

wait(randomRange(1100,1500));

if IsUpTextMultiCustom(['Herb','erb']) then
begin
repeat
Writeln('[CheckLoot] Taking herbs below you');
ClickMouse2(mouse_left);
Wait(RandomRange(150, 300));
until not IsUpTextMultiCustom(['Herb', 'erb']);
end;

wait(200+ random(100));

end;

wait(randomRange(600,900));
Writeln('[CheckLoot] END');
end;


begin //CALL FUNCTION
DeclarePlayers;
SetupSRL;
ActivateClient;
Wait(2000);
LoginPlayer;
repeat
FindMan;
InCombat;
CheckLoot;
Antiban;
MiniBreaker;
Until(False)
end.


Cheers Le_Don, that works for looting! :) +1

Le_don

2013-07-26 13:02:20

procedure FindMan;
var
starttime, x, y: integer;
begin
if (not InCombat) then
begin
Writeln('Looking For Man');
if (FindObjCustom(x, y, ['Attack', 'ttack', 'Man','an'], [MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
begin
Writeln('Found Man. Clicking.');
MMouse(x, y, 3, 3);
ClickMouse2(mouse_left);
starttime := getsystemtime;
repeat
Wait(randomrange(300,700));
until (InCombat) or (getsystemtime - starttime > (randomrange(4000, 10000)))
while (InCombat) do MiniAntiBan;
Writeln('We Probably Killed A Man.');
end;
end;
end;

Looks a lot like my monk killer :spot:

vannilabear

2013-07-26 13:03:29

From: Le_don
procedure FindMan;
var
starttime, x, y: integer;
begin
if (not InCombat) then
begin
Writeln('Looking For Man');
if (FindObjCustom(x, y, ['Attack', 'ttack', 'Man','an'], [MANCOLOR1, MANCOLOR2, MANCOLOR3, MANCOLOR4, MANCOLOR5, MANCOLOR6], 10)) then
begin
Writeln('Found Man. Clicking.');
MMouse(x, y, 3, 3);
ClickMouse2(mouse_left);
starttime := getsystemtime;
repeat
Wait(randomrange(300,700));
until (InCombat) or (getsystemtime - starttime > (randomrange(4000, 10000)))
while (InCombat) do MiniAntiBan;
Writeln('We Probably Killed A Man.');
end;
end;
end;

Looks a lot like my monk killer :spot:


That'll be because you're the one helping me script…

Le_don

2013-07-26 13:04:09

From: vannilabear
That'll be because you're the one helping me script…


Indeed

vannilabear

2013-07-26 13:49:57

Currently trying to add a way of banking through DDTM walking. /headhurts

Le_don

2013-07-27 14:53:39

From: vannilabear
Currently trying to add a way of banking through DDTM walking. /headhurts


Try using

MakeCompass('N');

And then click in certain places on the minimap for EXTREMELY BASIC walking.

Sk1nyNerd

2013-08-04 22:50:13

From: vannilabear
Currently trying to add a way of banking through DDTM walking. /headhurts


check out this guide :)

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