SRL Archive - First Scripts

PowerMiner


Billybob 001

2009-06-28 07:38:49

program New;

{.include SRL\SRL.SCAR}

const
Copper = 4555235;

var
X, Y, T, V, F, S: Integer;

procedure DrpAll();
var
i: Integer;
arr:array of Integer;
begin
arr :=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24];

for i := 1 to 24 - 4 do
Swap(arr[RandomRange(i - 1, i + 4)], arr[RandomRange(i - 1, i + 4)] );

for i := 0 to 23 do
DropItem(arr[i]);
end;

procedure FindCopper();
begin
repeat
if (FindColorSpiralTolerance(X, Y, Copper, MSX1, MSY1, MSX2, MSY2, 30)) then
begin
T := T + 1
V := V + 1
MMouse(X, Y, 3, 3)
wait(700 + random(1001))
ClickMouse(X, Y, True)
wait(8000 + random(1001))
PickUpMouse;
writeln('T currently equals ' + IntToStr(T) + '! The current estimated experience is ' + IntToStr(V*17) + '!')
if (T=24) then
begin
F := F + 1
ClearDeBug;
T := 0
DrpAll();
writeln('T has reset ' + IntToStr(F) + ' time(s)!');
end;
end else
begin
S := S + 1
writeln('Failed to find ores ' + IntToStr(S) + ' time(s)!');
wait(3500);
end;
until(false)
end;



begin
SetupSRL;
FindCopper();
end.

Dont quiet uderstand the report function just yet so I made some stuff that can give me an estimated report. Oh and I edited the dropall function so that way the last four spots in my backpack is reserved.

ian.

2009-06-28 07:41:36

procedure FindCopper(); should just be procedure FindCopper; or function FindCopper: Boolean; ;) depending on what you wanna do with that.

(Same with procedure DropAll(); )

And DropAll can be..


procedure DropAll;
var
i: Integer;
begin
for i := 1 to 28 do
DropItem(i);
end;

Coh3n

2009-06-29 03:39:28

This little part can just be Mouse(x, y, 3, 3, True); That moves the mouse to the color you want, and clicks.


MMouse(X, Y, 3, 3)
wait(700 + random(1001))
ClickMouse(X, Y, True)

You should try and make separate procedures/functions for Antiban and such, then call them in another procedure to make the code easier to read, and shortening your functions/procedures.

I think for your first script (and first post :p) it's okay. There is certainly a lot you can add and improve on, but you're on the right track. :)

Also, I already have more respect for you simply because your first post was useful. Most people spam to get 10 posts and become a Jr. Member. You've also given me the impression that you're willing to learn more, which is good. :)

I hope to see you around. :)

Caotom

2009-07-18 13:04:17

Reasonably good script, especially for your first one.
You could try and include a declare players (multiplayer) as well as the get client function.
Also for your waits you could try using something like this:

function sWait(number: integer): boolean;
var
i, r, o, p: integer;
begin
r := (number + 100);
o := random(100) + 1;
p := random(150) + 1;
for i := 1 to o do
r := r + (r / p);
wait(r);
end;

Then for all your waits just:
sWait;
This will make the waits more random as well as (mainly in longer scripts) making your writing time shorter and the script look a little neater.
(Credits to I Pro Leechin' for his idea on the wait code).

Anti-ban and anti-random (even if they're just basic) such as:
Procedure ProAntiban;
begin
if not LoggedIn then Exit;
case 6+random(10) of
0 : HoverSkill('Random', false);
1: PickUpMouse;
2: AlmostLogOut;
3: BoredHuman;
4,5: begin
MakeCompass('N');
wait(10+random(5));
MakeCompass('S');
wait(10+random(5));
MakeCompass('N');
end;
end;
wait(30+random(30);
end;
(Full credits for this code go to I Pro Leechin')
and
FindNormalRandoms

As well as fail-safes, your find copper has until(false) at the end which will be bad if someone lags or they get a random. Try using something like
if not LoggedIn then exit;
Wait(3000);
end;

Just add something like these throughout your code, though they may be basic, they still help and make the script look/run better.
Standards could also use a look-over but it's your first script.
Overall a good job for your first script.

I could just strongly recommend reading I Pro Leechin' s guide in the begginers tutorials section, this would help you ALLOT :D (http://www.villavu.com/forum/showthread.php?t=32990)

Sorry, it's all a bit jumbled up and I have used some bad grammar :o
~Caotom