Log in

View Full Version : First Script, GuildFishing Took me 4 hours



lolbus
03-04-2012, 05:58 PM
Pretty much follow YoHoJo first scripting guide for powerchopping, heres what I got so far


program LemonGuildFisher;

//{$DEFINE SMART}
//{$i SRL\SRL.scar}
//{$i SRL\SRL\Misc\Stats.simba}
{.include SRL\SRL.simba}
{.Include SRL\SRL\Misc\Debug.simba}

Const
SERVER = 61; // Enter "0" to pick a random server.
MEMBERS = True; // Set to True if using a RS-Members account. False if F2P.
SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers= 1; //How many players are you using
StartPlayer= 0; //Player to start auoting with! (0 means first char)
LoadsPerLogin= 15; //How Many Loads To Do Per Login!
LoadsTotal= 9999; //How Many Total Lods To Do Per Character!
AntiBDrop= True; //False for faster dropping. True for antiban dropping.
DropGems= True; //Drop Gems?(They are useless!)
SleepyWeepie= 7; //Minutes to wait before logging in again.0 = Disabled.
YDebug= True; //Shows whats happening on the runescape screen in a
//debug window, so you dont have to open/close SMART.
Version= '1.0'; //NO TOUCHY!

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
Integers[2] := 4; //Seconds to try mining rock before clicking another.
end;

end;

Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;


Function CheckAndClick(X,Y:Integer):Boolean;
Begin
MMouse(x, y, 5, 5);
{Wait(100 + Random(50));
If CountUpColor('B', 41, 5, 86, 24, 70, 140) Then}
If WaitUpTextMulti(['Mine','ine'], 150) Then
Begin
Result:=True;
GetMousePos(x, y);
Mouse(x, y, 0, 0,True);
Wait(100+Random(50));
FFlag(0);
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Mining', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;







Function FindFish:Boolean;
Var
X, Y: Integer;
Begin
//FindObjCustom(x, y, ['att', 'ack'], [123456, 345678], 5);
if FindObjCustom(X, Y, ['Net', 'Net'], [12104624, 11710122, 10721682], 5) Then
Begin
WriteLn('hooray we found some fish');
GetMousePos(X, Y);
Case Random(2) Of
0: Begin
Mouse(X, Y, 6, 6, False);
Wait(300+Random(100));
ChooseOption('Harpoon');
End;
1: Begin
Mouse(X, Y, 3, 3, False);
Wait(100+Random(100));
ChooseOption('Harpoon');
End;
End;
End;
End;

Begin
SetupSRL;
DeclarePlayers;

//Repeat
if Not isMoving() Then
FindFish
Else
WriteLn('Character is busy');

//Until(false);
WriteLn('end of script');

End.


Currently Im able to detect the fish I want aka shark and harpoons them. However I cant seems to be able find a method that put my script to idle if it detect that my character is already busy fishing, any idea, any methods?

PatDuffy
03-04-2012, 06:02 PM
Wrong section, but good work!

lolbus
03-04-2012, 06:08 PM
thanks, any idea where this goes, i saw other people asking questions here so i post mine too.

PatDuffy
03-04-2012, 06:09 PM
Runescape scripts -> first scripts would probably be a good place

lolbus
03-04-2012, 06:21 PM
Though this is my first script dont think its anywhere near usable yet, anyway any mod can please move to the appropriate place like the first script?

And do you happened to know how do I create some sort of a boolean variable to track if my character is already busy fishing or not?

lolbus
03-04-2012, 08:08 PM
And how do i prevent my simba from crashing resulting in loss of works?

bolshak25
03-04-2012, 09:11 PM
well the way ive implemented waiting is to count inventory items.

Repeat
writeln('Check inv1');
Inv1 := InvCount;
wait(15000 + random(2000));
Writeln('1.5');
If ((InvFull) or (FindNPCChatText('carry',Nothing)) or (InvCount=Inv3)) then
Break;
Inv3 := InvCount;
Antiban2;
wait(15000 + random(2000));
FindNormalRandoms;
writeln('Check inv2');
Inv2 := InvCount;
Until ((Inv2 = Inv1) or (InvFull) or (FindNPCChatText('carry',Nothing)));

Just figure out how long it take to catch them and change those wait times. this currently would exit and id have it reclick after 30 seconds because the 15000 and 15000 makes it about 30 seconds.

lolbus
03-04-2012, 09:28 PM
well the way ive implemented waiting is to count inventory items.

Repeat
writeln('Check inv1');
Inv1 := InvCount;
wait(15000 + random(2000));
Writeln('1.5');
If ((InvFull) or (FindNPCChatText('carry',Nothing)) or (InvCount=Inv3)) then
Break;
Inv3 := InvCount;
Antiban2;
wait(15000 + random(2000));
FindNormalRandoms;
writeln('Check inv2');
Inv2 := InvCount;
Until ((Inv2 = Inv1) or (InvFull) or (FindNPCChatText('carry',Nothing)));

Just figure out how long it take to catch them and change those wait times. this currently would exit and id have it reclick after 30 seconds because the 15000 and 15000 makes it about 30 seconds.

But the point is, sometimes the spawn just disappear out of the sudden. So if I were to just use your method, wait and track my inventory counts changes, then it may end up waiting there forever if the spawn (the npc which I harpoons on) disappear and no changes occur.

In rsbot, what I did was keeping track of my character's animation, so say when hes fishing, he will bend down and when hes idling, a function called getAnimation() will return an integer value of -6 which is kinda impossible for simba? <_<

BTW my banking done, almost everything done now except for antiban and this lousy method. What I does now is, every 20 to 25 sec, it will just keep on a random spawn

bolshak25
03-04-2012, 09:32 PM
But the point is, sometimes the spawn just disappear out of the sudden sometimes. So if I were to just use your method, wait track my inventory counts changes, then it may end up waiting there forever if the spawn (the npc which I harpoons on) disappear and no changes occur.

no, because it repeats until the inv stays the same after 30 seconds, the inventory is full, or it says we cant carry any more fish. It would stop right after the inv stays the same for 30 seconds.

Then right after that code youd probably put
If InvFull Then
Bank

if you wanna see how its implemented in a fishing script look at sin's karajma fisher. thats what i wrote this for and most of the code is in his download version.

Psilocybin
03-04-2012, 11:29 PM
this is how i do it in my yew cutter


Function IsCutting: Boolean;
var
PBox: TBox;
shift: Integer;
begin
If(IsMoving)Then Exit;
PBox := IntToBox(245, 131, 279, 190);
Shift := AveragePixelShift(PBox, 250, 500);
Result := Shift > 350;
writeln('cutting:'+inttostr(shift));
end;
what this function does is it counts pixels color change and determines if you are animating or not its cheap but it works pretty well, heh only fails when other people are behind you and cutting or ur case fishing.
then i run that in a loop with a random wait and checks for randoms + antiban.

illester
03-05-2012, 12:41 AM
Another thing you could do is look through some good fishing scripts and see how this procedure was coded and create your own, or use theirs and give them credit.

iPartyAlone
03-05-2012, 01:03 AM
nice one :p

lolbus
03-05-2012, 05:59 AM
no, because it repeats until the inv stays the same after 30 seconds, the inventory is full, or it says we cant carry any more fish. It would stop right after the inv stays the same for 30 seconds.

Then right after that code youd probably put
If InvFull Then
Bank

if you wanna see how its implemented in a fishing script look at sin's karajma fisher. thats what i wrote this for and most of the code is in his download version.

Seems like yours is the best method, it still daze out for a few seconds once in awhile though..