SRL Archive - SRL Archives

A lot of st00f II! ._.


EvilChicken!

2008-05-03 04:49:19

I'm ûber bored, time WAS 2:29 AM. Improoving fuctions. GO!

1: Replacement for RandomRClick:

procedure RandomRClick;
var
DX, DY: Integer;
m: Byte;

begin
if LoggedIn = False then exit;
m := MouseSpeed;
MouseSpeed := 6 + random(11);
Mouse(random(MSX2),random(MSY2), 0, 0, false);
Wait(170 + random(150));
if random(3) = 1 then
ChooseOption('xamine');
MouseSpeed := M;
end;
- Generally made it better in my opinion.

2: I worked on a fix for PickUpMouse, but failed on making a good one. Still, point is that in theory it kinda is slightly detectable now since it allways follows a specific pattern. A better one should be made.

3: AlmostLogOut looks REALLY bottish. That procedure is almost serving against its purpose! The mouse movements are too fast in my opinion, and I think this proc should be improoved.

4: Amount.scar stack counting functions are broken?

5: I really hope autocoloring functions like FindRockColor ect are fixed in Rev#17?

6: Antirandoms.scar. We still do not have a FindPlant! PriSoner has a good findplant function in his woodcutter!

7: The description of FindDead is wrong and slightly misleading.

8: Allways annoyed me: FindMod. I think that scripter should self decide what happends upon mod encounter. What if logging out at that exact moment would mess up the script? Easy fix:
function FindMod: Boolean;
var
tx, ty: Integer;
begin
if (UseFindMod = False) or (LoggedIn = False) then exit;
if (BmpMod = 0) or (BmpAdmin = 0) then
LoadSRLBitMaps;
if (FindColorTolerance(tx, ty, 14737632, MCX1, MCY1, MCX1 + 40, MCY2, 15)) or
(FindColorTolerance(tx, ty, 589815, MCX1, MCY1, MCX1 + 40, MCY2, 15)) then
if (FindBitmapToleranceIn(bmpMod, tx, ty, MCX1, MCY1, MCX1 + 40, MCY2, 15)) or
(FindBitmapToleranceIn(bmpAdmin, tx, ty, MCX1, MCY1, MCX1 + 40, MCY2, 15)) then
begin
Result := True;
WriteLn('******** FOUND MOD ********');
WriteFileString(TheFile, '******** FOUND MOD ********' + Chr(13));
TakeScreen('Found mod');
Inc(Mods);
SaveToChatLog;
Players[CurrentPlayer].Rand := 'Found Mod';
end;
end;

9: Small fix for FindInventoryRandoms. Fixed to return true if finds box and a little wait after gametab(4) for anti-lag and more human-like behaviour.
function FindInventoryRandoms: Boolean;
var
CTab:Integer;

begin
CTab := GetCurrentTab;
GameTab(4);
wait(375 + random(500));
if FindLamp(LampSkill) then
Result := True;
if FindBox then begin
SolveBox;
Result := True;
end;
GameTab(CTab);
end;

10: Devs might want to take a look at Antirandoms.scar, not all functions return true if they spot a random. I don't know if its me who go it wrong..

11: Doorprofiles.scar supposedly is outdated and has a comipling error in line 285:
Result := SplitTPA(tmpTPA3);
Supposed to be
Result := SplitTPA(tmpTPA3, 1);
Right?

12: InPin waits until LoggedIn = False if it fails? I saw PriSoner have a better one with failsafes in his script.

13: Deposit is still broken? I saw a thread about the issue yesterday..

14: We need a better BankOpener for Lumbridge!

15: MFF, MFNF and similar procedures should have more descriptive descriptions for people who do not know what they do. Currently, it says only in what ways it is better than the old functions. The old functions are not present. You get the point.

16: Coordinates on SetChat should be fixed, it sometimes misclicks.

17: GetSkillLevel should be removed in my opinion. People will just need to learn how to update.

18: I understood xor, thanks N3S! Result:
procedure SetRun(Run: Boolean);
begin
GameTab(11);
if Run xor (GetColor(634, 421) = 1974404) then
MouseBox(625, 413, 658, 448, 1);
end;
Replacement for current SetRun. Added MouseBox for increased randomness, everything has been tested. Idea gotten from "Retaliate" procedure.

19: Added MouseBox for increased randomness. Raymond said he already replaced the old one with this, but just in case he didn't, he it is.
procedure Retaliate(AutoRet:Boolean);
Var
X, Y: Integer;
begin
GameTab(1);
if AutoRet xor FindColor(X, Y, 1777020, 624, 385, 719, 396) then
MouseBox(570, 360, 715, 399, 1);
end;
- The small things add up.

20: GameTab should be changed to use MouseBox in one of three (or less/more) occasions. Something like this:
If Random(3) = 1 then begin
CoordsBox := IntToBox(X1, Y1, X2, Y2);
MouseBox(CoordsBox.X1, CoordsBox.Y1, CoordsBox.X2, CoordsBox.Y2);
end else begin
Coords:= Point(X, Y);
Mouse(Coords.X, Coords.Y, 8, 8, true);
end.

21: LogIn should use MouseBox on the 'Existing User' and the 'Log In' button. Just to be safe. And maybe modify typesend not to press enter when typed in password?

22: PlayersOnMap does not work.

23: The whole MapWalk include seems slighly .. Outdated/old. Comments everywhere ect.

24: Wizz, fixed the stupid pixel movement in Mouse?

25: Add a description for WindMouse

26: Don't know if that has been fixed, but in FindObjTPA,
if not (cts >= 0) and (cts <= 2) then
cts := 1; // Standard.
should be
if InRange(CTS, 1, 3) = false then
cts := 1; // Standard.
(Not the inrange, it just looks cool. 1 to 3, not 2.)
And, add 'XS, YS, XE, YE' to it aswell? To give user the ability to restrain search area.

27: Replacement for Flag;?
procedure Flag(MaxTime: Integer);
var
Time, CX, CY: Integer;

begin
CX := MMCX;
CY := MMCY;
Wait(250);
if FindColorSpiral(CX, CY, 255, MMX1, MMY1, MMX2, MMY2) then begin
repeat
if LoggedIn = False then Exit;
Wait(800 + random(400));
Inc(Time);
until (FindColorSpiral(CX, CY, 255, MMX1, MMY1, MMX2, MMY2) = False) or (Time > MaxTime);
end;
end;

28: In my opinion, 'LoggedIn' belongs in LogIn.scar.

29: Fixed the World.ini in Rev#17?

30:
procedure FindSymbols(var AnsTPA: array of TPoint; SymbolName: string);
should be
procedure FindSymbols(var AnsTPA: TPointArray; SymbolName: string);
Small, but annoying.

31: Why do we have the UsersManager include if it doesn't even compile? (The way an include should compile..)
Line 402: [Error] (13031:1): Unknown identifier 'LoadUs' in script C:\Programfiler\SCAR 3.15b\Includes\SRL\SRL\misc\UsersManager.scar

32: WorldSwitcher is slightly broken. Can't remember if I alredy mentioned, but it forgets to click world sometimes.

33: This procedure should definetly be implemented in SRL!
{*******************************************************************************
function RndWorld(wType: integer): integer;
By: PriSoner
Description: Returns a random world number. Uses worlds.ini to get a world count
and check if world is members or free.
Options: Enter 1 to return any valid random world.
2 to return any valid Free Play World
3 to return any valid Members World
*******************************************************************************}
function RandWorld(wType: integer): integer;
var winipath: String;
rndcount: integer;
begin
if (wType > 0) and (wType < 4) then
begin
winipath := AppPath + 'includes\SRL\SCSS\worlds.ini';
rndcount := StrToInt(ReadINI('Worlds', 'Count', winipath));
case wType of
1: repeat
result := Random(rndcount) + 1;
until (ReadINI('World' + IntToStr(result), 'Type', winipath) = 'Free') or
(ReadINI('World' + IntToStr(result), 'Type', winipath) = 'Members');
2: repeat
result := Random(rndcount) + 1;
until (ReadINI('World' + IntToStr(result), 'Type', winipath) = 'Free');
3: repeat
result := Random(rndcount) + 1;
until (ReadINI('World' + IntToStr(result), 'Type', winipath) = 'Members');
end;
writeln('Your Randomly Chosen World is: ' + IntToStr(result));
end else
begin
writeln('function RandWorld: Incorrect value! Valid Range is 1 to 3. Terminating Script!');
TerminateScript;
end;
end;

Markus

2008-05-03 08:12:30

From: IRC

<EvilChicken> You can post that I pwn and that you agree.


You pwn, I agree :)

Naum

2008-05-03 08:24:18

Thats Alot of st00f. Yes I entirely agree with you.
Lets see how the Dev's think :)

ShowerThoughts

2008-05-03 08:33:52

Nice, I don't have time to comment them all but,
Why should we add 1 p2p random, so it takes longer to run FindNormalRandoms?
If we should add all the p2p randoms then we should make a boolean or a separate function.

Hermpie

EvilChicken!

2008-05-03 08:37:43

ALL randoms? There is just one. Plant. Eventually, make a variable in SetUpSRL called HandleMembersRandoms. (http://www.villavu.com/forum/showthread.php?t=29393 for more..)

Bobarkinator

2008-05-03 08:50:52

4. Amount.scar was masquerader's section. I don't know if its been updated since he left.

XcanadamanX

2008-05-03 14:26:48

heres the fix for FindRockColor:
function FindRockColor: Integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 6444639;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 75);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x-1,P[a].y)=TestColor-723980) then
begin
Result := TestColor;
WriteLn('Rock Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Rock Color!');
Result := 0;
end;

Harry

2008-05-03 15:10:00

A lot of st00f II!

Copycat :p

Good ideas.

EvilChicken!

2008-05-03 19:21:03

IMPORTANT!

Edited in issue #31 (regarding TypeSend), take a look.


And Hy, why do you think I named it "A lot of st00f II"? >_<

MylesMadness

2008-05-03 19:31:18

From: EvilChicken!
31: TypeSend:
S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
A lot of that is wrong. Just try this script:

program New;
{.include SRL/SRL.scar}

begin
Wait(2000);
TypeSend('~!@#$%^&*()_+{}|:"<>?');
end.
I ran this and the output was ~!@#$%^&*()_+{}|:"<>? I don't see anything wrong.

EvilChicken!

2008-05-03 19:38:47

This script. Run.
program New;
{.include SRL/SRL.scar}

begin
TypeSend('~!@#$%^&*()_+{}|:"<>?');
end.

'~!@#$%^&*()_+{}|:"<>?' is the second section of the variable S in TypeSend in text.scar.
This is the output I get.
'^!"#¤%^&*()_?/=§:">>?'

MylesMadness

2008-05-03 20:06:26

I get this running that
~!@#$%^&*()_+{}|:"<>?

EvilChicken!

2008-05-03 20:21:38

Gah. It depends on keyboard layout. Just did some research. Your keyboard doesn't know the difference between the 'Alt' and the 'Alt Gr' key.

lolnub :p

Edit: Fine, I'll remove #31..

R0b0t1

2008-05-03 21:11:19

Wrong, it does. Most new keyboards recognize Ctrl+Alt as the same keycode for 'Alt Graph'.

I need to find a way to make my right alt key emit that keycode instead. :) (<3 windows hackability)



But I don't see where alt is included in that string, fyi.

Cazax

2008-05-03 22:13:01

#26: Raymond fixed it. Update your SvN.

Lets wait what devs will say :)

n3ss3s

2008-05-04 04:40:45

Nice finds, but about the DoorProfiles SplitTPA fix, - isn't my thread worthy enough? :( :p

Also, FindMod, if you can script the script won't mess up -

If FindNormalRandoms Then Exit.

If you for example have that in a WorkWhileCutting procedure, and you naturally have an If Not LoggedIn Then Break in the cutting loop, you're doing just fine.

Use Not instead of = False, e.g. If Not LoggedIn Then, not If LoggedIn = False Then…

The Flag procedure of yours is a bit weird, so the time unit you have to enter is in approximate seconds? Maybe milliseconds instead, just put a time mark in the beginning and you're done.

For example -


Procedure n_FFlag(Dist, Time: Integer);

Var
FlagSafe: Integer;
Begin
FlagSafe := GetSystemTime;
While FlagDistance > Dist Do
If GetSystemTime - Flag >= Time Then
Break
Else
Wait(20);
End;

The regular FFlag is a bit laggy, due to all the useless things in there.

If someone wants to remain non-laggy and have antiban, you can just simply add begin-end tags around the Wait above and put there
If Random(100) = 0 Then MMouse(MSX1, MSY1, MIX2, MIY2).

EvilChicken!

2008-05-04 05:00:40

18: I understood xor, thanks N3S! Result:
procedure SetRun(Run: Boolean);
begin
GameTab(11);
if Run xor (GetColor(634, 421) = 1974404) then
MouseBox(625, 413, 658, 448, 1);
end;
Replacement for current SetRun. Added MouseBox for increased randomness, everything has been tested. Idea gotten from "Retaliate" procedure.


No comment? :( That was all thanks to you..

Use Not instead of = False, e.g. If Not LoggedIn Then, not If LoggedIn = False Then…


Seriously, I've ben replacing "not" with "= False". Explain. Seriously. Why?

Markus

2008-05-04 05:45:02

The If (not(loggedin))/(loggedin = false) only matters when the result isn't intialized in LoggedIn, but it is.

n3ss3s

2008-05-04 05:49:51

If Not <statement> Then just looks a lot cleaner…

EvilChicken!

2008-05-06 21:15:15

Ok, sorry for spamming - but is anything of this worth a fix?
I haven't gotten any comments (exepts people who post "I agree") and I would really like to know wether this was worth making this thread.


And, also - thanks to both of you. I'll use not from now on.

n3ss3s

2008-05-07 09:40:34

Don't worry, finding 30 'fixes' cannot be not worth it :)

Fixed: 9, 18, 30.

EvilChicken!

2008-05-09 19:50:09

Three more things, I edited in.

Sorry for spam post, but its the only way of getting more attention to this tread. Or else people would've not known/seen that I edited in three more things.

skilld u

2008-05-11 17:46:06

i fixed almost logout. I'm using it in my new script.


procedure AlmostLogout;
var
e, f, Tab: Integer;
begin
Tab := GetCurrentTab;
GameTab(14);
e := 2 + Random(3);
for f := 0 to e do
begin
case Random(3) of
0, 1: MMouse(583 + Random(120), 361 + Random(20), 0, 0);
2: begin
case Random(6) of
0, 4, 5: SleepAndMoveMouse(300 + random(150));
1, 2, 3: IdleTime(300 + Random(300), 500, 0.5);
end;
end;
end;
FTwait(2 + Random(1));
end;
GameTab(Tab);
end;

I made it so that the mouse speed isn't so fast, made it not move the mouse so often and added other ways for it to move the mouse.