SRL Archive - SRL Archives

Cheesehunk's Procedures+Functions


Cheesehunk

2006-05-19 22:11:06

Current Procedures:7
Current Functions:1
Already added to SRL:1 (RemainItems, and BoredWhileFlagExists will be in the next version of SRL I think.)

SetMouseSpeedEvery(Seconds : Integer; Speed, Rand : Integer);

{*******************************************************************************
procedure SetMouseSpeedEvery(Seconds : Integer; Speed, Rand : Integer);
By: Cheesehunk, Pimped by BebeMyCat2.
Description: Will change your MouseSpeed randomly depending on the settings you choose throughout the script.
*******************************************************************************}
[PHP]procedure SetMouseSpeedEvery(Seconds : Integer; Speed, Rand : Integer);
begin
if ((TimeFromMark(MouseSpeedMark) /1000) = Seconds) then
begin
MarkTime(MouseSpeedMark);
case random(2) of
0: MouseSpeed:=Speed + Random(Rand);
1: MouseSpeed:=Speed - Random(Rand);
end;
end;
end;[/PHP]

Example of where to use:

[PHP]var MouseSpeedMark;

procedure FindRandoms;
begin
FindNormalRandoms;
SetMouseSpeedEvery(200+random(300), 15, 12);
end.

begin
MineRock;
FindRandoms;
WalkToBank;
FindRandoms;
end.[/PHP]
BoredWhileFlagExistsDist(distance : integer);

{*******************************************************************************
procedure BoredWhileFlagExistsDist(distance : integer);
By: Cheesehunk
Description: Based of Fakawi's BoredHuman. Waits while the flag exists, and acts bored, moving the mosue, and rotating the screen randomly.
*******************************************************************************}
[PHP]procedure BoredWhileFlagExistsDist(distance : integer);
begin
while (not(HumanCircleFlag(distance))) or (FlagPresent) do
begin
if (Random(7)=1) then wait(500+random(500));
if HumanCircleFlag(distance) or not(FlagPresent) then Exit;
if (Random(3)=1) then MMouse((Random(MSX1+MSX2))+2/2,Random(MSY1+MSY2)+2/2,0,0);
if HumanCircleFlag(distance) or not(FlagPresent) then Exit;

Case Random(7) of
0: SendArrowSilentWait( ((Random(2) * 2) + 1), 1000 + Random(200) );
1: SendArrowSilentWait( ((Random(2) * 2)), 1000 + Random(200) );
2: SendArrowSilentWait( ((Random(2) * 2) + 1), 200 + Random(200) );
3: SendArrowSilentWait( ((Random(2) * 2)), 200 + Random(200) );
4: SendArrowSilentWait( ((Random(2) * 2) + 1), 20 + Random(20) );
5: SendArrowSilentWait( ((Random(2) * 2)), 20 + Random(20) );
6: wait(10); //Doesn't rotate.
end;

if HumanCircleFlag(distance) or not(FlagPresent) then Exit;
if (Random(10)=1) then wait(500+random(500));
if HumanCircleFlag(distance) or not(FlagPresent) then Exit;
if (Random(5)=1) then MMouse((Random(MSX1+MSX2))+2/2,Random(MSY1+MSY2)+2/2,0,0);
end;
end;[/PHP]

Example of where to use:
[PHP]
begin
ClickMMColor(BankColor);
if (Random(5)=1) then
begin
BoredWhileFlagExists(10);
end else
Flag;
end.[/PHP]


CheeseBan;

{*******************************************************************************
procedure CheeseBan;
By: Cheesehunk
Description: Performs Anti-ban actions without rotating the screen, because of RoadWalking.
*******************************************************************************}
[PHP]Procedure CheeseBan;
begin
RandomChatEvery(10+random(10));
BoredEvery(10+random(20));
PickUpMouseEvery(5+random(10));
LeaveScreenEvery(5+random(5));
HoverEvery(25+random(20),'random');
RandomRClickEvery(15+random(5));
PeeBreakEvery(45+random(45));
SetRunEvery(20+random(10),True);
RandomAntiBanEvery(10+random(15));
end;[/PHP]

Example of where to use:
[PHP]
var RandomAntiBanMark, PeeBreakMark, RunMark: integer;
begin
MarkTime(RandomAntiBanMark);
MarkTime(PeeBreakMark);
MarkTime(RunMark);

Procedure FindRandoms;
begin
FindNormalRandoms;
CheeseBan;
end;

Mouse(x,y,0,0,true);
FindRandoms;
end.[/PHP]


RandomAntiBanEvery(mins : Integer);

{*******************************************************************************
procedure RandomAntiBanEvery(mins : Integer);
By: Cheesehunk
Description: In a user specified amount of time, it performs some Random AntiBan actions.
*******************************************************************************}
[PHP]procedure RandomAntiBanEvery(mins : Integer);
var PantiBan: integer;
UnRounded: Extended;
begin
if ((TimeFromMark(RandomAntiBanMark) /1000) / 60 >= mins) then
begin
MarkTime(RandomAntiBanMark);
UnRounded:=Random(20)+11 / 10;
PantiBan:=Round(UnRounded);
case Pantiban of
1: begin GameTab(12) RandomEmote; end;
2: GameTab(1+Random(12));
3: RClickExamine;
end;
end;
end;[/PHP]

Example of where to use:
[PHP]
var RandomAntiBanMark : integer;
begin
MarkTime(RandomAntiBanMark);
Dostuff;
RandomAntiBanEvery(10+Random(5),True);
end.[/PHP]


SetRunEvery(mins : Integer; Run : Boolean);

{*******************************************************************************
procedure SetRunEvery(mins : Integer; Run : Boolean);
By: Cheesehunk
Description: Set's the player to run, or walk depending on the amount of time.
*******************************************************************************}
[PHP]procedure SetRunEvery(mins : integer; Run : Boolean);
begin
if ((TimeFromMark(RunMark) /1000) / 60 >= mins) then
begin
MarkTime(RunMark);
SetRun(Run);
end;
end;[/PHP]

Example of where to use:
[PHP]
var RunMark : Integer;
begin
MarkTime(RunMark);
Dostuff;
SetRunEvery(20+Random(10));
end.[/PHP]


PeeBreakEvery(mins : Integer);

{*******************************************************************************
procedure PeeBreakEvery(mins : Integer);
By: Cheesehunk
Description: Leaves the script idle for a while, as if the player were taking a small break for food, or to go to the bathroom.
*******************************************************************************}
[PHP]procedure PeeBreakEvery(mins : Integer);
var PeeMark: Integer;
begin
if ((TimeFromMark(PeeBreakMark) / 1000) / 60 >= mins) then
begin
MarkTime(PeeBreakMark);
MarkTime(PeeMark);
repeat
Wait(1);
FindNormalRandoms;
until ((TimeFromMark(PeeMark) >= 15000+Random(60000)) or (not(LoggedIn)))
end;
end;[/PHP]

Example of where to use:
[PHP]
var PeeBreakMark : Integer;
begin
MarkTime(PeeBreakMark);
Dostuff;
PeeBreakEvery(30+random(30));
end.[/PHP]


OpenBankQuiet2(X1, Y1, X2, Y2: integer; WhichBank:string):Boolean;

{*******************************************************************************
function OpenBankQuiet2(X1, Y1, X2, Y2: integer; WhichBank:string):Boolean;
By: WT-Fakawi/Cheesehunk
Description: Searches for any given bank in the free world in a specified area, and opens using
FindDeformedBitmapToleranceIn. Avoids strange mouse movements. Will cause
significant lag (approx. 1 second), but finds the bank with one click. Very useful if you do
not want to take up exyta time looking for the counter in places where it would never be.

Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'eb' (Edgeville Bank)
'akb' (Al-Kharid Bank)
*******************************************************************************}

[PHP]Function OpenBankQuiet2(X1, Y1, X2, Y2: integer; WhichBank:string):Boolean;
var
VarrockEastCounter, VarrockWestCounter, DraynorCounter,
FaladorEastCounter, FaladorWestCounter, TheCounter,
Dx, Dy, tol, Mark2, Mark3:integer;
var
acc, accthres:extended;
begin
VarrockEastCounter := BitmapFromString(30, 1, 'z78DA6DC' +
'E5D0A80300C03E02BCDD92EE9E3DCF0FE4732EC077D90908F5228' +
'9460E689AEDC0C35D13E068DCEAA6E5DDB34E7E2D6524C1D96B7E' +
'5B0D0DCCCFF1CF70945095C92CBAE56E6F1C972C4DEE046457B00' +
'D4FB2728');

VarrockWestCounter := BitmapFromString(30, 1, 'z78DA333530B' +
'130B1304521413484044218DB05C6868A1A98184144CC0C4D5C8C' +
'8C9149134B6333034B9C24C24C98692011430C930DA1A48BB1235' +
'0171209001C2C2544');

FaladorEastCounter := BitmapFromString(1, 43, '252323554227644D' +
'2D6E55337B5F3A7B5F3A6E5A336E5A33968979948778928677928' +
'677756D6383786A8D7F6F9586719C8B7687683F8C6D42896E4D80' +
'68498068497D65487D65487A63467A6346776145776145755F437' +
'55F436E5533715735775C38775C387762388F6F43816A3B7E683A' +
'816A3B9276547E683A846C3D746036');

FaladorWestCounter := BitmapFromString(1, 29, '98887381' +
'633B87683F7D6548836A4A7D65487D65487A63467A63467A63467' +
'76145776145755F43755F436B52316B52316E5533715735775C38' +
'A1835C9F815B8C6D428C6D428C6D428C6D427B643A7B643A74603' +
'68B866F');

DraynorCounter := BitmapFromString(34, 1, 'z78DA658E4B0' + // works too for al karid
'E80300844AF34FCB45DAA70FF2B89B40B12339997F0C980BA5C98' +
'06837A7AE828CE74551F77FF51CBCD1FC5D901369614282816E59' +
'683EF94207AF2BA55C9948672BFB2FB7D5A1F6E8A10D0C9274552' +
'39FD022AE92A73');

case WhichBank of
'feb': TheCounter := FaladorEastCounter;
'fwb': TheCounter := FaladorWestCounter;
'vwb': TheCounter := VarrockWestCounter;
'veb': TheCounter := VarrockEastCounter;
'akb': TheCounter := DraynorCounter;
'db' : TheCounter := DraynorCounter;
'eb' : TheCounter := DraynorCounter;
end;

SendArrowSilentWait(0,1000+Random(500));
MarkTime(Mark3);
Tol:=1;
accthres:=0.6;
repeat
FindDeformedBitmapToleranceIn(TheCounter, Dx, Dy, X1, Y1, X2, Y2, tol, 4, True, acc);
if (acc >= accthres) then
begin
MMouse(Dx, Dy, 0, 0);
if IsUpTextMulti('e Bank','Booth','ooth') then
begin
GetMousePos(Dx, Dy);
Mouse(Dx, Dy, 0, 0, False);
if ChooseOption(Dx, Dy, 'uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
writeln('couldnt find the bank. Exiting');
Exit;
end;
until BankScreen;
end;
Result := True;
Exit;
end;
end;
wait(100);
FindNormalRandoms;
tol := tol + 4; if tol >= 20 then
begin
tol := 1;
accthres := accthres - 0.1;
if accthres < 0.2 then
begin
writeln('couldnt find the bank. Exiting');
Exit;
end;
end;
until TimeFromMark(Mark3) > 60000;

FreeBitMap(VarrockEastCounter);
FreeBitMap(VarrockWestCounter);
FreeBitMap(FaladorEastCounter);
FreeBitMap(FaladorWestCounter);
FreeBitMap(DraynorCounter);
end;[/PHP]

Example of where to use:
[PHP]begin
repeat
OpenBankQuiet2(160, 80, 460, 200,'akb');
until(BankScreen);
end.[/PHP]


RClickExamine;

{*******************************************************************************
procedure RClickExamine;
by: Cheesehunk, based of Fakawi's BoredHuman;
Description: Randomly right clicks somewhere on the screen, then chooses to either Examine the item, Cancel
the option, or Just move the mouse away, and not choose an option.
*******************************************************************************}

[PHP]Procedure RClickExamine;
begin
begin
MMouse(Random(MSX2), Random(MSY2), 0, 0);
If IsUpText('opti') then
begin
GetMousePos(x,y);
Mouse(x, y, 0, 0, False);
case Random(3) of
0: ChooseOption(x, y, 'Examine');
1: ChooseOption(x, y, 'Cancel');
2: MMouse(Random(MSX2), Random(MSY2), 0, 0);
end;
Wait(Random(50) + Random(50));
end;
end;[/PHP]

Example of where to use:
[PHP]begin
repeat
MineOre;
if Random(30) = 1 then
begin
RClickExamine;
end;
until(false)
end.[/PHP]

I am thinking of more procedures to put in, and will input more later.

Please give feeback, and suggestions.

Thanks,
Cheesehunk.

WhiteShadow

2006-05-20 00:58:35

Your a very creative scripter Chuck. I like it. 1 question, the last case of the MMouse isn't that kind of bad to include? I mean for example people use it, they right click something and then it just moves mouse away? Just a thought though because it may make a couple scripts unstable, since option box will be left open. Nice Work!

Cheesehunk

2006-05-20 01:02:14

From: WhiteShadow
Your a very creative scripter Chuck. I like it. 1 question, the last case of the MMouse isn't that kind of bad to include? I mean for example people use it, they right click something and then it just moves mouse away? Just a thought though because it may make a couple scripts unstable, since option box will be left open. Nice Work!


Thanks!
Hmm, I'm going to think of changing that last MMouse, thanks for the explanation.
Edit: I have decided to leave it in for now. I did some testing, and if you move your Mouse about 20 pixels from the Choose Option Box then it goes away.

Later, I might make something so the Mouse will move outside the box on the third part, and there will be no chance of it messing up the script!

Cheesehunk

2006-05-23 20:50:47

Added my new RemainItems(item : string); procedure, hope everyone likes!:)

It's very good for Anti-ban!

I was just mining away silently, and my player speaks up proadly boasting he only has 7 ores left to mine!

Cheesehunk

2006-05-24 18:44:42

Fixed a small bug.

mike2055

2006-05-24 19:05:24

Very nice I think Fakawi already added that to the bored human.

Cheesehunk

2006-05-25 18:18:45

From: mike2055
Very nice I think Fakawi already added that to the bored human.


Nope, he just has ChooseOption( x, y, 'Examine');

And thanks!:p

Cheesehunk

2006-05-27 20:27:21

Added new function OpenBankQuiet2(X1, Y1, X2, Y2: integer; WhichBank:string):Boolean; Very useful if your script keeps looking in areas where the bank slot never is for the bitmap!

Cheesehunk

2006-06-25 02:11:46

Added PeeBreakEvery(mins : Integer);

Edit: Also added my SetRunEvery(mins : integer: Run : Boolean); / RandomAntiBanEvery(mins : Integer); / CheeseBan; / BoredWhileFlagExists(distance : Integer); Procedures.

Hope everyone likes, if you need any help with them, ask me!

Cheesehunk

2006-07-03 23:08:36

Updated BoredWhileFlagExists(distance : integer); so it does not move the mosue everytime, and sometimes it will just sit and wait for a short amount of time before rotating the screen, or moving the mouse.

Cheesehunk

2006-08-02 00:23:43

Added SetMouseSpeedEvery(Seconds : Integer; Speed, Rand : Integer); procedure. Awesome for changing the MouseSpeed randomly throughout the script. I suggest putting it in your FindRandoms; procedures with parameters around this:

SetMouseSpeedEvery(30+300, 15, 10);

That will change the MouseSpeed every 30 to 330 seconds from around 15 to 25 randomly.

I hope everyone likes it.:)

If you are confused about anything, or have a sugestion, ask.

Bebe

2006-08-02 00:39:22

My version of SetMouseSpeedEvery :

procedure SetMouseSpeedEvery(Seconds : Integer; Speed, Rand : Integer);
begin
if ((TimeFromMark(MouseSpeedMark) /1000) = Seconds) then
begin
MarkTime(MouseSpeedMark);
case random(2) of
0: MouseSpeed:=Speed + Random(Rand);
1: MouseSpeed:=Speed - Random(Rand);
end;
end;
end;

Cheesehunk

2006-08-02 00:43:30

From: Bebemycat2
My version of SetMouseSpeedEvery :


I like yours better.:p

*Cheesehunk Changes his, and Credits Bebe.