SRL Archive - MSI Bugs

Out of range in fishing.simba


Troll

2011-07-27 03:49:01

Well i was running a fly fisher (MSI) and when i looked back i later i see im at the lobby screen have an out of range error at line 239 in fishing.simba

line 239

findColorsTolerance(arr, fishSpot.Colors[0],

whole function


procedure MSI_WaitWhileFishing(fishSpot: TMSObject; var failed: boolean);
var
x, y, CTS, animTries, colorTries, oldInvCount, waitTime, invTimer: Integer;
idle: TAnimation;
arr: TPointArray;
begin
if ((not loggedIn) or (invFull)) then
exit;

MSI_AddHeader('MSI_WaitWhileFishing');
fishSpot.searchArea := MSI_MakeBox(point(fishSpot.x, fishSpot.y),
round(fishSpot.w / 1.75),
round(fishSpot.h / 1.75));

{$IFDEF SMART}
if (MSI_Settings[SETUP_DEBUG_SMART]) then
SMART_DrawBoxEx(true, fishSpot.searchArea, clBlue);
{$ENDIF}

idle := MSI_GetAnimation(ANIM_IDLE);
waitTime := (getSystemTime + (60000 * 3));
oldInvCount := invCount;
markTime(invTimer);
flag;

CTS := getToleranceSpeed();
MSI_Debug('Current CTS: ' + intToStr(CTS));

setColorToleranceSpeed(2);
setToleranceSpeed2Modifiers(fishSpot.hue, fishSpot.sat);

findColorsTolerance(arr, fishSpot.Colors[0],
fishSpot.searchArea.x1, fishSpot.searchArea.y1,
fishSpot.searchArea.x2, fishSpot.searchArea.y2,
fishSpot.tol);

repeat
MSI_FindRandoms(false);

// check for the "you're out of bait" text in the chat box
if (findText(x, y, 'left', NPCChars, MCX1, MCY1, MCX2, MCY2)) then
begin
MSI_Debug('We have run out of fishing bait!');
failed := true;
break;
end;

// check for the "you need tool to fish" message
if (findText(x, y, 'need', NPCChars, MCX1, MCY1, MCX2, MCY2)) then
begin
MSI_Debug('Accidentially clicked wrong fishing spot');
break;
end;

// looking for fishing spot
findColorsTolerance(arr, fishSpot.Colors[0],
fishSpot.searchArea.x1, fishSpot.searchArea.y1,
fishSpot.searchArea.x2, fishSpot.searchArea.y2,
fishSpot.tol);

if (length(arr) < fishSpot.accuracy) then
begin
MSI_Debug('Colours found < Accuracy');
inc(colorTries);
end else begin
MSI_Debug('Fishing spot found');
colorTries := 0;
end;

MSI_AntiBan(randomRange(0, 3000), ANTI_BAN_CHANCE);

if (invFull) then
begin
MSI_Debug('Inventory is full');
break;
end;

MSI_Debug('Checking inventory count');
if (timeFromMark(invTimer) > 45000) then // if no new fish in inv after 30 seconds, spot probably moved
if (oldInvCount = invCount) then
begin
MSI_SubDebug('Nothing caught for more than 45 seconds');
break;
end else begin
MSI_SubDebug('Got more fish, setting new inventory count');
oldInvCount := invCount;
markTime(invTimer);
end;

MSI_Debug('Checking player''s pixel shifting');
if (MSI_IsAnimating(idle)) then // check to see if the player is still animating
begin
MSI_SubDebug('Player isn''t animating');
inc(animTries);
end else begin
MSI_SubDebug('Player is animating');
animTries := 0;
end;

// breaks out after 3 minutes (assumes the player isn't fishing)
if (waitTime < getSystemTime) then
begin
MSI_Debug('Been fishing for 3 minutes straight, breaking as failsafe');
break;
end;

wait(randomRange(300, 700));
until((not loggedIn) or (animTries >= 10) or (colorTries > 5));

MSI_CloseHeader('MSI_WaitWhileFishing: Finished');

setColorToleranceSpeed(CTS);
setToleranceSpeed2Modifiers(0.2, 0.2);
end;

and a bit of the end of the debug


[0:39:46]: [ userEmail ] ------ Checking player's pixel shifting
[0:39:46]: [ userEmail ] -------- Player animation: Player Idle
[0:39:46]: [ userEmail ] -------- Player isn't animating
[0:39:46]: [ userEmail ] ------ Colours found < Accuracy
[0:39:46]: [ userEmail ] ------ Checking inventory count
[0:39:46]: [ userEmail ] ------ Checking player's pixel shifting
[0:39:46]: [ userEmail ] -------- Player animation: Player Idle
[0:39:46]: [ userEmail ] -------- Player isn't animating
[0:39:47]: [ userEmail ] ------ Colours found < Accuracy
[0:39:47]: [ userEmail ] ------ Checking inventory count
[0:39:47]: [ userEmail ] ------ Checking player's pixel shifting
[0:39:47]: [ userEmail ] -------- Player is animating
[0:39:48]: [ userEmail ] ------ Accidentially clicked wrong fishing spot
[0:39:48]: [ userEmail ] ---- MSI_WaitWhileFishing: Finished
[0:39:53]: [ userEmail ] ---- MSI_FindObjectTPA: FISHSPOT_LURE
[0:39:53]: [ userEmail ] ------ MSI_FilterTPADist
[0:39:53]: [ userEmail ] -------- Length (start): 0
[0:39:53]: [ userEmail ] -------- Bad elements: []
[0:39:53]: [ userEmail ] -------- New TPA: []
[0:39:53]: [ userEmail ] -------- Length (end): 0
[0:39:53]: [ userEmail ] ------ MSI_FilterTPADist: Done (16 ms)
[0:39:53]: [ userEmail ] ------ Took 94 ms to complete
[0:39:53]: [ userEmail ] ---- MSI_FindObjectTPA: False
[0:39:54]: [ userEmail ] ------ Scanning for randoms...
[0:39:54]: [Reflection] Trying to solve: Molly
[0:40:23]: [Molly] Twin ID: 3852
[0:40:32]: [Molly] Opened door!
[0:40:38]: [Molly] Found evil twin!
[0:40:42]: [Molly] 5260 - 5258
[0:40:43]: [Molly] Found evil twin!
[0:41:28]: [Reflection] Molly solved
[0:41:28]: [Reflection] Out of random
[0:41:32]: [Rewards] Reward box found
[0:41:34]: looking for box option
[0:41:34]: Found Reward Item: oins
[0:41:40]: [ userEmail ] ------ MSI_FindRandoms: Finished Random Event!
[0:41:40]: [ userEmail ] ---- MSI_WaitWhileFishing
[0:41:41]: [ userEmail ] ------ Current CTS: 1
Error: Out Of Range at line 239
The following DTMs were not freed: [Bronze Pickaxe, Iron Pickaxe, Steel Pickaxe, Mithril Pickaxe, Adamant Pickaxe, Rune Pickaxe, Dragon Pickaxe, Bronze Hatchet, Iron Hatchet, Steel Hatchet, Mithril Hatchet, Adamant Hatchet, Rune Hatchet, Dragon Hatchet, Normal Logs, Oak Logs, Willow Logs, Maple Logs, Yew Logs, Magic Logs, Clay Ore, Copper Ore, Tin Ore, Iron Ore, Silver Ore, Coal Ore, Gold Ore, Mithril Ore, Adamantite Ore, Runite Ore, Small Fishing Net, Crayfish Cage, Fishing Rod, Fishing Bait, Fly Fishing Rod, Harpoon, Lobster Pot, Raw Shrimps, Raw Crayfish, Raw Sardines, Raw Anchovies, Raw Herring, Raw Trout, Raw Pike, Raw Salmon, Raw Tuna, Raw Lobster, Raw Swordfish, Raw Shark, Cooked Shrimps, Cooked Crayfish, Cooked Sardines, Cooked Anchovies, Cooked Herring, Cooked Trout, Cooked Pike, Cooked Salmon, Cooked Tuna, Cooked Lobster, Cooked Swordfish, Cooked Shark, Uncut Sapphire, Uncut Emerald, Uncut Ruby, Uncut Diamond, Bird'S Nest, Feather, Staff Of Air, Staff Of Water, Staff Of Earth, Staff Of Fire, Air Rune, Body Rune, Mind Rune, Earth Rune, Fire Rune, Water Rune, Chaos Rune, Law Rune, Cosmic Rune, Death Rune, Nature Rune, Soft Clay, Vial, Vial Of Water, Jug, Jug Of Water, Bowl, Bowl Of Water, Bucket, Bucket Of Water, Bronze Bar, Iron Bar, Silver Bar, Steel Bar, Gold Bar, Mithril Bar, Adamant Bar, Rune Bar, SRL - Lamp bitmap, 100]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\MSI\Debug Logs\27-07-11 at 07 46 42 AM.txt] has not been freed in the script, freeing it now.


P.S. MSI is great :p

Coh3n

2011-07-27 08:25:49

Hm, that shouldn't happen since there's always a color set; however, there should be a failsafe. Could you do me a favour and add this line before the line that throws the out of range? So it'll be like:

if (length(fishSpot.colors) > 0)) then
begin
MSI_Debug('No colors in TMSObject arr: '+fishSpot.name);
exit;
end;

findColorTolerance(blah, blah);
I'm really not sure how this would happen during runtime, unless Simba's giving the wrong error line. fishSpot.colors[0] should ALWAYS be set. It's never reset anywhere as far as I know.

E: Try changing line 763 in Objects.simba to this (it should be the FISHPOT_HARPOON record).

AssociatedItems := [FISH_RAW_TUNA, FISH_RAW_SWORDFISH, FISH_RAW_SHARK];
That shouldn't make any difference at all because you aren't even harpoon fishing, but I've seen weirder things.

Troll

2011-07-27 09:05:43

Ok, i only just looked so i have not made the changes YET but i got the error again, so ill make them now :)

E:

i made the chages and im now confused, i get


[Error] (39:5): Unknown identifier 'FISHSPOT_NET' at line 38
Compiling failed.

which is the middle line of


case (Obj) of
FISHSPOT_NET:
Result := [FISH_SMALLNET];

I dont think i changed anything and im about to redownload MSI but i dont think i did any thing


Edit again:
It compiles now, no idea what i did :p

E: i know what i forgot to say, each time it has happened it has happened right after opening a box and getting the coins, atleast that is what is just before the out of range in the debug each time. So it happens right after opening the box. Ive made the changes and will post back later

E: Just got a random and then opened the box for coins, however it started (the script) in the random so it did the set up after the opening of the box so it may still be an error. Or it may be the changes you said to make

Coh3n

2011-07-27 14:34:50

Hm that's interesting indeed. I'm not really sure. I'm hoping the changes I made will work. Report back as soon as you know something. :)

E: I've made some changes to MSI_WaitWhileMining so this should be fixed. Please let me know if you still get the error.