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.