PDA

View Full Version : A cow killer and hide banker



Squirrel
05-10-2007, 04:15 AM
My cow killer and hide banker.
It works reasonably well. It (usually) makes it to the cow field and back to the bank, but it doesn't always know when you're fighting a cow already and it doesn't always pick up your hides. Possible bug with PopUp maybe? It only picks up the hides of the "PopUp screen thing" is not shifted up for whatever reason i.e. the hide is located near the bottom of the screen. I took out "find fight" in the FindFastRandoms because it kept giving false positives.

All my own script, except for the FindFastRandoms. I used mostly tutorials, looking at other scripts to see how certain things are done, and the SRL Manual to put it together. Although the other cow killer hide banker in the Fighting section gave me the idea to use an array for the cow colors. :)
EDIT: Added the code to my post 'cause everyone else in this forum does it too

{
To use it, just fill in the player array. The consts don't need to be
changed, as they seemed to work fine for me all the time, but use common
sense with them. If it doen't work, something's probably wrong with
the consts. I'm not entirely sure if the multiplayer works, having
only one account to test this with that won't get owned by the cows,
but it should work. Have fun!
}


program New;
{.include srl/srl.scar}
{.include srl/srl/skill/fighting.scar}
{.include srl/srl/extended/xObject.scar}
var Road, cx, cy, Banked, TripNo, StrGained, AtkGained, DefGained,
HpGained, HP, STR, ATK, DEF, HP1, STR1, ATK1, DEF1: integer;
var
CowColors: Array[0..4] of integer;
const
HideColor=11316663;//color of the cowhide on the ground
Trips=10; //how many trips to do
FightingStyle=2; //1 attack, 2 strength, 4 defence
RareTreesColor=168729;//minimap symbol
{--------------Player-Setup---------------}
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //Number of players
NumberOfPlayers(HowManyPlayers)
CurrentPlayer:= 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active :=True;
Players[0].Loc :='Bank'

NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);

CowColors[0]:=3821399; //color of the cow (try to pick a brownish color)
CowColors[1]:=1915460; //darker brown
CowColors[2]:=7371917; //beigeish
CowColors[3]:=3621203; //brownish again
CowColors[4]:=7042694; //beigeish
end;
{---------------------------------------------------------------}
{----------------I-think-everyone-knows-what-this-is------------}
function FindFastRandoms: Boolean; //Yoink! Got this from the WheatPicker thing.
var i: Integer;
begin
for i:=1 to 10 do
begin
if(not(LoggedIn))then Exit;
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Players[CurrentPlayer].Active := False;
Logout;
Exit;
end;
end;
8: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Players[CurrentPlayer].Active := False;
Logout;
Exit;
end;
end;
9: if FindTalk then
Result := True;

end;
wait(1);
end;
end;
{---------------------------------------------}
{-------------Fally-Bank-To-Cow-Pen-----------}
procedure WalkToFarm;
begin
PerfectNorth;
HighestAngle;
ATK:=GetXP('Attack')
STR:=GetXP('Strength')
DEF:=GetXP('Defence')
HP:=GetXP('Hitpoints')
WriteLn('Starting number '+IntToStr(TripNo+1)+' trip.')
Road:=FindFallyRoadColor
RadialRoadWalk(Road, 251, 243, 50, 2, 0)
Flag
RadialRoadWalk(Road, 170, 185, 66, 0, 1)
Flag
RadialRoadWalk(Road, 175, 185, 55, 0, 0)
Flag
RadialWalkEx(x, y, MMCX, MMCY, RareTreesColor, 5, 100, 140, 57)
Flag
Mouse(695, 119, 4, 4, true)
Flag
if FindObjMultiText(cx, cy, 'pen', 'Open', 'Ope', 5270137, 50)then
Mouse(cx, cy, 5, 5, true) else
Mouse(250,190,5,5,true);
WriteLn('Made it')
TripNo:=TripNo+1
Players[CurrentPlayer].Loc :='Cowfield'
end;
{************************************************* ******************************
procedure RandomMovement;
By: Krazy_Meerkat
Description: Presses random arrow keys and moves the mouse. Able to press 2 keys simultaneously.
I modified it to only press the left and right keys, cause the other keys
messed up my program
************************************************** *****************************}

procedure RandomMovements;
begin
if ((Random(3) + 1) > 1) then
begin
if (Random(2) = 1) then
begin
if (Random(2) = 1) then
begin
KeyDown(VK_RIGHT);
end else
KeyDown(VK_LEFT);
Wait(15 + Random(15));
KeyDown(VK_LEFT);
Wait(15 + Random(15));
KeyUp(VK_RIGHT);
KeyUp(VK_LEFT);
Wait(300 + Random(500));
KeyUp(VK_LEFT);
end else ;
begin
if (Random(2) = 1) then
begin
KeyDown(VK_RIGHT);
end else
KeyDown(VK_LEFT);
Wait(Random(15));
KeyDown(VK_RIGHT);
Wait(300 + Random(500))
KeyUp(VK_RIGHT);
KeyUp(VK_LEFT);
Wait(Random(15));
KeyUp(VK_RIGHT);
end;
end else ;
MMouse((Random(330) + 8), (Random(490) + 8), 3, 3);
end;
{--------------------------------------------------------------------}
{--------------Killing-the-cows-and-reaping-their-hides--------------}
procedure AttackDerCows;
var i: Integer;
begin;
for i:=0 to 4 do
if FindColorAbstract(x, y, CowColors[i], 7, 4, 4, 515, 4, 515, 335, 4, 335)then
begin;
Mouse(x, y, 4, 4, false)
PopUp('ttack')
end;
wait(1000+random(2000))
OutFight;
RandomMovements;
if FindObjFast(cx, cy, 'ake', HideColor,1)then
begin;
Mouse(cx,cy,3,3,false)
PopUp('owhide')
end
FindNormalRandoms;
FindFastRandoms;
if (not(LoggedIn))then NextPlayer(false);
if(FindNewBox)then
SolveBox;
end;
{-------------------------------------------------}
{----------------Back-to-the-bank-----------------}
procedure WalkToBank;
begin;
MakeCompass('N');
Mouse(613, 30, 3, 3, true)
Flag;
if FindObjMultiText(cx, cy, 'pen', 'Open', 'Ope', 5270137, 50)then
begin;
Mouse(cx,cy,5,5,true)
end else
Mouse(250,190,5,5,true);
wait(3000)
RadialWalk(RareTreesColor , 180, 360, 72, 1, 0);
Flag;
Road:=FindRoadColor;
RadialRoadWalk(Road, 285, 265, 47, 0, 0);
Flag;
Road:=FindFallyRoadColor;
RadialRoadWalk(Road, 20, 1, 70, 0, -2);
Flag;
Mouse(650, 20, 3, 3, true);
Flag;
if FindSymbol(x, y, 'bank')then
begin
Mouse(x, y, 3, 3, true)
end
Flag;
MakeCompass('s');
OpenBankGlass('feb', true, true)
DepositAll;
CloseBank;
Banked:=Banked+28;
Players[CurrentPlayer].Loc :='Bank'
ATK1:=GetXP('Attack')
STR1:=GetXP('Strength')
DEF1:=GetXP('Defence')
HP1:=GetXP('Hitpoints')
end;
procedure ReturnGained;
begin;
StrGained:=STR1-STR;
AtkGained:=ATK1-ATK;
DefGained:=DEF1-DEF;
HpGained:=HP1-HP;
end;
{---------Main-Loop---------}
begin;
SetUpSRL;
DeclarePlayers;
ActivateClient;
Wait(1500);
if(not(LoggedIn))then
begin;
WriteLn('Ooops! You weren''t logged on. Logging on!')
LoginPlayer;
end;
SetFightMode(FightingStyle)
repeat WalkToFarm;
repeat AttackDerCows until
InvFull;
WalkToBank;
ReturnGained;
WriteLn('===========PROGRESS REPORT============')
WriteLn('==You have gotten '+IntToStr(Banked)+' cowhides so far==');
WriteLn('==Gained '+IntToStr(AtkGained)+' attack experience==');
WriteLn('==Gained '+IntToStr(StrGained)+' strength experience==');
WriteLn('==Gained '+IntToStr(DefGained)+' defence experience==');
WriteLn('==Gained '+IntToStr(HpGained)+' hitpoints experience==');
WriteLn('======================================');
until
TripNo = Trips;
end.

me_ntal
05-10-2007, 04:39 AM
Dude you might wanna remove your information out of the script

Ill pm u your new pw, but i think somebody already has got your account

Squirrel
05-10-2007, 08:40 AM
Well thanks anyway. Damn I'm stupid.
EDIT: Hurrah!! You were the first! I still have my account. Thank you a whole bunch.

mamoth95
05-17-2007, 12:59 AM
lol u got lucky ....be more carful

^dont know how to spell

Sp0rky
05-17-2007, 03:26 AM
Looks v. good for a first script.

Nice one. I'd like to see a progress report added ^_^

Rune Hacker
05-17-2007, 03:42 AM
Looks good, just 2 things i noticed:

You should really have failsafes incase it doesnt find a symbol or incase it gets lost, failsafes are what makes a script good i believe.

And you should make the progress report its own procedure, but i dont think that really matters.

Looks really good for a first script, keep up the good work.

Sp0rky
05-17-2007, 03:45 AM
Ahhh, didnt see that little progress report there in the main loop. Lurking at the bottom. Hiding from me.

Squirrel
05-19-2007, 02:33 AM
Cool, thanks. I'll add in some failsafes next.

zaniar
06-01-2007, 05:19 AM
i think there's a little problem with the cowhide picker...uper...

well the color of the text "walk here" usually found at left-top corner of the rs screen is also white... so the mouse goes to it right clicks it and presses cancel.

add some failsafes ;)

RudeBoiAlex
06-02-2007, 06:47 PM
i like it for a first sript u know radialwalk :) very good

1337Lucius
06-04-2007, 07:30 PM
Wow. Looks extremely nice for a first script O.O

Especially the use of radialwalk's really nice. I haven't really got the hang of it myself yet though :( Still learning and trying to come up with something original ^^;;

Keep up the good work!

-Lucius

Squirrel
06-04-2007, 10:06 PM
Yeah i dunno how to get the cowhide picker upper to work well. It seems to also like those flowers more than the cowhides as well. Any ideas?

WT-Fakawi
06-04-2007, 10:47 PM
I took this directly from my CowKiller/Hide Banker. Its in Members. You may find some usefull info in there.

//----------------------------------------------------------------------------//

Function PickUpHide: Boolean;
var RX,RY, Dmx, Dmy:integer;
begin
If FawkiDebug then Writeln('PickUpHide');
if (not Loggedin) then Exit;
if FindColoredAreaTolerance(Rx, Ry, 12895692, MSX1, MSY1 + 40, MSX2, MSY2, 9, 10) then //3*3 brown color
begin
MMouse(Rx,Ry,0,0);
GetMousePos(Rx, Ry);
Wait(100);
if FindColorTolerance(Dmx, Dmy, 318168, 42, 8, 120, 21, 50) then // Yellow
begin
if FawkiDebug then Status('Found Yellow UpText');
if IsUpText('A') then
if not InFightAt(Rx, Ry) then
begin
if FawkiDebug then Status('Attack Once');
Mouse(Rx, Ry, 0, 0, True);
FlagFTWait;
FTWait(6);
if InChatMulti('ome','one','els') then Exit;
WaitFight(FightingTime);
Cows := Cows + 1;
Result := True;
Exit;
end
end else
if IsUpTextMulti('owh','one','ak') then
begin
Mouse(Rx,Ry,0,0,False);
ChooseOption3;
if InChatMulti('spac','pace','ful') then begin Status('FULL DETECTED'); Exit; end;
if FawkiDebug then Status('Pick up Hide');
FTWaitAll(1);
Result:=True;
end;
end;
FTWaitAll(1);
FlagFTWait;
end;

//----------------------------------------------------------------------------//
//- Performs FindDeformedBitmapToleranceIn 4 times, with cowhide edgepoints -//
//----------------------------------------------------------------------------//

Function FindBoneHideDeformed:Boolean;
var Dx, Dy, i, BoneHide:integer;
var acc:Extended;
begin
If FawkiDebug then Writeln('FindBoneHideDeformed');
for I := 1 to 4 do
begin
case I of
1: BoneHide := BoneHide1;
2: BoneHide := BoneHide2;
3: BoneHide := BoneHide3;
4: BoneHide := BoneHide4;
end;
if InventoryFull then Exit;
FindDeformedBitmapToleranceIn(BoneHide, Dx, Dy, MSX1, MSY1+40, MSX2, MSY2, 5, 1, True, acc);
if FawkiDebug then Status('acc = ' + FloatToStr(acc));
begin
if (acc >= 0.4) then
begin
if FawkiDebug then Status('Found Deformed');
MMouse(Dx, Dy, 0, 0);
GetMousePos(Dx, Dy);
if IsUpText('A') then
begin
if not InFightAt(Dx, Dy) then
begin
if FawkiDebug then Status('Click Cow');
Mouse(Dx, Dy, 0, 0, True);
FTWaitAll(4);
WaitFight(FightingTime);
Cows := Cows + 1;
Result := True;
Exit;
end
end;
if IsUpText('ke') then
begin
Mouse(Dx, Dy, 0, 0, False);
if FawkiDebug then Status('Pick up Deformed');
ChooseOption3;
FlagFTWait;
end;
end;
end;
FTWaitAll(1);
Result := True;
Break;
end;
end;



These are the Bitmaps

BoneHide1 := BitmapFromString(9, 1, 'C2B9B8C2B9B8C2B9B8D5D0' +
'CFD4CECE978D8CB7ACABBAAFAFB8ADAD'); // long stretched

BoneHide2 := BitmapFromString(3, 3, 'B1A5A55A7B1D5A7B1DB1' +
'A5A55A7B1D5A7B1DAB9F9FB3A8A75A7B1D');// upperright corner

BoneHide3 := BitmapFromString(4, 4, 'z78DA3375B330323230C' +
'5209D0C1C4D1C4D9049FCE28ECE8E068E064E868EA68EA610 1222' +
'0E000011153E'); // upperrightcorner

BoneHide4 := BitmapFromString(3, 4, 'C2B9B9C2B9B95A7B1DBF' +
'B6B6BFB6B65A7B1DCBC4C4CBC4C45A7B1D57771D57771D577 71D'); // lowerright corne


And here is Chooseoption3..... A fun one too :)

{************************************************* ******************************
function ChooseOption3: Boolean;
By: Stupid3ooo modded by WT-Fakawi
Description: Finds Popup menu, then clicks on Hides, Bones, Meat IN THAT ORDER.
************************************************** *****************************}

Function ChooseOption3:Boolean;
var
x1, y1, x2, y2, LeftCorner, RightCorner, Fx, Fy, BitMap, I: Integer;
begin
LeftCorner := BitmapFromString(4, 4, 'z78DA33753135313137C5' +
'411A600064715CEA914500CACE13F0');
RightCorner := BitmapFromString(4, 4, 'z78DA33753135313137' +
'C5200D30002E35F8C501C9C013F0');
if (FindBitmap(LeftCorner, x1, y1)) and (FindBitmap(RightCorner, x2, y2)) then
begin
for I := 1 to 3 do // ALWAYS COWHIDE FIRST!!! :)
begin
if CollectMeat then
begin
case I of
1: BitMap := CowHideText; // Sliced Bitmaps of MenuItemText
2: BitMap := RawBeefText; // Works like a charm
3: BitMap := BonesText;
end;
end
else
begin
case I of
1: BitMap := CowHideText; // Sliced Bitmaps of MenuItemText
2: BitMap := BonesText; // Works like a charm
3: BitMap := RawBeefText;
end;
end

If FindBitMap(BitMap, Fx, Fy) then
begin
Mouse(Fx, Fy, 20, 4, True);
Result := True;
FlagFTWait;
Exit;
end;
end;
if (FindText(Fx, Fy, 'Cancel', upchars, x1, y1, x2, 502)) then
Mouse(Fx + 9, Fy + 3, 2, 2, True);
end;
FreeBitmap(LeftCorner);
FreeBitmap(RightCorner);
end;

photon-man
06-07-2007, 06:37 PM
I am sorry if this is complete flame, But This script sucks so hard, that It wont even let me stop, Ctrl + Alt + S is not working, and never has, so it just moves around the mouse like crazy where I spent 9 minutes just trying to stop the program, resorting to the task manager. This script is more annoying than anything I have ever tested. Again, I am sorry for the flame, but I feel that this script should be trashed.

Markus
06-07-2007, 06:44 PM
I am sorry if this is complete flame, But This script sucks so hard, that It wont even let me stop, Ctrl + Alt + S is not working, and never has, so it just moves around the mouse like crazy where I spent 9 minutes just trying to stop the program, resorting to the task manager. This script is more annoying than anything I have ever tested. Again, I am sorry for the flame, but I feel that this script should be trashed.

Just chill, it is his first script, don't flame him in your first post.
Try crtl-f4 if crtl-alt-s isn't working.

Script looks nice, haven't run it though.
I see you are using Flag, try replacing it with FFlag(0). FFlag has failsafes to prevent it from hanging your script.
And I suggest making it multiplayer and add the failsafes, just in case.

n3ss3s
06-07-2007, 06:51 PM
Photoman, shut up ure first time poster and propably anyways a retard.
AND WOW squirrel, excellent for a first time script.
My first script was like:
program new;
begin
sendkeys('hi');
wait(1000);
end;

Squirrel
06-09-2007, 06:19 AM
Thanks for all the compliments. I wasn't expecting that. Also, thanks for that Fawaki, I'll try those tomorrow. My computer decided to crash a little bit ago, so I gotta fix that up before I can do anything.

Pwnt by Pwnt
06-16-2007, 08:57 PM
hey looks good, but theres like NO failsafes.. add some basic ( yet effective ) ones for walking, like just have it log out and Exit script if it took more then X amount of minutes to get to the place. Otherwise, great first :)

chocobolalista
09-11-2007, 02:31 AM
can somebody tell me how can i fixe this error... always that i try to use this script it always says Unknown identifier 'MouseSpeed' in script D:\edu\SCAR 3.11\includes\srl\srl\core\Setup.scar

legend101zelda
09-23-2007, 09:32 PM
i just recently became a member of srl but ive been looking at codes for awhile and personally this is probally the best first script ive ever seen incredible job

Scottjc16
09-23-2007, 11:26 PM
ooo nice, i might use if u can make a reasonable amount of $$ per hour. Thanks for posting it

omg...
10-16-2007, 01:40 PM
Gonna try it :D, it seems good tho

Zarric Hyunmin
10-18-2007, 04:38 AM
Thanks for the script, now to see if it works...

cocodog13
10-19-2007, 12:17 PM
hey err sorry for this noob question but, i dont have srl/srl/extended/xObject.scar, i dont even have the extended folder, i have srl 4, how come its not there?

catman
10-19-2007, 11:01 PM
waaaaa it didnt work for me:cartman:

pl0xmypl0x
10-20-2007, 03:06 PM
Nice script looks good nice:D

kioti123
10-23-2007, 07:24 PM
I am sorry if this is complete flame, But This script sucks so hard, that It wont even let me stop, Ctrl + Alt + S is not working, and never has, so it just moves around the mouse like crazy where I spent 9 minutes just trying to stop the program, resorting to the task manager. This script is more annoying than anything I have ever tested. Again, I am sorry for the flame, but I feel that this script should be trashed.

No, YOU should be thrashed. This guys script is better than your life, my friend. My first script didn't even work... and it was around 6 lines... Oh, sorry to tell you, but Ctrl+Alt+S barely works on any scripts, I usually have to press it around 3 times for it to stop. My advice for you is to go to a hardware store, pick up some lumber, build a bridge, and get over it.

rs cheata
11-04-2007, 07:35 PM
it didnt start for me

Illkillutill
11-04-2007, 09:42 PM
No, YOU should be thrashed. This guys script is better than your life, my friend. My first script didn't even work... and it was around 6 lines... Oh, sorry to tell you, but Ctrl+Alt+S barely works on any scripts, I usually have to press it around 3 times for it to stop. My advice for you is to go to a hardware store, pick up some lumber, build a bridge, and get over it.

i couldnt say it better myself ;)

and nice script, i myself am still learning the basics to this stuff, and from what i can tell, this script is fantastic for your first :)

guirong13
11-05-2007, 10:48 AM
looks good, but to mods this is a banking script shouldnt it be in srl junior member forums? :P

freedox
11-05-2007, 11:44 AM
How many cowhides does it make per hour?

Jimi_Blue
11-05-2007, 05:44 PM
Very original, going to try as soon as I upload my first script in the next day or two =]

sam the clam
11-05-2007, 07:52 PM
Nice, Just what I've been looking for. I'll try it out as soon as I get on

chip111
11-08-2007, 03:49 PM
looks liekm a good 1 .....ill test it out when i get home and ill comment you with probs/etc.

ZaSz
11-08-2007, 04:07 PM
Looks pretty good ill be sure to post my proggie when i get on my reg. pc

dragonkitty9
11-08-2007, 09:09 PM
Its an okeay script but with failsafes the whole script would be much better.

Shuttleu
11-08-2007, 09:31 PM
just had a quick read and i thought it was quite good for a first script
well done and keep up the good work

sovuf
11-11-2007, 01:40 AM
I got one error.

Include file C:\Program Files\SCAR 3.12\includes\srl\srl\extended\xobject.scar does not exist.
Failed when compiling

The "extended" folder does not exist in my SRL folder. I searched the forums for over 20 minutes and could not find the answer. I have Scar 3.12c and SRL 4

unl
11-11-2007, 02:06 PM
ill try it lol :p
see if it works :)

t3h solja
11-11-2007, 02:56 PM
Mine keeps giving me some sort of error, saying a line is out of place.

I think it was something I caused though, this script looks like it'll work great.

die er
11-20-2007, 07:54 PM
this script isn't working at my computer


Include file C:\Program Files\SCAR 3.12\includes\srl\srl\extended\xObject.scar does not exist.
Failed when compiling

could any one help me plz?

Tampa Fusion
12-28-2007, 10:37 AM
I feel so retarded but i can't get this to work for me. When i try to compile it there is always an error. But im sure its my fault i really dont know what to change and delete out of the script.


There error is on line 14:1 and is something about the "HowManyPlayers" part of it. i don't know what im doing wrong can someone please help? Or post the script in full working condition without unneeded text. I don't know what to add or delete.It seems like it should work fine but
i'm new to scar.

Hobbit
12-29-2007, 01:35 AM
05-09-2007, 09:15 PM

This is an old script which is why it is not working

Closed