SRL Archive - Archive

superuser - SRL Member Application


superuser

2011-08-18 08:36:26

How Long have You Played Runescape?
5 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
C++, PHP, Asm x86, Pascal, C and Python.


Are you a member of any other communities?
E:

Have to put it here, even tho not gaming or Runescape related, but I'm an active user of
Stackoverflow.com.


Tell us about yourself…
From: superuser
I'm notorius SuperUser and I've got mainly two interests which are programming and chess.
Other than that, I just lye around and eat.



Please show us one (or multiple) of your scripts.
Please see my red chin. hunter and dwarven resource miner.

Echo_

2011-08-18 08:46:58

I would say you should post your scripts rather than say just go look at them, but your hunter script is multiple files :p

All of the following code is his hunter:

su_chins.simba:
program su_chins;

{** SuperUser's Red Chinchompa hunter.
*
* \version $Id$
* \author SuperUser
*}

{$i ..\scripts\su_chins\sulib\sulib.simba}

var
g_h_gto_exph,
g_h_gto_ttnl,
g_h_gto_expg,
g_h_gto_eunl,
g_h_gto_rcca,
g_h_gto_csra,
g_h_gto_rt,

g_startexp: integer;

procedure Init();
begin
try
SULIB_Init();
SULIB_SetGFXSkill(SKILL_HUNTER);

SULIB_GFXAddLabel(5, 32, 'Progress to next level');
SULIB_GFXAddLabel(5, 57, 'Exp. / h');
SULIB_GFXAddLabel(5, 74, 'Exp. gained');
SULIB_GFXAddLabel(5, 91, 'Exp. until next level');
SULIB_GFXAddLabel(5, 107, 'Time until next level');
SULIB_GFXAddLabel(259, 57, 'Red Chins (session)');
SULIB_GFXAddLabel(259, 74, 'Caught succ. %');
SULIB_GFXAddLabel(259, 91, 'Time running');

g_h_gto_exph := SULIB_GFXAddTextOutput(143, 57, '0');
g_h_gto_expg := SULIB_GFXAddTextOutput(143, 74, '0');
g_h_gto_eunl := SULIB_GFXAddTextOutput(143, 91, '0');
g_h_gto_ttnl := SULIB_GFXAddTextOutput(143, 107, '00h 00m 00s');
g_h_gto_rcca := SULIB_GFXAddTextOutput(395, 57, '0');
g_h_gto_csra := SULIB_GFXAddTextOutput(395, 74, '0.00%');
g_h_gto_rt := SULIB_GFXAddTextOutput(395, 91, '00h 00m 00s');

SULIB_HunterAutoInitBoxTraps();

SULIB_LoadDebugBitmap(ScriptPath + 'resources/bg.png');

g_startexp := R_GetSkillExp(SKILL_HUNTER);
except
WriteLn(ExceptionParam());

TerminateScript();
end;
end;

procedure UpdateStatistics();
var
rt, expleft, h, m, s: integer;
gainedexp, exph: double;
hunterstats: THunterStatistics;
begin
rt := GetTimeRunning();
expleft := R_GetSkillExpToLevel(SKILL_HUNTER);
gainedexp := R_GetSkillExp(SKILL_HUNTER) - g_startexp;
exph := (gainedexp / rt) * 3600000;

if (exph > 0) then
ConvertTime(Round(((0.0 + expleft) / (Round(exph / 50) * 50)) * 3600000), h, m, s);

SULIB_GFXSetTextOutput(g_h_gto_exph, Format('%.2fk', [(0.0 + exph) / 1000]));
SULIB_GFXSetTextOutput(g_h_gto_expg, Format('%.2fk', [(0.0 + gainedexp) / 1000]));
SULIB_GFXSetTextOutput(g_h_gto_eunl, Format('%.2fk', [(0.0 + expleft) / 1000]));
SULIB_GFXSetTextOutput(g_h_gto_ttnl, Format('%.2dh %.2dm %.2ds', [h, m, s]));

hunterstats := SULIB_HunterGetStatistics();

SULIB_GFXSetTextOutput(g_h_gto_rcca, Format('%d', [hunterstats.caught_red_chinchompas]));
SULIB_GFXSetTextOutput(g_h_gto_csra, Format('%.2f%%', [(0.0 + hunterstats.boxtraps_success) / (hunterstats.boxtraps_failed + hunterstats.boxtraps_success) * 100]));

ConvertTime(rt, h, m, s);

SULIB_GFXSetTextOutput(g_h_gto_rt, Format('%.2dh %.2dm', [h, m]));

SULib_DebugUpdate();
end;

begin
Init();

UpdateStatistics();

repeat
try
if (R_FindRandoms()) then begin
SetAngle(true);
R_MakeCompass('n');
end;

SULIB_HunterCheckBoxTraps();

UpdateStatistics();
except
WriteLn('main: ' + ExceptionParam());
end;
until false;
end.

sulib/sulib.simba:
{$IFNDEF SULIB}
{$DEFINE SULIB}

{** SuperUser's Red Chinchompa hunter / lib.
*
* \version $Id$
* \author SuperUser
*}

{$DEFINE SMART}

{$I srl\srl.scar}
{$I reflection_dev\reflection.simba}
{$I srl\srl\misc\PaintSmart.scar}

{$I sulib_gen.simba}
{$I sulib_gfx.simba}
{$I sulib_hunter.simba}

procedure SULIB_Clean();
begin
WriteLn('sulib_clean');

SetScriptProp(SP_WriteTimeStamp, [false]);

WriteLn('');
end;

procedure SULIB_Init();
begin
try
NumberOfPlayers(1);
CurrentPlayer := 0;

Players[0].Active := true;

Smart_Members := true;
Smart_Server := 88;
Smart_Signed := true;

SetupSRL();
R_UpdateHooks();

SetScriptProp(SP_WriteTimeStamp, [true]);

ClearDebug();

WriteLn('sulib_init');

SULIB_InitGFX();
SULIB_InitHunter();

SULIB_AddTerminateProc('SULIB_Clean');
except
WriteLn('sulib_init: exception: ' + ExceptionParam());

TerminateScript();
end;
end;

{$ENDIF}

sulib/sulib_gen.simba:
{$IFNDEF SULIB_GEN}
{$DEFINE SULIB_GEN}

{** SuperUser's Red Chinchompa hunter / lib.
*
* \version $Id$
* \author SuperUser
*}

{**
*
*
*}
procedure SULIB_AddTerminateProc(const proc: string);
var
procs_old: TVariantArray;
i: integer;
begin
GetScriptProp(SP_OnTerminate, procs_old);

for i := 0 to High(procs_old) do
if (Lowercase(proc) = procs_old[i]) then
RaiseException(erInternalError, 'Terminate proc already installed!');

SetLength(procs_old, Length(procs_old) + 1);

procs_old[High(procs_old)] := proc;

SetScriptProp(SP_OnTerminate, procs_old);
end;

function SULIB_WalkToInMS(const t: TTile): boolean;
var
p: TPoint;
tm: TTile;
i: integer;
begin
tm := R_GetMyPos();
result := ((t.x = tm.x) and (t.y = tm.y));

if (result) then
exit;

if (not R_CanReach(t, false)) then
RaiseException(erInternalError, 'sulib_walktoinms: cannot reach the desired tile!');

p := R_TileToMS(t, 0);

Mouse(p.x, p.y, 1, 1, false);

if (R_WaitOption('Walk', 2000)) then begin
MarkTime(i);

repeat
tm := R_GetMyPos();

Wait(RandomRange(100, 200));

if (R_Moving()) then
MarkTime(i);

if (TimeFromMark(i) > 2000) then begin
SULIB_WalkToInMS(t);

exit;
end;
until ((t.x = tm.x) and (t.y = tm.y));

result := true;
end else
SULIB_WalkToInMS(t);
end;

function SULIB_ClickObject(const t: TTile; const s: TStringArray; h, x, y: integer; m: boolean): boolean;
var
p: TPoint;
begin
result := false;
p := R_TileToMS(t, h);

MMouse(p.x + x, p.y + y, 1, 1);

GetMousePos(p.x, p.y);

if (m) then begin
SmartClickMouse(p.x, p.y, false);

if (R_WaitOptionMulti(s, 2000)) then
result := true;
end else if (R_IsUpTextMulti(s)) then begin
SmartClickMouse(p.x, p.y, true);

if (DidRedClick()) then
result := true;

if (Random(500) > 450) then
PickUpMouse();
end;
end;

{$ENDIF}

sulib/sulib_gfx.simba:
{$IFNDEF SULIB_GFX}
{$DEFINE SULIB_GFX}

{** SuperUser's Red Chinchompa hunter / lib.
*
* \version $Id$
* \author SuperUser
*}

{$I sulib_gen.simba}

{**
*
*
*}

type
TTextOutput = record
x, y: integer;
s: string;
end;

var
g_sulibgfx_img_bg,
g_sulibgfx_skill,
g_sulibgfx_skill_startexp,
g_sulibgfx_flags: integer;
g_sulibgfx_canvas: TCanvas;
g_sulibgfx_textoutputs,
g_sulibgfx_textoutputs_labels: array of TTextOutput;

procedure SULIB_CleanGFX();
begin
WriteLn('sulib_gfx: clean');

SetLength(g_sulibgfx_textoutputs, 0);
SetLength(g_sulibgfx_textoutputs_labels, 0);

if (g_sulibgfx_img_bg <> 0) then
FreeBitmap(g_sulibgfx_img_bg);
end;

procedure SULIB_InitGFX();
begin
WriteLn('sulib_gfx: init');

SULIB_AddTerminateProc('SULIB_CleanGFX');

SMART_SetupDebug();

g_sulibgfx_canvas := TCANVAS.Create;
g_sulibgfx_canvas.Handle := SmartGetDebugDC();
g_sulibgfx_flags := 1;
end;

procedure SULIB_GFXSetNeedsToUpdate(b: integer);
begin
g_sulibgfx_flags := b;
end;

procedure SULIB_GFXSetTextOutput(id: integer; const s: string);
begin
if (id > High(g_sulibgfx_textoutputs)) then
RaiseException(erInternalError, 'sulib_gfx: settextoutput: invalid id [' + IntToStr(id) + ']');

g_sulibgfx_textoutputs[id].s := s;
end;

function SULIB_GFXAddTextOutput(x, y: integer; const s: string): integer;
var
i: integer;
begin
SetLength(g_sulibgfx_textoutputs, Length(g_sulibgfx_textoutputs) + 1);

i := High(g_sulibgfx_textoutputs);

g_sulibgfx_textoutputs[i].x := x;
g_sulibgfx_textoutputs[i].y := y;
g_sulibgfx_textoutputs[i].s := s;

result := i;
end;

procedure SULIB_GFXAddLabel(x, y: integer; const s: string);
var
i: integer;
begin
SetLength(g_sulibgfx_textoutputs_labels, Length(g_sulibgfx_textoutputs_labels) + 1);

i := High(g_sulibgfx_textoutputs_labels);

g_sulibgfx_textoutputs_labels[i].x := x;
g_sulibgfx_textoutputs_labels[i].y := y;
g_sulibgfx_textoutputs_labels[i].s := s;
end;

procedure SULIB_SetGFXSkill(s: integer);
begin
g_sulibgfx_skill := s;
g_sulibgfx_skill_startexp := R_GetSkillExpToLevel(s);
end;

{**
*
*
*}
procedure SULIB_TextOut(b, x, y: integer; const t: string);
var
pa: TPointArray;
h, i: integer;
begin
pa := LoadTextTPA(t, SmallChars, h);

for i := 0 to High(pa) do begin
FastSetPixel(b, x + 1 + pa[i].x, y + 1 + pa[i].y, 1317920);
FastSetPixel(b, x + pa[i].x, y + pa[i].y, clWhite);
end;

SetLength(pa, 0);
end;

procedure SULIB_LoadDebugBitmap(const bgimg: string);
var
i: integer;
begin
if (Length(bgimg) > 0) then begin
g_sulibgfx_img_bg := LoadBitmap(bgimg);

if (g_sulibgfx_img_bg < 1) then
RaiseException(erInternalError, 'sulib_gfx: loaddebugbitmap: Couldn''t load bitmap [' + bgimg + ']');

for i := 0 to High(g_sulibgfx_textoutputs_labels) do with g_sulibgfx_textoutputs_labels[i] do
SULIB_TextOut(g_sulibgfx_img_bg, x, y, s);
end else
RaiseException(erInternalError, 'sulib_gfx: loaddebugbitmap: No filename given!');
end;

procedure SULib_DebugUpdate();
var
b, expleft, cdx, cdy: integer;
begin
if (g_sulibgfx_flags = 0) then
exit;

b := BitmapFromString(765, 303, '');

FastDrawTransparent(0, 0, g_sulibgfx_img_bg, b);

expleft := R_GetSkillExpToLevel(g_sulibgfx_skill);

// Progress bar.
for cdx := Round(((0.0 + g_sulibgfx_skill_startexp - expleft) / g_sulibgfx_skill_startexp) * 361) to 360 do
for cdy := 0 to 16 do
FastSetPixel(b, 141 + cdx, 31 + cdy, $a6506d);

for cdx := 0 to High(g_sulibgfx_textoutputs) do with g_sulibgfx_textoutputs[cdx] do
SULIB_TextOut(b, x, y, s);

SULIB_TextOut(b, 146, 32, Format('Level %.2d: %.2f%% done', [R_GetSkillLevel(g_sulibgfx_skill) + 1, (0.0 + g_sulibgfx_skill_startexp - expleft) / g_sulibgfx_skill_startexp * 100]));

// Blit.
DrawBitmap(b, g_sulibgfx_canvas, 7, 345);

FreeBitmap(b);

g_sulibgfx_flags := 0;
end;

{$ENDIF}

sulib/sulib_hunter.simba:
{$IFNDEF SULIB_HUNTER}
{$DEFINE SULIB_HUNTER}

{** SuperUser's Red Chinchompa hunter / lib.
*
* \version $Id$
* \author SuperUser
*}

{$I sulib_gen.simba}
{$I sulib_gfx.simba}

const
SULIB__ID_BOXTRAP = 10008;

type
TBoxTrap = record
ta, td: TTile;
isset: boolean;
end;

THunterStatistics = record
caught_red_chinchompas,
caught_red_chinchompas_total,
h_crct,
boxtraps_failed,
boxtraps_success: integer;
htkb: boolean;
end;

var
g_sulibhunter_boxtraps: array of TBoxTrap;
g_sulibhunter_priomap: TIntegerArray;
g_sulibhunter_mypos: TTile;
g_sulibhunter_statistics: THunterStatistics;

function SULIB_HunterGetStatistics(): THunterStatistics;
begin
result := g_sulibhunter_statistics;
end;

procedure SULIB_CleanHunter();
begin
WriteLn('sulib_hunter: clean');

SetLength(g_sulibhunter_boxtraps, 0);
SetLength(g_sulibhunter_priomap, 0);
end;

procedure SULIB_InitHunter();
begin
WriteLn('sulib_hunter: init');

SetLength(g_sulibhunter_boxtraps, 0);
SetLength(g_sulibhunter_priomap, 0);

g_sulibhunter_statistics.boxtraps_failed := 0;
g_sulibhunter_statistics.boxtraps_success := 0;
g_sulibhunter_statistics.htkb := false;
g_sulibhunter_statistics.caught_red_chinchompas_total := StrToInt(ReadINI('statistics_hunter', 'red_chinchompas', ScriptPath + 'sulib_stats.ini'));

if (g_sulibhunter_statistics.caught_red_chinchompas_total = -1) then
g_sulibhunter_statistics.caught_red_chinchompas_total := 0;

// R_ItemExists(10034, itm);

g_sulibhunter_statistics.caught_red_chinchompas := 0; // itm.StackSize;

g_sulibhunter_statistics.h_crct := SULIB_GFXAddTextOutput(175, 5, IntToStr(g_sulibhunter_statistics.caught_red_chinchompas_total));

SULIB_AddTerminateProc('SULIB_CleanHunter');
end;

procedure SULIB_HunterAddBoxTrap(x, y: integer);
var
i: integer;
begin
if (High(g_sulibhunter_boxtraps) >= 4) then
RaiseException(ErInternalError, 'sulib_hunter: addboxtrap: you cannot setup more than 5 traps!');

SetLength(g_sulibhunter_boxtraps, Length(g_sulibhunter_boxtraps) + 1);
SetLength(g_sulibhunter_priomap, Length(g_sulibhunter_priomap) + 1);

i := High(g_sulibhunter_boxtraps);

g_sulibhunter_priomap[i] := i;

g_sulibhunter_boxtraps[i].ta.x := x;
g_sulibhunter_boxtraps[i].ta.y := y;
g_sulibhunter_boxtraps[i].td := g_sulibhunter_boxtraps[i].ta;
g_sulibhunter_boxtraps[i].isset := false;
end;

procedure SULIB_HunterAutoInitBoxTraps();
var
i: integer;
begin
i := R_GetSkillLevel(SKILL_HUNTER);
g_sulibhunter_mypos := R_GetMyPos();

if (i >= 80) then begin
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x, g_sulibhunter_mypos.y);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x - 1, g_sulibhunter_mypos.y - 1);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x + 1, g_sulibhunter_mypos.y - 1);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x + 1, g_sulibhunter_mypos.y + 1);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x - 1, g_sulibhunter_mypos.y + 1);
end else if (i >= 60) then begin
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x, g_sulibhunter_mypos.y - 1);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x + 1, g_sulibhunter_mypos.y);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x, g_sulibhunter_mypos.y + 1);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x - 1, g_sulibhunter_mypos.y);
end else if (i >= 40) then begin
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x, g_sulibhunter_mypos.y - 1);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x + 1, g_sulibhunter_mypos.y);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x - 1, g_sulibhunter_mypos.y);
end else if (i >= 20) then begin
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x + 1, g_sulibhunter_mypos.y);
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x - 1, g_sulibhunter_mypos.y);
end else
SULIB_HunterAddBoxTrap(g_sulibhunter_mypos.x, g_sulibhunter_mypos.y);

WriteLn('sulib_hunter: autoinitboxtraps: configured ' + IntToStr(Length(g_sulibhunter_boxtraps)) + ' boxtraps.');
end;

function SULIB_HunterGetBoxTrapAt(const t: TTile): integer;
var
o: TRSObject;
begin
try
o := R_GetObjectAt(t, OBJ_INTERACTABLE);
result := o.ID;
except
WriteLn('sulib_hunter: getboxtrapat: exception: ' + ExceptionParam());
end;
end;

function SULIB_HunterIsEmptyGroundAt(t: TTile; xd, yd: integer): boolean;
begin
t.x := t.x + xd;
t.y := t.y + yd;

result := (SULIB_HunterGetBoxTrapAt(t) = -1);
end;

procedure SULIB_TryToPickupBoxTrapAt(const t: TTile);
var
gia: TGroundItemArray;
i, j, k: integer;
begin
try
gia := R_GetGroundItemsAt(t);

if (Length(gia) > 0) then
for i := 0 to High(gia) do
if (gia[i].id = SULIB__ID_BOXTRAP) then begin
MarkTime(j);

while (not SULIB_ClickObject(t, ['Take Box trap'], 0, -2, -3, true)) do
if (TimeFromMark(j) > 3000) then
RaiseException(erInternalError, 'couldn''t pickup boxtrap from ground');

k := R_InvCount();

while (R_InvCount() = k) do
if (TimeFromMark(j) > 3000) then
RaiseException(erInternalError, 'couldn''t pickup boxtrap from ground')
else
Wait(RandomRange(100, 200));

while (R_Moving()) do
Wait(RandomRange(100, 200));
end;
except
WriteLn('sulib_hunter: trytopickupboxtrapat: ' + ExceptionParam());
finally
SetLength(gia, 0);
end;
end;

procedure SULIB_HunterSetupBoxTrap(trap: integer);
begin
try
if (High(g_sulibhunter_boxtraps) < trap) then
RaiseException(erInternalError, 'trap > configured traps!');

if (g_sulibhunter_boxtraps[trap].isset) then
RaiseException(erInternalError, 'trap #' + IntToStr(trap) + ' already setup!');

if (R_CountItem(SULIB__ID_BOXTRAP) = 0) then
RaiseException(erInternalError, 'no boxtraps left in inventory!');

if (SULIB_HunterGetBoxTrapAt(g_sulibhunter_boxtraps[trap].td) <> -1) then begin
// Already a trap set where we wish to set it, so alter the location a bit...

g_sulibhunter_boxtraps[trap].ta := g_sulibhunter_mypos;

if (SULIB_HunterIsEmptyGroundAt(g_sulibhunter_mypos, -1, 0)) then
Dec(g_sulibhunter_boxtraps[trap].ta.x)
else if (SULIB_HunterIsEmptyGroundAt(g_sulibhunter_mypos, 0, 1)) then
Inc(g_sulibhunter_boxtraps[trap].ta.y)
else if (SULIB_HunterIsEmptyGroundAt(g_sulibhunter_mypos, 1, 0)) then
Inc(g_sulibhunter_boxtraps[trap].ta.x)
else if (SULIB_HunterIsEmptyGroundAt(g_sulibhunter_mypos, 0, -1)) then
Dec(g_sulibhunter_boxtraps[trap].ta.y)
else
// RaiseException(ErInternalError, 'no free spot for trap #' + IntToStr(trap) + ' available!');
exit;
end else
g_sulibhunter_boxtraps[trap].ta := g_sulibhunter_boxtraps[trap].td;

SULIB_WalkToInMS(g_sulibhunter_boxtraps[trap].ta);

R_ClickItemBy(SULIB__ID_BOXTRAP, 'Lay');

Wait(1600); // Fastest possible time to set it up is about 1.6sec.

// Wait until it's fully setup.

while (R_Animating()) do
Wait(250);

if (Pos('lay a trap here', GetBlackChatMessage()) <> 0) then begin
SULIB_TryToPickupBoxTrapAt(g_sulibhunter_boxtraps[trap].ta);

g_sulibhunter_boxtraps[trap].ta := g_sulibhunter_boxtraps[trap].td;

RaiseException(erInternalError, 'somebody set up trap first.');
end else
g_sulibhunter_boxtraps[trap].isset := true;
except
WriteLn('sulib_hunter: setupboxtrap: ' + ExceptionParam());
end;
end;

procedure SULIB_HunterBoxTrapsAdjustPrioMap();
var
i, j: integer;
c: string;
begin
// Fallen traps first.

j := 0;

for i := 0 to High(g_sulibhunter_priomap) do
g_sulibhunter_priomap[i] := -1;

for i := 0 to High(g_sulibhunter_boxtraps) do begin
case SULIB_HunterGetBoxTrapAt(g_sulibhunter_boxtraps[i].ta) of
-1: begin
g_sulibhunter_priomap[j] := i;

Inc(j);
end;
end;
end;

// Caught traps.

for i := 0 to High(g_sulibhunter_boxtraps) do begin
case SULIB_HunterGetBoxTrapAt(g_sulibhunter_boxtraps[i].ta) of
19190: begin
if (g_sulibhunter_boxtraps[i].isset) then begin
g_sulibhunter_priomap[j] := i;

Inc(j);
end;
end;
end;
end;

// Failed traps.

for i := 0 to High(g_sulibhunter_boxtraps) do begin
case SULIB_HunterGetBoxTrapAt(g_sulibhunter_boxtraps[i].ta) of
19192: begin
if (g_sulibhunter_boxtraps[i].isset) then begin
g_sulibhunter_priomap[j] := i;

Inc(j);
end;
end;
end;
end;

// Rest

for i := 0 to High(g_sulibhunter_boxtraps) do begin
if (not InIntArray(g_sulibhunter_priomap, i)) then begin
g_sulibhunter_priomap[j] := i;

Inc(j);
end;
end;

if (not g_sulibhunter_statistics.htkb) then begin
GetLastChatText(c);

if (Pos('hail to the king baby!', c) <> 0) then begin
g_sulibhunter_statistics.htkb := true;

TypeSend('Hail to the king SuperUser!');
end;
end;
end;

procedure SULIB_HunterCheckBoxTraps();
var
j, k, l, m: integer;
itm: TInvItem;
begin
try
if (Length(g_sulibhunter_boxtraps) = 0) then
RaiseException(erInternalError, 'sulib_hunter: checkboxtraps: no boxtraps configured, cannot setup!');

if (not R_TileOnMS(g_sulibhunter_mypos, 0)) then
R_WalkToTile(g_sulibhunter_mypos, 1, 1);

SULIB_HunterBoxTrapsAdjustPrioMap();

m := g_sulibhunter_priomap[0];

case SULIB_HunterGetBoxTrapAt(g_sulibhunter_boxtraps[m].ta) of
-1: begin // Nothing on the ground, so setup the boxtrap!
if (g_sulibhunter_boxtraps[m].isset) then begin
SULIB_TryToPickupBoxTrapAt(g_sulibhunter_boxtraps[m].ta);

g_sulibhunter_boxtraps[m].ta := g_sulibhunter_boxtraps[m].td;
g_sulibhunter_boxtraps[m].isset := false;
end;

SULIB_HunterSetupBoxTrap(m);
end;

19187: begin // Set trap.
if (not g_sulibhunter_boxtraps[m].isset) then
SULIB_HunterSetupBoxTrap(m);
end;

19192, 19190: begin // Either failed or successfull trap.
if (not g_sulibhunter_boxtraps[m].isset) then begin
SULIB_HunterSetupBoxTrap(m);

exit;
end;

R_ItemExists(10034, itm);

l := itm.StackSize;

SULIB_WalkToInMS(g_sulibhunter_boxtraps[m].ta);

MarkTime(j);

while (not SULIB_ClickObject(g_sulibhunter_boxtraps[m].ta, ['Dismantle', 'Check'], 100, -5, 0, false)) do begin
if (R_Moving()) then
MarkTime(j);

Wait(RandomRange(100, 200));

if (TimeFromMark(j) > 3000) then
RaiseException(erInternalError, 'couldn''t click trap to check/dismantle it.');
end;

MarkTime(j);

repeat
if (TimeFromMark(j) > 4000) then
RaiseException(erInternalError, 'trap did not check/dismantle.');

k := SULIB_HunterGetBoxTrapAt(g_sulibhunter_boxtraps[m].ta);

if (Pos('t your trap', GetBlackChatMessage()) <> 0) then begin
SULIB_TryToPickupBoxTrapAt(g_sulibhunter_boxtraps[m].ta);

break;
end;

Wait(RandomRange(100, 200));
until ((k <> 19192) and (k <> 19190));

Wait(RandomRange(100, 150));

SULIB_GFXSetNeedsToUpdate(1);

R_ItemExists(10034, itm);

if (itm.StackSize > l) then begin
Inc(g_sulibhunter_statistics.caught_red_chinchompas);
Inc(g_sulibhunter_statistics.caught_red_chinchompas_total);
Inc(g_sulibhunter_statistics.boxtraps_success);

WriteINI('statistics_hunter', 'red_chinchompas', IntToStr(g_sulibhunter_statistics.caught_red_chinchompas_total), ScriptPath + 'sulib_stats.ini');
end else
Inc(g_sulibhunter_statistics.boxtraps_failed);

g_sulibhunter_boxtraps[m].ta := g_sulibhunter_boxtraps[m].td;
g_sulibhunter_boxtraps[m].isset := false;

SULIB_HunterSetupBoxTrap(m);
end;
end;
except
WriteLn('sulib_hunter: checkboxtraps: ' + ExceptionParam());
end;
end;

{$ENDIF}

I think you have really great scripting skills (although I don't see much SRL usage), you just need more forum activity. I'll hold my vote until I see what other people think.

superuser

2011-08-18 08:55:36

From: Echo_
I think you have really great scripting skills (although I don't see much SRL usage), you just need more forum activity. I'll hold my vote until I see what other people think.


Well, I've been hanging around here since '06, re-registered due to the reason I couldn't recall my previous nick. Whats comes to my forum activity is that there's threshold to my writing. I only post when I've really got something to say :)

masterBB

2011-08-18 08:58:26

Before people search: the hunter script has no color and only one call to R_findrandoms.

e:
'function SULIB_WalkToInMS' has an endless loop.

e2:
No anti ban either unless echo hasn't posted all the files.

Echo_

2011-08-18 09:46:01

From: masterBB
Before people search: the hunter script has no color and only one call to R_findrandoms.

e:
'function SULIB_WalkToInMS' has an endless loop.

e2:
No anti ban either unless echo hasn't posted all the files.


That was all for the hunter script, here's the resource miner:

program su_drdm;

{** SuperUser's Dwarven Mine Resource Dungeon Miner
*
* \version $Id$
* \author SuperUser
*}

{$DEFINE SMART}

{$i srl\srl.scar}
{$i reflection\reflection.simba}
{$i srl\srl\misc\PaintSmart.scar}

const
// Set to true if you wish to mine some mithril ores as well.
CONF_MINE_MITHRIL_ORES = true;

// The file where to save various statistics.
CONF_STATISTICS_FILE = ScriptPath + 'statistics.dat';

{** Timeout in milliseconds when to stop mining if something unexpected
* happens.
* In theory, this should be useless, but it's there just in case. At least
* for now.
*}
CONF_MINING_TIMEOUT = 3000;

var
g_img_bg,
g_mined_coals,
g_mined_mithrils,
g_gems_sapphires,
g_gems_emeralds,
g_gems_rubys,
g_gems_diamonds,
g_mined_coals_session,
g_mined_mithrils_session,
g_gems_sapphires_session,
g_gems_emeralds_session,
g_gems_rubys_session,
g_gems_diamonds_session,
g_start_exp,
g_start_exp_left: integer;

g_canvas: TCanvas;

{** Draws text to given bitmap.
*
* Please note that there's no checking for boundaries.
*
* \param b A handle to the bitmap where to draw.
* \param x X-coordinate.
* \param y Y-coordinate.
* \param t The actual text to draw.
*}
procedure TextOut(b, x, y: integer; t: string);
var
pa: TPointArray;
h, i: integer;
begin
pa := LoadTextTPA(t, SmallChars, h);

for i := 0 to High(pa) do begin
FastSetPixel(b, x + 1 + pa[i].x, y + 1 + pa[i].y, 1317920); // Shadow.
FastSetPixel(b, x + pa[i].x, y + pa[i].y, clWhite);
end;

SetLength(pa, 0); // Sing Paranoid Mr. Osbourne!
end;

{** Initializes the script / global variables.
*
*
*}
procedure Init();
begin
SetScriptProp(SP_WriteTimeStamp, [true]);
SetScriptProp(SP_OnTerminate, ['Clean']);

smart_members := true;
smart_server := 88;
smart_signed := true;

SetupSRL();
SetupReflectionEx(true);
SMART_SetupDebug();
ClearRSCanvas(SMART_Canvas.canvas);

NumberOfPlayers(1);

currentplayer := 0;

with players[0] do begin
name := '';
pass := '';
nick := '';
active := true;
pin := '';
boxrewards := ['XP'];
lampskill := 'prayer';
end;

ClearDebug();

WriteLn('init');

g_mined_coals := StrToInt(ReadIni('ores', 'coals', CONF_STATISTICS_FILE));
g_mined_mithrils := StrToInt(ReadIni('ores', 'mithrils', CONF_STATISTICS_FILE));
g_mined_coals_session := 0;
g_mined_mithrils_session := 0;
g_gems_sapphires := StrToInt(ReadIni('gems', 'sapphires', CONF_STATISTICS_FILE));
g_gems_emeralds := StrToInt(ReadIni('gems', 'emeralds', CONF_STATISTICS_FILE));
g_gems_rubys := StrToInt(ReadIni('gems', 'rubys', CONF_STATISTICS_FILE));;
g_gems_diamonds := StrToInt(ReadIni('gems', 'diamonds', CONF_STATISTICS_FILE));
g_gems_sapphires_session := 0;
g_gems_emeralds_session := 0;
g_gems_rubys_session := 0;
g_gems_diamonds_session := 0;

g_img_bg := LoadBitmap(ScriptPath + 'bg.png');
g_canvas := TCANVAS.Create;
g_canvas.Handle := SmartGetDebugDC();

TextOut(g_img_bg, 5, 32, 'Progress to next level');
TextOut(g_img_bg, 5, 57, 'Exp. / h');
TextOut(g_img_bg, 5, 74, 'Exp. gained');
TextOut(g_img_bg, 5, 91, 'Exp. until next level');
TextOut(g_img_bg, 5, 107, 'Time until next level');

TextOut(g_img_bg, 259, 57, 'Coals (session)');
TextOut(g_img_bg, 259, 74, 'Mithrils (session)');
TextOut(g_img_bg, 259, 91, 'Gems (SERD / session)');

g_start_exp := R_GetSkillExperience('mining');
g_start_exp_left := R_ExpToNextLevel('mining');
end;

{** Frees some resources once the script has been stopped.
*
*
*}
procedure Clean();
begin
WriteLn('clean');

FreeBitmap(g_img_bg);

SetScriptProp(SP_WriteTimeStamp, [false]);

WriteLn('');
end;

{** Updates various statistical information on the SMART-window.
*
*
*}
procedure UpdateStatistics();
var
b, cdx, cdy, expleft, rt, h, m, s: integer;
gainedexp, exph: double;
begin
b := BitmapFromString(765, 303, '');

FastDrawTransparent(0, 0, g_img_bg, b);

expleft := R_ExpToNextLevel('mining');

// Progress bar.
for cdx := Round(((0.0 + g_start_exp_left - expleft) / g_start_exp_left) * 361) to 360 do
for cdy := 0 to 16 do
FastSetPixel(b, 141 + cdx, 31 + cdy, $a6506d);

rt := GetTimeRunning();
gainedexp := R_GetSkillExperience('mining') - g_start_exp;
exph := (gainedexp / rt) * 3600000;

if (exph > 0) then
ConvertTime(Round(((0.0 + expleft) / (Round(exph / 50) * 50)) * 3600000), h, m, s);

TextOut(b, 146, 32, Format('Level %.2d: %.2f%%', [R_GetSkillLevel(SKILL_MINING) + 1, (0.0 + g_start_exp_left - expleft) / g_start_exp_left * 100]));

TextOut(b, 143, 57, Format('%.2fk', [(0.0 + exph) / 1000]));
TextOut(b, 143, 74, Format('%.2fk', [(0.0 + gainedexp) / 1000]));
TextOut(b, 143, 91, Format('%.2fk', [(0.0 + expleft) / 1000]));
TextOut(b, 143, 107, Format('%.2dh %.2dm %.2ds', [h, m, s]));

TextOut(b, 173, 5, Format('%d', [g_mined_coals]));
TextOut(b, 237, 5, Format('%d', [g_mined_mithrils]));
TextOut(b, 298, 5, Format('%d', [g_gems_sapphires]));
TextOut(b, 342, 5, Format('%d', [g_gems_emeralds]));
TextOut(b, 386, 5, Format('%d', [g_gems_rubys]));
TextOut(b, 430, 5, Format('%d', [g_gems_diamonds]));

TextOut(b, 395, 57, Format('%d', [g_mined_coals_session]));
TextOut(b, 395, 74, Format('%d', [g_mined_mithrils_session]));
TextOut(b, 395, 91, Format('%d / %d / %d / %d', [g_gems_sapphires_session,
g_gems_emeralds_session,
g_gems_rubys_session,
g_gems_diamonds_session]));

// Blit.
DrawBitmap(b, g_canvas, 7, 345);

FreeBitmap(b);
end;

procedure SaveStatistics(id, a: integer);
begin
if (a > 0) then
case id of
1617: begin
IncEx(g_gems_diamonds, a);
IncEx(g_gems_diamonds_session, a);

WriteINI('gems', 'diamonds', IntToStr(g_gems_diamonds), CONF_STATISTICS_FILE);
end;

1619: begin
IncEx(g_gems_rubys, a);
IncEx(g_gems_rubys_session, a);

WriteINI('gems', 'rubys', IntToStr(g_gems_rubys), CONF_STATISTICS_FILE);
end;

1621: begin
IncEx(g_gems_emeralds, a);
IncEx(g_gems_emeralds_session, a);

WriteINI('gems', 'emeralds', IntToStr(g_gems_emeralds), CONF_STATISTICS_FILE);
end;

1623: begin
IncEx(g_gems_sapphires, a);
IncEx(g_gems_sapphires_session, a);

WriteINI('gems', 'sapphires', IntToStr(g_gems_sapphires), CONF_STATISTICS_FILE);
end;

447: begin
IncEx(g_mined_mithrils, a);
IncEx(g_mined_mithrils_session, a);

WriteINI('ores', 'mithrils', IntToStr(g_mined_mithrils), CONF_STATISTICS_FILE);
end;

453: begin
IncEx(g_mined_coals, a);
IncEx(g_mined_coals_session, a);

WriteINI('ores', 'coals', IntToStr(g_mined_coals), CONF_STATISTICS_FILE);
end;
end;
end;

function FindRock(rockids: array of integer): boolean;
var
a, i, mx, my: integer;
stats: array[0..5] of integer;
tp: TPoint;
rocks: TRSObjectArray;
r: TRSObject;
begin
result := false;
rocks := GetObjectsByIDEx(rockids, OBJECT_TYPE_INTERACTABLE, 15);

if (High(rocks) > 0) then begin
for i := 0 to High(rocks) do if TileOnMS(rocks[i].tile, 0) then begin
tp := TileToMS(rocks[i].tile, 0);
result := true;
mx := tp.x - 6;
my := tp.y - 3;

if (GetSpeed() > 0) then
mousespeed := 19;

MMouse(mx, my, 2, 2);

Wait(55);

if (R_IsUpText('Attack')) then begin
GetMousePos(mx, my);
SmartClickMouse(mx, my, false);

r_WaitOption('Mine', 2000);
end else begin
GetMousePos(mx, my);
SmartClickMouse(mx, my, true);
end;

mousespeed := 15;

if (not DidRedClick()) then begin
SetLength(rocks, 0);

exit;
end;

stats[0] := R_CountItem(1623); // Sapphires.
stats[1] := R_CountItem(1621); // Emeralds.
stats[2] := R_CountItem(1619); // Rubys.
stats[3] := R_CountItem(1617); // Diamonds.
stats[4] := R_CountItem(453); // Coals.
stats[5] := R_CountItem(447); // Mithrils.

mx := 0;
a := R_InvCount();

repeat
r := GetObjectAt(rocks[i].tile, OBJECT_TYPE_INTERACTABLE);

Wait(50);

if (GetAnimation() = -1) then begin
if (mx = 0) then begin
MarkTime(my);

mx := 1;
end else if (TimeFromMark(my) > CONF_MINING_TIMEOUT) then
break;
end else
mx := 0;
until ((r.id <> rocks[i].id) or (R_FindRandoms() or (R_InvCount() = 28)));

if (a <> R_InvCount()) then begin
SaveStatistics(1623, R_CountItem(1623) - stats[0]);
SaveStatistics(1621, R_CountItem(1621) - stats[1]);
SaveStatistics(1619, R_CountItem(1619) - stats[2]);
SaveStatistics(1617, R_CountItem(1617) - stats[3]);
SaveStatistics(453, R_CountItem(453) - stats[4]);
SaveStatistics(447, R_CountItem(447) - stats[5]);

UpdateStatistics();
end;

r := NULL_RSOBJECT;

break;
end;

SetLength(rocks, 0);
end;
end;

procedure DepositOres();
var
p: TTileArray;
m: TPoint;
begin
if (R_InvCount() > 0) then begin
SetLength(p, 2);

p[0] := Tile(1055, 4572);
p[1] := Tile(1044, 4577);

WalkPath(p);

SetLength(p, 0);

repeat
m := TileToMS(Tile(1042, 4578), 400);

Mouse(m.x, m.y, 2, 2, true);
Wait(1000);

while (GetSpeed() > 0) do
Wait(250);

Wait(750);
until (R_DepositBoxScreen());

Wait(RandomRange(100, 300));

Mouse(RandomRange(333, 357),
RandomRange(270, 285), 2, 2, true);

Wait(300);

Mouse(RandomRange(430, 433),
RandomRange(38, 41), 2, 2, true);
end;
end;

procedure WalkToSite();
var
p: TTileArray;
begin
SetLength(p, 2);

p[0] := Tile(1057, 4573);
p[1] := Tile(1066, 4573);

WalkPath(p);

SetLength(p, 0);
end;

procedure AdjustLocation();
var
t: TTile;
begin
t := GetMyPos();

if (t.y >= 4575) then
WalkToTile(Tile(1066, 4571), 2, 3)
else
WalkToTile(Tile(1066, 4577), 2, 3);
end;

begin
Init();

UpdateStatistics();

R_FindRandoms();

while (true) do begin
if (CONF_MINE_MITHRIL_ORES) then begin
while (FindRock([32438, 32439, 32440])) do
UpdateStatistics();

DepositOres();
end;

WalkToSite();

while (not R_InvFull()) do begin
if (not FindRock([32426, 32427, 32428, 33428])) then begin
UpdateStatistics();

AdjustLocation();
end;

R_FindRandoms();
end;

DepositOres();
end;
end.

Harry

2011-08-18 10:10:09

Lots of crazy static waits…… I would totally not run that script on a valuable account. Everything else looks okayish from a very quick glance. You just need tons more randomness I think.

superuser

2011-08-18 10:36:48

From: masterBB
Before people search: the hunter script has no color and only one call to R_findrandoms.

e:
'function SULIB_WalkToInMS' has an endless loop.

e2:
No anti ban either unless echo hasn't posted all the files.


SULIB_WalkToInMS has only theoretical endless loop, which would not happen in real life.

'Antiban' is there, not just in the classical way. My scripts are not meant to be used brainlessly 24/7, but in small portions I've done hunter 75->99 with this one with no issues.

This script really needs just one call to find randoms, as if something fails elsewhere, exception is being raised and R_findrandoms called right after that.

From: Harry
Lots of crazy static waits…… I would totally not run that script on a valuable account. Everything else looks okayish from a very quick glance. You just need tons more randomness I think.


What you mean by 'static waits'?

i luffs yeww

2011-08-18 10:58:57

As in they're not random. You have nine.

superuser

2011-08-18 11:04:19

From: i luffs yeww
As in they're not random. You have nine.


Oh you mean like Wait(RandomRange(x, y))? That was for Simba 0.97.x as I noticed if calls to Smart was not being made too fast in a row, it didn't crash so soon. Nevertheless, they have no impact in actual performance nor the way how it looks what the bot does.

Flight

2011-08-18 11:08:41

Where's your forum activity? :(

superuser

2011-08-18 11:14:02

From: Flight
Where's your forum activity? :(


Explained few posts back ;)

BraK

2011-08-18 11:48:18

No not skilled enough in my opinion. Also don't like this thing below.

~BraK



From: superuser
Oh you mean like Wait(RandomRange(x, y))? That was for Simba 0.97.x as I noticed if calls to Smart was not being made too fast in a row, it didn't crash so soon. Nevertheless, they have no impact in actual performance nor the way how it looks what the bot does.


The randomness keeps us from making detectable paterns for Jagex to find……

This is Also the SRL community with SRL Membership Application. Where is your use of SRL?

I still haven't cast a vote BTW.

Harry

2011-08-18 12:38:11

From: superuser
What you mean by 'static waits'?

You have quite a few waits without randomness. Look harder :p

superuser

2011-08-18 12:38:33

From: BraK
No not skilled enough in my opinion. Also don't like this thing below.

…

This is Also the SRL community with SRL Membership Application. Where is your use of SRL?

I still haven't cast a vote BTW.


I'm sad to hear you find my coding lack required skill.

Is it not allowed to edit posts in order to fix grammar-errors?

I thought by using reflection as well counts towards the spirit of SRL. However, if this is not the case, I stand corrected and apologize. And if so, getting a SRL membership requires making just color-scripts?

Smarter Child

2011-08-18 12:47:06

From: superuser
I'm sad to hear you find my coding lack required skill.

Is it not allowed to edit posts in order to fix grammar-errors?

I thought by using reflection as well counts towards the spirit of SRL. However, if this is not the case, I stand corrected and apologize. And if so, getting a SRL membership requires making just color-scripts?


I think he was referring to your double post. Reflection knowledge is not counted as SRL knowledge in an SRL members application. SRL membership doesn't require "just" colour, however it does require that you show an adequate amount of SRL[Colour] knowledge. Reflection isn't bad, but it isn't what we're looking for. We are evaluating your knowledge of the SRL include not the Reflection include.

Generally a good SRL members application will feature knowledge of TPAs[TPointArray's], (D)DTMs[(Dynamic) Deformable Template Models], Map walk, Failsafes, Multiplayer, perhaps bitmaps, etc.

I voted 'no' because I would like to see more colour knowledge and randomness in your scripts, however you are a great if not more than capable coder especially when it comes to reflection. To be honest, I think colour would be a piece of cake for you.

Whether or not you make SRL members, I recommend reading this and a few TPA/DTM[basically colour stuff] tutorials ;)

Any ways, good luck!

Coh3n

2011-08-18 12:51:12

I like your programming and scripting knowledge, and you were the first that I know of to have graphics progress reports. You seem like a smart, mature guy, yes from me.

Frement

2011-08-18 12:56:09

Voted yes for the reasons everyone have said.

BraK

2011-08-18 13:29:23

I didn't vote and Yes I was talking about the Blatant double post. I was circling the Edit showing that you did indeed know how to edit but didn't just because (insert Reason Here). I also meant your knowledge of the Include. I'm still with holding my vote.

~BraK

E: Merged your post. Please don't double post.

E2: @Smarter Child quit trying to get my rep by explaining my post :p

@superuser the "E" is for when you edit the post. This is to let others know your edit instead of making another post if they come back to read again what you wrote later.

superuser

2011-08-18 14:18:59

From: Smarter Child
Whether or not you make SRL members, I recommend reading this and a few TPA/DTM[basically colour stuff] tutorials ;)

Any ways, good luck!


Thanks for your kind words and tips. However, all that (DTMs, TPAs, bitmaps, colors, tolerances, etc.) has nothing I can learn from; done that for several years. Since I'm driving for efficiency, I find it so much better to do ref. scripts instead of color. :)

Jakkle

2011-08-18 17:58:20

@ brak, you never double posted ? though this is about an application, not picking on silly things like that. Talk about his scripts not posts ? unless they are bad in any way.
@ Superuser well I have looked at your script quickly and I agree with the fact you NEED randomness (for it to be a released script at least) You seem to have a good understanding of scripting and can take comments like a man and be thankful for them. I'm holding my vote for a while to see how active you will be over the next few days as activity, and what sort of person you are counts in votes to. Good luck and I will edit this post with my answer soon.

Edit: My vote is, yes. Even tho your not active I must say your posts are useful and you seem like a nice guy and have a good knowledge like Coh3n said.

Gu3st...

2011-08-18 20:04:37

From: Coh3n
I like your programming and scripting knowledge, and you were the first that I know of to have graphics progress reports. You seem like a smart, mature guy, yes from me.
My thoughts exactly. I see a lot of potentional

TomTuff

2011-08-19 02:16:20

Yes.

Guys the static wait times are so that he can run a script longer without crashing smart, read the thread.

Smarter Child

2011-08-19 02:17:16

From: superuser
Thanks for your kind words and tips. However, all that (DTMs, TPAs, bitmaps, colors, tolerances, etc.) has nothing I can learn from; done that for several years. Since I'm driving for efficiency, I find it so much better to do ref. scripts instead of color. :)


Yes, however these are the requirements for an SRL members application and you failed to demonstrate that knowledge in this application, hence I voted no.

Coh3n

2011-08-19 02:33:04

From: Smarter Child
Yes, however these are the requirements for an SRL members application and you failed to demonstrate that knowledge in this application, hence I voted no.
I wouldn't really say it's a requirement, but it certainly helps. A member get's voted in, and who ever votes can base their decision on whatever they want. I would say they're more recommendations than requirements.

KingKong

2011-08-19 06:01:50

You have a good attitude and scripting skills and excellent scripts(im referring to your jad helper even though you didn't post it here), but you have to beat me in chess if you want my vote!

superuser

2011-08-19 07:31:25

From: KingKong
You have a good attitude and scripting skills and excellent scripts(im referring to your jad helper even though you didn't post it here), but you have to beat me in chess if you want my vote!


Game on ;) Where do you want to have the game? :)

masterBB

2011-08-19 08:41:45

I'v voted no because I think this script isn't save enough and doesn't show enough knowledge about either the srl or the reflection include. There are no advanced methods used in this script except for you your on screen paint which looks amazing. Yet that isn't enough for a yes from me. I will show some example pieces of code to support my vote:

At the function DepositOres from your mining script:
Mouse(RandomRange(333, 357),
RandomRange(270, 285), 2, 2, true);

Wait(300);

Mouse(RandomRange(430, 433),
RandomRange(38, 41), 2, 2, true);

The wait is static, though you argument to do this is that SMART freezes up that is probably not true in this situation. At least I don't have that trouble with that between two mouse clicks. The wait is not only static, you also didn't check if the inventory is really empty. What if cause some sort of lag the button isn't clicked, or because some window switching by the user the click hasn't been send to the runescape server. Than the character would walk back with an full inventory of ores.

Though the mouse will probably move perfectly to the deposit inventory button, I would've liked to see some sort of check if your mouse really hovers the button. This is off course also to prevent lag from ruining this script. I'm aware that you wait till the interface shows up. The last click also is nothing more than a static coords click. It wouldn't hurt to check if the uptext is close. And maybe even wait till the interface is gone with a while-wait loop. Though this isn't to important cause MM walking will close what so ever.

while (not R_InvFull()) do begin
if (not FindRock([32426, 32427, 32428, 33428])) then begin
UpdateStatistics();

AdjustLocation();
end;

R_FindRandoms();
end;

Two words: Endless loop. The dead of many bots and the fear of everyone caring about their accounts. What if you character is way off? What if for some reason it's unable to walk to the given tiles? It will repeat and repeat and repeat. Why not make AdjustLocation a function returning a Boolean. Using the Boolean in an if-statement, which will exact if false. This is one of the main reason why I think this script is not good enough.

About this script as a whole I also have a few points of criticism:
  1. g_mined and g_gems vars would look much better if there were place in an array. It would have shorted your script a lot, and with const you could still use there names in your script. So there are only pros for this and no cons.
  2. You said you had your own kind of antiban, but this script doesn't checks his levels, doesn't afk and doesn't do randoms stuff. It just mines…
  3. The script seems a bit short. If you don't include your progie the script would be 193 lines long. I've include it at the bottom of this post.

If I missed anything or if you want to discuss any of these points feel free to reply, but my vote has already been placed.

Short mining script.
program su_drdm;

{** SuperUser's Dwarven Mine Resource Dungeon Miner
*
* \version $Id$
* \author SuperUser
*}

{$DEFINE SMART}

{$i srl\srl.scar}
{$i reflection\reflection.simba}

const
// Set to true if you wish to mine some mithril ores as well.
CONF_MINE_MITHRIL_ORES = true;

{** Timeout in milliseconds when to stop mining if something unexpected
* happens.
* In theory, this should be useless, but it's there just in case. At least
* for now.
*}
CONF_MINING_TIMEOUT = 3000;

{** Initializes the script / global variables.
*
*
*}
procedure Init();
begin
smart_members := true;
smart_server := 88;
smart_signed := true;

SetupSRL();
SetupReflectionEx(true);

NumberOfPlayers(1);
currentplayer := 0;

with players[0] do begin
name := '';
pass := '';
nick := '';
active := true;
pin := '';
boxrewards := ['XP'];
lampskill := 'prayer';
end;
end;

function FindRock(rockids: array of integer): boolean;
var
a, i, mx, my: integer;
stats: array[0..5] of integer;
tp: TPoint;
rocks: TRSObjectArray;
r: TRSObject;
begin
result := false;
rocks := GetObjectsByIDEx(rockids, OBJECT_TYPE_INTERACTABLE, 15);

if (High(rocks) > 0) then begin
for i := 0 to High(rocks) do if TileOnMS(rocks[i].tile, 0) then begin
tp := TileToMS(rocks[i].tile, 0);
result := true;
mx := tp.x - 6;
my := tp.y - 3;

if (GetSpeed() > 0) then
mousespeed := 19;

MMouse(mx, my, 2, 2);
Wait(55);

if (R_IsUpText('Attack')) then
begin
GetMousePos(mx, my);
SmartClickMouse(mx, my, false);
r_WaitOption('Mine', 2000);
end else
begin
GetMousePos(mx, my);
SmartClickMouse(mx, my, true);
end;

mousespeed := 15;

if (not DidRedClick()) then begin
SetLength(rocks, 0);
exit;
end;

mx := 0;
a := R_InvCount();

repeat
r := GetObjectAt(rocks[i].tile, OBJECT_TYPE_INTERACTABLE);
Wait(50);

if (GetAnimation() = -1) then
begin
if (mx = 0) then
begin
MarkTime(my);
mx := 1;
end else if (TimeFromMark(my) > CONF_MINING_TIMEOUT) then
break;
end else
mx := 0;
until ((r.id <> rocks[i].id) or (R_FindRandoms() or (R_InvCount() = 28)));

r := NULL_RSOBJECT;
break;
end;
SetLength(rocks, 0);
end;
end;

procedure DepositOres();
var
p: TTileArray;
m: TPoint;
begin
if (R_InvCount() > 0) then
begin
SetLength(p, 2);
p[0] := Tile(1055, 4572);
p[1] := Tile(1044, 4577);

WalkPath(p);
SetLength(p, 0);

repeat
m := TileToMS(Tile(1042, 4578), 400);
Mouse(m.x, m.y, 2, 2, true);
Wait(1000);

while (GetSpeed() > 0) do
Wait(250);

Wait(750);
until (R_DepositBoxScreen());

Wait(RandomRange(100, 300));
Mouse(RandomRange(333, 357), RandomRange(270, 285), 2, 2, true);
Wait(300);
Mouse(RandomRange(430, 433), RandomRange(38, 41), 2, 2, true);
end;
end;

procedure WalkToSite();
var
p: TTileArray;
begin
SetLength(p, 2);
p[0] := Tile(1057, 4573);
p[1] := Tile(1066, 4573);

WalkPath(p);
SetLength(p, 0);
end;

procedure AdjustLocation();
var
t: TTile;
begin
t := GetMyPos();
if (t.y >= 4575) then
WalkToTile(Tile(1066, 4571), 2, 3)
else
WalkToTile(Tile(1066, 4577), 2, 3);
end;

begin
Init();
R_FindRandoms();
while (true) do begin
if (CONF_MINE_MITHRIL_ORES) then
begin
FindRock([32438, 32439, 32440]);
DepositOres();
end;
WalkToSite();
while (not R_InvFull()) do
begin
if (not FindRock([32426, 32427, 32428, 33428])) then
AdjustLocation();
R_FindRandoms();
end;
DepositOres();
end;
end.

Gu3st...

2011-08-19 09:01:15

From: superuser
Game on ;) Where do you want to have the game? :)
Chess.com is a good place. It can also connect to facebook

superuser

2011-08-19 10:25:06

From: masterBB
I'v voted no because I think this script isn't save enough and doesn't show enough knowledge about either the srl or the reflection include. There are no advanced methods used in this script except for you your on screen paint which looks amazing. Yet that isn't enough for a yes from me. I will show some example pieces of code to support my vote:

At the function DepositOres from your mining script:
Mouse(RandomRange(333, 357),
RandomRange(270, 285), 2, 2, true);

Wait(300);

Mouse(RandomRange(430, 433),
RandomRange(38, 41), 2, 2, true);

The wait is static, though you argument to do this is that SMART freezes up that is probably not true in this situation. At least I don't have that trouble with that between two mouse clicks. The wait is not only static, you also didn't check if the inventory is really empty. What if cause some sort of lag the button isn't clicked, or because some window switching by the user the click hasn't been send to the runescape server. Than the character would walk back with an full inventory of ores.

Though the mouse will probably move perfectly to the deposit inventory button, I would've liked to see some sort of check if your mouse really hovers the button. This is off course also to prevent lag from ruining this script. I'm aware that you wait till the interface shows up. The last click also is nothing more than a static coords click. It wouldn't hurt to check if the uptext is close. And maybe even wait till the interface is gone with a while-wait loop. Though this isn't to important cause MM walking will close what so ever.

while (not R_InvFull()) do begin
if (not FindRock([32426, 32427, 32428, 33428])) then begin
UpdateStatistics();

AdjustLocation();
end;

R_FindRandoms();
end;

Two words: Endless loop. The dead of many bots and the fear of everyone caring about their accounts. What if you character is way off? What if for some reason it's unable to walk to the given tiles? It will repeat and repeat and repeat. Why not make AdjustLocation a function returning a Boolean. Using the Boolean in an if-statement, which will exact if false. This is one of the main reason why I think this script is not good enough.

About this script as a whole I also have a few points of criticism:
  1. g_mined and g_gems vars would look much better if there were place in an array. It would have shorted your script a lot, and with const you could still use there names in your script. So there are only pros for this and no cons.
  2. You said you had your own kind of antiban, but this script doesn't checks his levels, doesn't afk and doesn't do randoms stuff. It just mines…
  3. The script seems a bit short. If you don't include your progie the script would be 193 lines long. I've include it at the bottom of this post.

If I missed anything or if you want to discuss any of these points feel free to reply, but my vote has already been placed.

Short mining script.


Well well, you have some points there!

First off, I really don't think it's an issue how long the code is. I would guess it matters, how it works. No reason to bloat it ;)

Second, I haven't talked about antiban and this script at all. As I've said, my scripts are not meant to be used in a very long period of time in row.

Third, you have to remember where the script is in action, which is dwarven mine resource dungeon. It's area is small and very limited, so it really cannot get lost there :) I've run this script for near 300 hours without any issues. Again, no reason to bloat the code especially when there's no reason.

Last, what do you consider advanced reflection methods, if not any I've used? Would you wish me to have straight calls to SMART? Again, no reason, that's why there's the ref. include for our disposal ;)

Drakan

2011-08-19 11:23:34

There you go making double posts again… :P

I voted yes simply because I believe he shows he knows how to code in general. Yes things can be done better and yes he doesn't show extensive knowledge of the SRL include in his scripts there, but he seems more than capable. Looking back at my own SRL application, my scripts were much worse and I don't think I had nearly as much knowledge as he does when applying. Of course that didn't mean I didn't progress as a scripter when I received member status. Just work on not double posting (though we all have done it at one point or another).

masterBB

2011-08-19 11:25:36

From: superuser
Well well, you have some points there!


First off, I really don't think it's an issue how long the code is. I would guess it matters, how it works. No reason to bloat it ;)

Well off course the length of the script is not the reason to say no. But I expect from a member to be able to write scripts which are human like and have decent amount of failsafes. If the script is this short that will probably not be include.

Second, I haven't talked about antiban and this script at all. As I've said, my scripts are not meant to be used in a very long period of time in row.

I can't play runescape for longer as 30 minutes before I start doing random things between the skilling. Though we(I) don't got proof runescape, I got the feeling I get less randoms with scripts that got decent anti bans. It takes no time to just copy some antiban in to the script. But this is why I wouldn't use it on my main.

Third, you have to remember where the script is in action, which is dwarven mine resource dungeon. It's area is small and very limited, so it really cannot get lost there :) I've run this script for near 300 hours without any issues. Again, no reason to bloat the code especially when there's no reason.

There is no reason to bloat the code when the script works great. As long as there are no things missing. And I miss a few things. Probably you never experience lag, but it is common on most parts of the world and even more common when someone runs multiple smart clients at once. A lot of things can go wrong.

And let's say a random failed the player is now in lumbridge. Most people won't check this on start up. They expect the script to be able to stop itself when something terribly goes wrong. And I would like to see that too. It's isn't that much trouble since WalkToTile alread got a Boolean in return. This was something I had trouble with on more parts of this script. It just doesn't got enough checks if things go wrong. And the golden rule is things go wrong. Miss clicks will happen.

Last, what do you consider advanced reflection methods, if not any I've used? Would you wish me to have straight calls to SMART? Again, no reason, that's why there's the ref. include for our disposal ;)

You really don't have to use the hooks yourself in SMART functions. That is not something most of us(I) will expect from an SRL members app. And this probably wouldn't be an improvement either(unless you really needed it).

What I really meant was that I didn't feel that there were much challenges with this script that had to be won. There is no unique system to beat the other bots in speed. There is no system applied to switch world if to crowded(not sure if needed, never been there). Maybe I should focus more on the other script. But this was one was a bit simple, and didn't showed me what you can. And when you click on deposit it wouldn't hurt to retrieve the coordinates with the interface functions. This would make it a bit less static.

edit:
My posts seems to bit a bit negative. I honestly do think you can do it. And I wouldn't be disappointed if you get your members. But for me you don't show enough scripting skills ;)

superuser

2011-08-19 12:24:49

From: masterBB

…

My posts seems to bit a bit negative. I honestly do think you can do it. And I wouldn't be disappointed if you get your members. But for me you don't show enough scripting skills ;)


Hopefully in the future I can impress you :) I see the logic and reasoning behind your criticism and without doubt, it's justified and well placed.

From: Drakan
There you go making double posts again… :P
…

Just work on not double posting (though we all have done it at one point or another).


Oops :) I guess I now understand the concept of double posts. How silly of me. My bad, won't happen again!

Edit:

Grammar, grammar ;)

KingKong

2011-08-19 23:57:40

From: Zyt3x
Chess.com is a good place. It can also connect to facebook


Yep, thats the place we're going to battle it out!
PM me your username.

cause

2011-08-21 03:40:03

From: Coh3n
I like your programming and scripting knowledge, and you were the first that I know of to have graphics progress reports. You seem like a smart, mature guy, yes from me.


this

superuser

2011-08-25 13:08:17

From: KingKong
Yep, thats the place we're going to battle it out!
PM me your username.


You do realize this game will last at least one to two months at this rate of play :D Perhaps a few blitz games?

noidea

2011-08-25 21:43:03

Yes from me

cycrosism

2011-08-25 22:18:16

From: superuser
the game? :)



superuser

2011-08-26 04:39:23

From: superuser
Thanks for your kind words and tips. However, all that (DTMs, TPAs, bitmaps, colors, tolerances, etc.) has nothing I can learn from; done that for several years. Since I'm driving for efficiency, I find it so much better to do ref. scripts instead of color. :)


Somebody derepped me for this saying

How can you say you will not learn?


Who ever this was, I kindly ask you to read the post again more carefully. I never said I will not learn, I said there's nothing I can learn from. Please pay more attention in the future ;)

masterBB

2011-09-02 13:00:17

I know these things aren't supposed to be bumped but since there are no replies for some time: BUMP!

Jakkle

2011-09-02 22:05:55

should be in already ? :rolleyes:

NCDS

2011-09-02 22:42:59

From: Jakkle
should be in already ? :rolleyes:


But where is superuser? Seems to have 'dropped off' in relation to activity. I haven't seen him post anyways.


I all for new members; but activity is vital right now.

Jakkle

2011-09-02 22:56:40

From: NCDS
But where is superuser? Seems to have 'dropped off' in relation to activity. I haven't seen him post anyways.


I all for new members; but activity is vital right now.


Ah yeah true, I didn't really look. Has anyone heard from him ? :P

superuser

2011-09-03 15:54:05

From: Jakkle
Ah yeah true, I didn't really look. Has anyone heard from him ? :P


I'm here, as I am on daily basis. However, I don't feel to post if I don't have anything to say :)

E: Also, I'm finishing my tutorial/article on neural networks / genetic algorithm which can be quite suitable for RS. Also going to release a plugin for Simba for it. That's a one thing which is taking my time atm.

Jakkle

2011-09-03 17:10:58

From: superuser
I'm here, as I am on daily basis. However, I don't feel to post if I don't have anything to say :)

E: Also, I'm finishing my tutorial/article on neural networks / genetic algorithm which can be quite suitable for RS. Also going to release a plugin for Simba for it. That's a one thing which is taking my time atm.


When I looked at your activity bar I got to admit it is higher than when you first posted this application. I see what your saying about posting, better to say nothing really unless there's something worth saying :p

I will look forward to seeing you work, sounds grate to me :)

superuser

2011-09-04 03:29:46

So, should I be in or not? :)

mormonman

2011-09-04 03:31:42

From: superuser
So, should I be in or not? :)


Yes. According to the poll.

Echo_

2011-09-04 16:20:25

From: superuser
So, should I be in or not? :)


You don't get memberized until Fawki approves it.

Coh3n

2011-09-04 18:17:44

Welcome! :)