+ Reply to Thread
Results 1 to 8 of 8

Thread: Out of range in RunMe.simba

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default Out of range in RunMe.simba

    No idea why it would be this line, or this file. I can't see anything wrong with my setup, so could someone see if they get the same error. It's late and I have to get up early and I can't find the error.

    Anyway, it happens after looking for an object a couple times.
    Progress Report:
    Error: Out Of Range at line 69
    Simba Code:
    Location := LOC_VE_BANK; // Line 69 in RunMe.simba
    Progress Report:
    [0:00:03]: [ Ira ] -- MSI_SetupPlayer
    [0:00:05]: [ Ira ] ---- Scanning for randoms...
    [0:00:09]: [ Ira ] ---- MSI_BestTool
    [0:00:10]: [ Ira ] ------ CurrentSkill level: 31
    [0:00:10]: [ Ira ] ---- MSI_BestTool: Adamant pickaxe
    [0:00:10]: [ Ira ] ---- MSI_FindTool - GameTab: 26
    [0:00:11]: [ Ira ] ------ Failed to find tool: Adamant pickaxe
    [0:00:11]: [ Ira ] ---- MSI_FindTool: False
    [0:00:11]: [ Ira ] ---- MSI_FindTool - GameTab: 26
    [0:00:11]: [ Ira ] ------ Failed to find tool: Mithril pickaxe
    [0:00:11]: [ Ira ] ---- MSI_FindTool: False
    [0:00:11]: [ Ira ] ---- MSI_FindTool - GameTab: 26
    [0:00:11]: [ Ira ] ------ Failed to find tool: Steel pickaxe
    [0:00:11]: [ Ira ] ---- MSI_FindTool: False
    [0:00:11]: [ Ira ] ---- MSI_FindTool - GameTab: 26
    [0:00:11]: [ Ira ] ------ Found DTM: Iron pickaxe
    [0:00:11]: [ Ira ] ---- MSI_FindTool: True
    [0:00:11]: [ Ira ] -- MSI_SetupPlayer: True
    [0:00:12]: PROBLEM: deposit box interface not open
    [0:00:12]: [ Ira ] -- MSI_FindItemSlots: Found 0 Bronze pickaxe in inventory
    [0:00:12]: PROBLEM: deposit box interface not open
    [0:00:12]: [ Ira ] -- MSI_FindItemSlots: Found 0 Iron pickaxe in inventory
    [0:00:12]: PROBLEM: deposit box interface not open
    [0:00:12]: [ Ira ] -- MSI_FindItemSlots: Found 0 Steel pickaxe in inventory
    [0:00:12]: PROBLEM: deposit box interface not open
    [0:00:12]: [ Ira ] -- MSI_FindItemSlots: Found 0 Mithril pickaxe in inventory
    [0:00:12]: PROBLEM: deposit box interface not open
    [0:00:12]: [ Ira ] -- MSI_FindItemSlots: Found 0 Adamant pickaxe in inventory
    [0:00:12]: PROBLEM: deposit box interface not open
    [0:00:12]: [ Ira ] -- MSI_FindItemSlots: Found 0 Rune pickaxe in inventory
    [0:00:12]: [ Ira ] -- MSI_Walk
    [0:00:12]: [ Ira ] ---- Player's Location = Port Sarim deposit box
    [0:00:12]: [ Ira ] ---- MSI_PerfomWalk
    [0:00:12]: [ Ira ] ------ MSI_ReflectionWalk
    [0:00:12]: [ Ira ] ---------- Tile(2978, 3237) is on the minimap
    [0:00:13]: [ Ira ] -------- Player's Location = Rimmington mine
    [0:00:13]: [ Ira ] ------ MSI_ReflectionWalk: True
    [0:00:13]: [ Ira ] ---- MSI_PerformWalk: True
    [0:00:13]: [ Ira ] -- MSI_Walk: True
    [0:00:13]: [ Ira ] -- MSI_AutoObjects
    [0:00:13]: [ Ira ] ---- MSI_FindObjectsIn
    [0:00:13]: [ Ira ] ------ MSI_FindObjectsTPA
    [0:00:14]: [ Ira ] -------- Not enough points!
    [0:00:14]: [ Ira ] ------ MSI_FindObjectsTPA: True
    [0:00:14]: [ Ira ] ------ 4 objects found!
    [0:00:14]: [ Ira ] ------ Uptext didn't match!
    [0:00:14]: [ Ira ] ------ 4 objects found!
    [0:00:15]: [ Ira ] ------ Uptext didn't match!
    [0:00:15]: [ Ira ] ------ 4 objects found!
    [0:00:15]: [ Ira ] ------ Uptext didn't match!
    [0:00:15]: [ Ira ] ------ 4 objects found!
    [0:00:15]: [ Ira ] ------ Uptext didn't match!
    [0:00:15]: [ Ira ] ------ MSI_FindObjectsTPA
    [0:00:15]: [ Ira ] -------- No colors found!
    Error: Out Of Range at line 69
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
    File[C:\Simba\Includes\SRL\Logs\SRL Log 07-09-10 6.txt] has not been freed in the script, freeing it now.

    It wasn't happening before the update to the mainloop was made, so it could be something there, I'm not sure.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Line 767:
    Simba Code:
    if (InvCount > Length(MSI_FindAllToolSlots)) then
              goto AtBank;

    Line 801:
    Simba Code:
    AtBank:
    That's all I added

    I need to get to sleep too, but if nothing is figured out by tomorrow I'll go through and figure it out.

  3. #3
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Yeah I can't seem to find it. Also for the label, it should be placed before walking back to the bank because if you start the script with the player at the rocks, for example, it will try to open the bank when it's not at the bank.

    E: Hmm, it's working fine for woodcutting, so now I'm thinking the bug is in WaitWhileMining since it happened right after it clicked a rock.

    E2: Nevermind, after a couple minutes, same thing happened with wooductting. Could be in MSI_TrackObject?
    Last edited by Coh3n; 09-08-2010 at 03:25 PM.

  4. #4
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Yeah I can't seem to find it. Also for the label, it should be placed before walking back to the bank because if you start the script with the player at the rocks, for example, it will try to open the bank when it's not at the bank.

    E: Hmm, it's working fine for woodcutting, so now I'm thinking the bug is in WaitWhileMining since it happened right after it clicked a rock.

    E2: Nevermind, after a couple minutes, same thing happened with wooductting. Could be in MSI_TrackObject?
    I put it before Walking to the bank at first, but it returned an error that would have taken quite a few changes to fix, so I just put it before banking as it was late.

    I'll be back in about 30 mins to do some work though

    Edit:
    With AtBank: before walk to bank:
    Progress Report:
    [0:00:50]: [ Art ] ---- Scanning for randoms...
    [0:00:51]: [ Art ] ---- MSI_BestTool
    [0:00:52]: [ Art ] ------ CurrentSkill level: 73
    [0:00:52]: [ Art ] ---- MSI_BestTool: Rune pickaxe
    [0:00:52]: [ Art ] ---- MSI_FindTool - GameTab: 26
    [0:00:53]: [ Art ] ------ Found DTM: Rune pickaxe
    [0:00:53]: [ Art ] ---- MSI_FindTool: True
    [0:00:53]: [ Art ] -- MSI_SetupPlayer: True
    [0:00:54]: [ Art ] -- MSI_FindItemSlots: Found 0 Bronze pickaxe in inventory
    [0:00:54]: [ Art ] -- MSI_FindItemSlots: Found 0 Iron pickaxe in inventory
    [0:00:54]: [ Art ] -- MSI_FindItemSlots: Found 0 Steel pickaxe in inventory
    [0:00:54]: [ Art ] -- MSI_FindItemSlots: Found 0 Mithril pickaxe in inventory
    [0:00:54]: [ Art ] -- MSI_FindItemSlots: Found 0 Adamant pickaxe in inventory
    [0:00:54]: [ Art ] -- MSI_FindItemSlots: Found 0 Rune pickaxe in inventory
    [0:00:54]: [ Art ] -- MSI_Walk
    [0:00:54]: [ Art ] ---- Player's Location = Draynor Village bank
    [0:00:54]: [ Art ] -- MSI_Walk: True
    [0:00:54]: [ Art ] -- MSI_BankMaterials
    [0:00:56]: [ Art ] ------ MSI_CountItems: Found 5 of item Coal ore
    [0:01:01]: [ Art ] ------ MSI_CountItems: Found 1 of item Mithril ore
    [0:01:01]: [ Art ] ------ MSI_CountItems: Found 0 of item Adamantite ore
    [0:01:01]: [ Art ] ---- MSI_OpenBank
    [0:01:01]: [ Art ] ------ MSI_FindObjectsIn
    [0:01:01]: [ Art ] -------- MSI_FindObjectsTPA
    [0:01:01]: [ Art ] ---------- No colors found!
    Error: Out Of Range at line 69 {RunMe.Simba}


    It works if your in the bank, but not if you need to walk to get to the bank. I'm assuming this is because the Location show's that the character is already in the bank, even though it's not.

    Which means we will probably have to edit either the walking, or the way the location is used/set. The latter would be quite simple once the Relocator is finished. We could just loop through all the relocation points for the specific script, then do a distance check to find which we are closest to, and set the location accordingly.


    As for the error this thread is actually about, I'm going to run the miner now and see if I can't figure something out.

    Edit2:
    Just realized they are the same error...

    I'll let you know what I find out.

    Edit3:

    It's nothing to do with the label as I commented it all out and still get the error after every first click on a Rock..

    The Relocator is the first thing that comes to my mind that would be messing it up, but it's not even called in Mining, so I don't see how that's possible.

    Just commented out MSI_Relocate() and the error still continues, so that's not it...

    Reverted back to 260 (right before the label was committed) and it still didn't work. However, Rev 258 work's, which leads me to believe it must be something you committed with the Player Remote. Though, I still have no idea what it is.
    Last edited by NCDS; 09-09-2010 at 12:11 AM.

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    That's weird. I was out of the house all day today, and it looks like it may be similar tomorrow. We can just look at the .diff for revision 259 and see if there's anything that jumps out.

    E: It's too late, I have to go to bed. Here's what I've tried, and nothing's worked.
    • Setting ENABLE_REMOTE to False.
    • Disabling the Player Remote extension altogether.
    • Uncommenting the try statements in the INI functions (committed).
    • Reverting MSI_TrackObject back to exactly how it was in Revision 258.
    • Tried with woodcutting and mining.
    • Tested the Remote and INI functions several times without errors.

    Here's the .diff if someone else wants to take a look.
    Diff Code:
    Index: C:/Simba/Includes/SRL/SRL/msi/Debug.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Debug.simba   (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Debug.simba   (revision 259)
    @@ -28,6 +28,7 @@
     procedure MSI_Debug(debug: string);
     var
       DebugMSG, path, str: string;
    +  theFile: Integer;
     begin
       //Status(debug);
     
    Index: C:/Simba/Includes/SRL/SRL/msi/RunMe.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/RunMe.simba   (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/RunMe.simba   (revision 259)
    @@ -22,8 +22,8 @@
     
     const
       BREAK_TIME     = 15;    // Single player only - how long to break for (in minutes)
    -  SAVE_DEBUG     = False;  // Save's the debug box text to a file
    -  ENABLE_REMOTE  = False;  // Do you want to enable the Player Remote?
    +  SAVE_DEBUG     = True;  // Save's the debug box text to a file
    +  ENABLE_REMOTE  = True;  // Do you want to enable the Player Remote?
       LEVEL_TO_DEBUG = 10;    // The lower the number, the less the script will debug
     
       WORLD_SMART = 152;
    @@ -51,11 +51,11 @@
         Pin      := '';       // Bank pin; leave as '' if player doesn't have one
         Active   := True;     // Use this player?
         Member   := False;    // Is this player a member?
    -    Location := ;         // See instructions at the top
    +    Location := 0;        // See instructions at the top
         Scripts  := [];       // See instructions at the top
         Objects  := [[]];     // See instructions at the top
         Loads[0] := 0;        // Amount of loads before breaking/switching players
    -    Loads[1] := 999;        // Total loads for the player to do
    +    Loads[1] := 0;        // Total loads for the player to do
       end;
     {
       with MSI_Players[1] do
    @@ -203,9 +203,6 @@
         ReflectionBroken := True; // Set to true because it's not even being used
       {$ENDIF}
     
    -  if (ReflectionBroken) then
    -    Writeln('** REFLECTION HOOKS OUTDATED **');
    -
       LevelToDebug   := LEVEL_TO_DEBUG;
       BreakTime      := BREAK_TIME;
       SaveDebug      := SAVE_DEBUG;
    @@ -214,9 +211,9 @@
       Stats_UserID   := STATS_ID;
       Stats_Password := STATS_PASS;
       Stats_ScriptID := '47';
    +  CurrDebugLevel := 1;
     
       DeclarePlayers;
    -  RewriteFile(IncludePath + 'SRL/SRL/msi/Player.INI', False);
       MSI_Mainloop;
     end.
     
    Index: C:/Simba/Includes/SRL/SRL/msi/Objects.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Objects.simba (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Objects.simba (revision 259)
    @@ -712,6 +712,9 @@
     Begin
       If (Not LoggedIn) Then Exit;
     
    +  try
    +    MSI_AddHeader('MSI_FindObjectsTPA');
    +
       CTS := GetColorToleranceSpeed;
       ColorToleranceSpeed(2);
       SetColorSpeed2Modifiers(MSI_Objects[objID].Hue, MSI_Objects[objID].Sat);
    @@ -731,7 +734,7 @@
         For I := 0 To H Do
           If (Length(ATPA) < 1) Then
           Begin
    -        MSI_SubDebug('MSI_FindObjectsTPA: All colors weren''t found!');
    +        MSI_Debug('All colors weren''t found!');
             Objs := [];
             Exit;
           End;
    @@ -741,7 +744,7 @@
     
       If (Length(TPA) < MSI_Objects[objID].Accuracy) Then
       Begin
    -    MSI_SubDebug('MSI_FindObjectsTPA: No colors found!');
    +    MSI_Debug('No colors found!');
         Objs := [];
         Exit;
       End;
    @@ -781,7 +784,7 @@
         If MSI_Objects[objID].Anim Then
           If (Not Animating2[I]) Then
           Begin
    -        MSI_SubDebug('MSI_FindObjectsTPA: Not animating!');
    +        MSI_Debug('Not animating!');
             BadPoint := True;
           End;
     
    @@ -790,7 +793,7 @@
         If MSI_Objects[objID].ExcludeSelf Then
           If PointInBox(TPA[I], Box) Then
           Begin
    -        MSI_SubDebug('MSI_FindObjectsTPA: Own character!');
    +        MSI_Debug('Own character!');
             BadPoint := True;
           End;
     
    @@ -798,7 +801,7 @@
         If (Not BadPoint) Then
         If ((TPA[I].X + TPA[I].Y) < 1) Then
         Begin
    -      MSI_SubDebug('MSI_FindObjectsTPA: Invalid point!');
    +      MSI_Debug('Invalid point!');
           BadPoint := True;
         End;
     
    @@ -806,7 +809,7 @@
         If (Not BadPoint) Then
         If (Length(ATPA[I]) < MSI_Objects[objID].Accuracy) Then
         Begin
    -      MSI_SubDebug('MSI_FindObjectsTPA: Not enough points!');
    +      MSI_Debug('Not enough points!');
           BadPoint := True;
         End;
     
    @@ -817,7 +820,7 @@
           MSI_Debug('Looking for bad color: '+IntToStr(MSI_Objects[objID].BadColors[II]));
           If FindColorSpiralTolerance(TMP, TMP, MSI_Objects[objID].BadColors[II], TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2), MSI_Objects[objID].BadColorTolerance) Then
           Begin
    -        MSI_SubDebug('MSI_FindObjectsTPA: Bad color found!');
    +        MSI_Debug('Bad color found!');
             BadPoint := True;
             Break;
           End;
    @@ -831,7 +834,7 @@
             TempTPA := MSI_ReturnPointsInBox(ATPA[II], IntToBox(TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2)));
             If (Length(TempTPA) < 1) Then
             Begin
    -          MSI_SubDebug('MSI_FindObjectsTPA: All colors weren''t found!');
    +          MSI_Debug('All colors weren''t found!');
               BadPoint := True;
               Break;
             End;
    @@ -846,7 +849,9 @@
       End;
     
       Result := (Length(Objs) > 0);
    -  MSI_Debug('MSI_FindObjectsTPA: ' + BoolToStr(Result));
    +  finally
    +    MSI_CloseHeader('MSI_FindObjectsTPA: ' + BoolToStr(Result));
    +  end;
     End;
     
     
    @@ -859,7 +864,7 @@
     function MSI_TrackObject(ObjID: integer): boolean;
     var
       TPA: TPointArray;
    -  CTS, T, CurrentLevel: integer;
    +  CTS, T: integer;
       B: TBox;
       Previous: TPoint;
     begin
    @@ -869,22 +874,6 @@
       ColorToleranceSpeed(2);
       SetColorSpeed2Modifiers(MSI_Objects[ObjID].Hue, MSI_Objects[ObjID].Sat);
     
    -  {ensures we have started moving}
    -  //RM - why do we waste time on this...?
    -  {
    -  T := GetSystemTime + 3000;
    -  while (GetSystemTime < T) do
    -  begin
    -    if (FlagPresent) or (IsMoving) then
    -      Break;
    -    Wait(20);
    -  end;
    -  }
    -
    -  //to avoid an awful lot of debugs
    -  CurrentLevel := CurrDebugLevel;
    -  CurrDebugLevel := LevelToDebug + 1;
    -
       //Preparing vars for loop
       Previous := Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);
       T := GetSystemTime + 30000;
    @@ -896,7 +885,6 @@
         if MSI_FindObjectsTPA(TPA, ObjID, B) then
           MiddleTPAEx(TPA, MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y)
         else begin
    -      CurrDebugLevel := CurrentLevel;
           MSI_SubDebug('Lost track of object');
           Result := false;
           break;
    @@ -911,10 +899,8 @@
         Previous := Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);
     
         Wait(5);
    -  until (T < GetSystemTime)
    +  until (T < GetSystemTime);
     
    -  CurrDebugLevel := CurrentLevel;
    -
       SetColorSpeed2Modifiers(0.2, 0.2);
       ColorToleranceSpeed(2);
     end;
    Index: C:/Simba/Includes/SRL/SRL/msi/Extensions/msi_player_remote.sex
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Extensions/msi_player_remote.sex  (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Extensions/msi_player_remote.sex  (revision 259)
    @@ -4,6 +4,8 @@
      * [url]http://villavu.com/forum/forumdisplay.php?f=313[/url]
      *
      *   - Coh3n
    + *
    + * - This extension was last updated 07 September 2010 by Coh3n
      *)
     
     program MSI_Player_Remote;
    @@ -35,6 +37,8 @@
       SKILL_SUMMONING     = 23;
       SKILL_DUNGEONEERING = 24;
     
    +  PLAYER_TXT_PATH = IncludePath + 'SRL\SRL\MSI\Player.txt';
    +
     function MSI_MirrorTPA(TPA: TPointArray): TPointArray;
     var
       i, h: integer;
    @@ -94,15 +98,15 @@
       for i:=0 to High(Playersss) do
         with Playersss[i] do
         begin
    -      Active:= StrToBool(ReadINI(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
    -      Location:= MSI_Locations[StrToInt(ReadINI(IntToStr(i), 'Location', IncludePath+'SRL\SRL\MSI\Player.INI'))].Name;
    +      Active:= StrToBool(ReadINI(IntToStr(i), 'Active', PLAYER_TXT_PATH));
    +      Location:= MSI_Locations[StrToInt(ReadINI(IntToStr(i), 'Location', PLAYER_TXT_PATH))].Name;
     
    -      LengthOfScripts:= StrToInt(ReadINI(IntToStr(i), 'ScriptAmount', IncludePath+'SRL\SRL\MSI\Player.INI'));
    +      LengthOfScripts:= StrToInt(ReadINI(IntToStr(i), 'ScriptAmount', PLAYER_TXT_PATH));
     
           SetLength(Scripts, LengthOfScripts);
     
           for j := 0 to High(Scripts) do
    -        Scripts[j]:= MSI_Scripts[StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j), IncludePath+'SRL\SRL\MSI\Player.INI'))].Name;
    +        Scripts[j]:= MSI_Scripts[StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j), PLAYER_TXT_PATH))].Name;
         end;
     end;
     
    @@ -136,17 +140,17 @@
       i, x, j: Integer;
     Begin
       WriteLn('Saving!');
    -  WriteINI('Changed', 'Changed', 'True', IncludePath+'SRL\SRL\MSI\Player.INI');
    +  WriteINI('Changed', 'Changed', 'True', PLAYER_TXT_PATH);
       for i:=0 to High(Playersss) do
       begin
    -    WriteINI(IntToStr(i), 'Active', BoolToStr(ActiveBox[i].Checked), IncludePath+'SRL\SRL\MSI\Player.INI');
    +    WriteINI(IntToStr(i), 'Active', BoolToStr(ActiveBox[i].Checked), PLAYER_TXT_PATH);
         for x:=0 to High(MSI_Locations) do
           if MSI_Locations[x].Name = Location[i].Text then
    -        WriteINI(IntToStr(i), 'Location', IntToStr(MSI_Locations[x].Constant), IncludePath+'SRL\SRL\MSI\Player.INI');
    +        WriteINI(IntToStr(i), 'Location', IntToStr(MSI_Locations[x].Constant), PLAYER_TXT_PATH);
         {for x:=0 to High(MSI_Scripts) do
           for j:=0 to High(Script[i]) do
             if MSI_Scripts[x].Name = Script[i][j].Text then
    -          WriteINI(IntToStr(i), 'Script'+IntToStr(j), IntToStr(MSI_Scripts[x].Constant), IncludePath+'SRL\SRL\MSI\Player.INI');}
    +          WriteINI(IntToStr(i), 'Script'+IntToStr(j), IntToStr(MSI_Scripts[x].Constant), PLAYER_TXT_PATH);}
       end;
       frmDesign.ModalResult:= mrOk;
     End;
    @@ -319,7 +323,7 @@
     begin
       //MSI_LoadAllScripts;
       MSI_LoadAllLocations;
    -  HowManyPlayerss:= StrToInt(ReadINI('HowMany', 'HowMany', IncludePath+'SRL\SRL\MSI\Player.INI'));
    +  HowManyPlayerss:= StrToInt(ReadINI('HowMany', 'HowMany', PLAYER_TXT_PATH));
       if (HowManyPlayerss>-1) then
       begin
         Writeln('Opening Player Remote');
    Index: C:/Simba/Includes/SRL/SRL/msi/Skills/Woodcutting.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Skills/Woodcutting.simba  (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Skills/Woodcutting.simba  (revision 259)
    @@ -37,7 +37,7 @@
     {******************************************************************************}
     { Procedure WaitWhileChopping(TreeX, TreeY: Integer; TreeInfo: TMSObject);     }
     { By: marpis                                                                   }
    -{ Date: 11 July 2010                                                           }
    +{ Date: 07 September 2010                                                      }
     { Description: Wait while tree's been cut                                      }
     {******************************************************************************}
     Procedure MSI_WaitWhileChopping(TreeID: integer);
    @@ -100,7 +100,10 @@
           Repeat
             R := RandomRange(Tab_Combat, Tab_Notes);
           Until(R <> CT);
    -      GameTab(R);
    +
    +      if (R <> tab_Diary) then
    +        GameTab(R);
    +
           Wait(RandomRange(500, 1000));
           GameTab(tab_Inv);
         End;
    Index: C:/Simba/Includes/SRL/SRL/msi/Antiban.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Antiban.simba (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Antiban.simba (revision 259)
    @@ -11,12 +11,12 @@
     {******************************************************************************}
     { Procedure MSI_AntiBan(HowLong, ChancePerc: Integer);                         }
     { By: Naum                                                                     }
    -{ Date: 10 June 2010                                                           }
    +{ Date: 07 September 2010                                                      }
     { Description: The AntiBan procedure to be used throughout the scripts.        }
     {******************************************************************************}
     Procedure MSI_AntiBan(HowLong, ChancePerc: Integer);
     Var
    -  CurTab, I, Time : Integer;
    +  RanTab, I, Time : Integer;
     Begin
       if (Random(100) > ChancePerc) then
         Exit;
    @@ -27,10 +27,11 @@
          Case Random(3) Of
             0 : SleepAndMoveMouse(HowLong + Random(HowLong/10));
             1 : Begin
    -              CurTab := GetCurrentTab;
    -              GameTab(RandomRange(TAB_Combat, TAB_LogOut));
    +              RanTab := RandomRange(TAB_Combat, TAB_LogOut);
    +              if (RanTab <> tab_Diary) then
    +                GameTab(RanTab);
                   Wait(HowLong + Random(HowLong/10));
    -              GameTab(CurTab);
    +              GameTab(tab_Inv);
                 End;
             2 : RandomRClick;
           End;
    @@ -68,8 +69,6 @@
             end;
           end;
       End;
    -
    -  GameTab(tab_Inv); // For inventory checks in the skills functions
     End;
     
     {******************************************************************************}
    @@ -83,7 +82,7 @@
       if (not LoggedIn) then
         Exit;
     
    -  MSI_SubDebug('Scanning for randoms...');
    +  MSI_Debug('Scanning for randoms...');
     
       if (FindNormalRandoms) then
       begin
    Index: C:/Simba/Includes/SRL/SRL/msi/Mainloop.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Mainloop.simba    (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Mainloop.simba    (revision 259)
    @@ -111,7 +111,7 @@
       gameTabs, FishingTool: TIntegerArray;
       script: TScript;
     begin
    -  try MSI_AddHeader('MSI_SetupPlayer');
    +  MSI_AddHeader('MSI_SetupPlayer');
     
       if (not LoggedIn) then
         LoginPlayer;
    @@ -138,6 +138,7 @@
                   if (MSI_FindTool(k, gameTabs[j], x, y)) then
                   begin
                     Result := True;
    +                MSI_CloseHeader('MSI_SetupPlayer: ' + BoolToStr(Result));
                     Exit;
                   end;
     
    @@ -146,11 +147,10 @@
               begin
                 if (script.BankType = NoBank) then
                 begin
    -              MSI_Debug('Failed to find required tool');
    +              MSI_CloseHeader('MSI_SetupPlayer: ' + BoolToStr(Result));
                   Exit;
                 end;
     
    -
                 if (MSI_OpenBank(Script.WhichBank, MSI_Players[CurrentPlayer].Pin)) then
                   for k := bestTool downto worstTool do
                     if (MSI_Withdraw([k], [1])) then
    @@ -184,7 +184,7 @@
               begin
                 if (script.BankType = NoBank) then
                 begin
    -              MSI_Debug('Failed to find required tool');
    +              MSI_CloseHeader('MSI_SetupPlayer: ' + BoolToStr(Result));
                   Exit;
                 end;
     
    @@ -206,9 +206,7 @@
             MSI_Debug('Invalid tool option in script: ' + script.Name);
         end;
     
    -  finally
    -    MSI_CloseHeader('MSI_SetupPlayer: ' + BoolToStr(Result));
    -  end;
    +  MSI_CloseHeader('MSI_SetupPlayer: ' + BoolToStr(Result));
     end;
     
     {******************************************************************************}
    @@ -533,7 +531,7 @@
     {******************************************************************************}
     procedure MSI_SetPlayerInfo;
     var
    -  i, j, k: Integer;
    +  i, j, k, l: Integer;
       script: TScript;
       intObjects: array of TIntegerArray;
       intItems: array of array of TIntegerArray;
    @@ -585,7 +583,10 @@
     
               intItems[j][k]    := MSI_VarToIntArray(Items[j][k]);
               ItemNames[j][k]   := MSI_GetItemNames(intItems[j][k]);
    -          Experiences[j][k] := MSI_GetItemExperiences(intItems[j][k]);
    +          Experiences[j][k] := MSI_GetItemExperiences(script.SkillConstant, intItems[j][k]);
    +
    +          for l := 0 to High(Experiences[j][k]) do
    +            MSI_Debug('Player['+IntToStr(i)+'].Scripts['+IntToStr(j)+'].Objects['+IntToStr(k)+'] Experience = '+FloatToStr(Experiences[j][k][l]));
             end;
           end;
         end;
    @@ -629,55 +630,86 @@
     end;
     
     {******************************************************************************}
    -{ procedure MSI_WritePlayerINI;                                                }
    -{ By: Shuttleu & Coh3n                                                         }
    -{ Date: 31 August 2010                                                         }
    -{ Description: Writes the required Player Remote settings to an INI            }
    +{ procedure MSI_DeleteINI;                                                     }
    +{ By: Coh3n                                                                    }
    +{ Date: 07 September 2010                                                      }
    +{ Description: Deletes the Player.INI titles and leaves an empty file          }
     {******************************************************************************}
    -procedure MSI_WritePlayerINI;
    +procedure MSI_DeleteINI;
     var
       i: Integer;
     begin
       if (not RemoteEnabled) then
    -  begin
    -    MSI_SubDebug('Player Remote disabled!');
         Exit;
    -  end;
     
    -  try
    -    if (FileExists(IncludePath+'SRL\SRL\MSI\Player.INI')) then
    -      if (Length(ReadINI('Changed', 'Changed', ScriptPath+'Player.INI')) > 0) then
    -        if StrToBool(ReadINI('Changed', 'Changed', IncludePath+'SRL\SRL\MSI\Player.INI')) then
    -          for i := 0 to High(MSI_Players) do
    -          begin
    -            MSI_Players[i].Active:= StrToBool(ReadINI(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
    -            MSI_Players[i].Location:= StrToInt(ReadINI(IntToStr(i), 'Location', IncludePath+'SRL\SRL\MSI\Player.INI'));
    -            Players[i].Active := MSI_Players[i].Active;
    -          {
    -            if (Length(MSI_Players[i].Scripts) > 0) then
    -              for j := 0 to High(MSI_Players[i].Scripts) do
    -                MSI_Players[i].Scripts[j]:= StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j), IncludePath+'SRL\SRL\MSI\Player.INI'));
    -          }
    -          end;
    +  //try
    +    DeleteINI('Changed', 'Changed', PLAYER_INI_PATH);
    +    DeleteINI('HowMany', 'HowMany', PLAYER_INI_PATH);
     
    -    WriteINI('Changed', 'Changed', 'False', IncludePath+'SRL\SRL\MSI\Player.INI');
    -    WriteINI('HowMany', 'HowMany', IntToStr(Length(MSI_Players)), IncludePath+'SRL\SRL\MSI\Player.INI');
    +    for i := 0 to High(MSI_Players) do
    +    begin
    +      DeleteINI(IntToStr(i), 'Active', PLAYER_INI_PATH);
    +      DeleteINI(IntToStr(i), 'Location', PLAYER_INI_PATH);
    +    end;
    +  //except
    +    //MSI_Debug('MSI_DeleteINI: Error!');
    +  //end;
    +end;
     
    +{******************************************************************************}
    +{ procedure MSI_WriteINI;                                                      }
    +{ By: Coh3n                                                                    }
    +{ Date: 07 September 2010                                                      }
    +{ Description: Writes the initial Player.INI; should only be called once at    }
    +{              the beginning of the script                                     }
    +{******************************************************************************}
    +procedure MSI_WriteINI;
    +var
    +  i: Integer;
    +begin
    +  if (not RemoteEnabled) then
    +    Exit;
    +
    +  //try
    +    MSI_DeleteINI;
    +
    +    WriteINI('Changed', 'Changed', 'False', PLAYER_INI_PATH);
    +    WriteINI('HowMany', 'HowMany', IntToStr(Length(MSI_Players)), PLAYER_INI_PATH);
    +
         for i := 0 to High(MSI_Players) do
         begin
    -      WriteINI(IntToStr(i), 'Active', BoolToStr(MSI_Players[i].Active), IncludePath+'SRL\SRL\MSI\Player.INI');
    -      WriteINI(IntToStr(i), 'Location', IntToStr(MSI_Players[i].Location), IncludePath+'SRL\SRL\MSI\Player.INI');
    -    {
    -      WriteINI(IntToStr(i), 'ScriptAmount', IntToStr(Length(MSI_Players[i].Scripts)), IncludePath+'SRL\SRL\MSI\Player.INI');
    -
    -      if (Length(MSI_Players[i].Scripts) > 0) then
    -        for j := 0 to High(MSI_Players[i].Scripts) do
    -          WriteINI(IntToStr(i), 'Script'+IntToStr(j), IntToStr(MSI_Players[i].Scripts[j]), IncludePath+'SRL\SRL\MSI\Player.INI');
    -    }
    +      WriteINI(IntToStr(i), 'Active', BoolToStr(MSI_Players[i].Active), PLAYER_INI_PATH);
    +      WriteINI(IntToStr(i), 'Location', IntToStr(MSI_Players[i].Location), PLAYER_INI_PATH);
         end;
    +  //except
    +    //MSI_Debug('MSI_WriteINI: Error! Retrying...');
    +  //end;
    +end;
     
    +{******************************************************************************}
    +{ procedure MSI_ResetINI;                                                      }
    +{ By: Coh3n                                                                    }
    +{ Date: 07 September 2010                                                      }
    +{ Description: Checks to see if Player.INI was updated. If so, it updates the  }
    +{              necessary player attributes                                     }
    +{******************************************************************************}
    +procedure MSI_ResetINI;
    +var
    +  i: Integer;
    +begin
    +  if (not RemoteEnabled) then
    +    Exit;
    +
    +  try
    +    if (StrToBool(ReadINI('Changed', 'Changed', PLAYER_INI_PATH))) then
    +      for i := 0 to High(MSI_Players) do
    +      begin
    +        MSI_Players[i].Active:= StrToBool(ReadINI(IntToStr(i), 'Active', PLAYER_INI_PATH));
    +        MSI_Players[i].Location:= StrToInt(ReadINI(IntToStr(i), 'Location', PLAYER_INI_PATH));
    +        Players[i].Active := MSI_Players[i].Active;
    +      end;
       except
    -    MSI_SubDebug('MSI_WritePlayerINI: Error reading/writing Player.INI!');
    +    MSI_Debug('MSI_ResetINI: Error!');
       end;
     end;
     
    @@ -693,7 +725,7 @@
     begin
       MSI_SetPlayerInfo;
       MSI_SetReportInfo;
    -  MSI_WritePlayerINI;
    +  MSI_WriteINI;
     
       ScriptStart := TheDate(DATE_DAY) + ' at ' + TheTime;
       ScriptStart := Replace(scriptStart, ':', ' ');
    @@ -711,7 +743,7 @@
         SmartSetDebug(True);
     
       repeat
    -    MSI_WritePlayerINI;
    +    MSI_ResetINI;
         tmpLoads := 0;
     
         // Setup player
    @@ -777,7 +809,7 @@
           end;
     
           MSI_ProgressReport;
    -      MSI_WritePlayerINI;
    +      MSI_ResetINI;
     
           with ProgressReportArray[CurrentPlayer] do
             if (LoadsDone >= (MSI_Players[CurrentPlayer].Loads[L_TOTAL] + RandomRange(-10, 10))) then
    @@ -814,9 +846,9 @@
     {******************************************************************************}
     procedure MSI_ScriptTerminate;
     begin
    +  MSI_ProgressReport;
       Writeln('Thank-you for using MSI Phoenix scripts!');
    -  MSI_ProgressReport;
    +  MSI_DeleteINI;
       FreeSRL;
       MSI_FreeAllItems;
    -  RewriteFile(IncludePath + 'SRL/SRL/msi/Player.INI', False);
     end;
    Index: C:/Simba/Includes/SRL/SRL/msi/Items.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Items.simba   (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Items.simba   (revision 259)
    @@ -1011,12 +1011,12 @@
     end;
     
     {******************************************************************************}
    -{ function MSI_GetItemExperiences(Objects: TIntegerArray): TExtendedArray;     }
    +{ function MSI_GetItemExperiences(...): TExtendedArray;                        }
     { By: The MSI Team                                                             }
     { Date: 03 July 2010                                                           }
     { Description: Retunrs an array of experiences depending on the objects array  }
     {******************************************************************************}
    -function MSI_GetItemExperiences(Items: TIntegerArray): TExtendedArray;
    +function MSI_GetItemExperiences(Skill: Integer; Items: TIntegerArray): TExtendedArray;
     var
       i: integer;
       e: extended;
    @@ -1024,7 +1024,7 @@
       for i := 0 to High(Items) do
       begin
         e := 0;
    -    case MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript]].SkillConstant of
    +    case Skill of
           SKILL_WOODCUTTING:
             case Items[i] of
               LOGS_NORMAL : e := 25.0;
    @@ -1035,7 +1035,7 @@
               LOGS_MAGIC  : e := 250.0;
     
               else
    -            MSI_SubDebug('MSI_GetItemExperiences: Invalid item for woodcutting');
    +            MSI_SubDebug('MSI_GetItemExperiences: Invalid item for woodcutting ' + IntToStr(Items[i]));
             end;
     
           SKILL_MINING:
    @@ -1226,7 +1226,7 @@
           end;
         end;
     
    -  MSI_SubDebug('MSI_FindItemSlots: Found '+IntToStr(Length(result))+' '+MSI_Items[Item].Name+' in inventory');
    +  MSI_Debug('MSI_FindItemSlots: Found '+IntToStr(Length(result))+' '+MSI_Items[Item].Name+' in inventory');
     end;
     
     {******************************************************************************}
    Index: C:/Simba/Includes/SRL/SRL/msi/Globals.simba
    ===================================================================
    --- C:/Simba/Includes/SRL/SRL/msi/Globals.simba (revision 258)
    +++ C:/Simba/Includes/SRL/SRL/msi/Globals.simba (revision 259)
    @@ -69,6 +69,8 @@
       RELOCATE_MIN_DIST    = 3;     // Minimum pixel distance from the player to relocation point
       RELOCATE_TIME        = 8000;  // Time (in ms) to wait before relocating
     
    +  PLAYER_INI_PATH = IncludePath + 'SRL\SRL\MSI\Player.txt'; // The path location for the player remote file
    +
     (**
      * Represents the stats system's custom variable array indexes
      *)
    If we can't find what's wrong soon we may have to revert back to 258 and I'll have to redo the updates I made and hopefully find what happened.
    Last edited by Coh3n; 09-09-2010 at 05:50 AM.

  6. #6
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Well I reverted back to revision 258 and started doing the updates I made one by one and after a few minutes found the error. I made MSI_FindObjectsTPA the same as it was in revision 258.

    The only thing I changed was the debugging. I changed all the MSI_SubDebugs to MSI_Debugs, and added a MSI_AddHeader/CloseHeader. I also put everything in a try..finally statement. As soon as I changed everything back it all worked.

    So could someone please test this out to make sure the error is really gone? Thanks.

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Well I reverted back to revision 258 and started doing the updates I made one by one and after a few minutes found the error. I made MSI_FindObjectsTPA the same as it was in revision 258.

    The only thing I changed was the debugging. I changed all the MSI_SubDebugs to MSI_Debugs, and added a MSI_AddHeader/CloseHeader. I also put everything in a try..finally statement. As soon as I changed everything back it all worked.

    So could someone please test this out to make sure the error is really gone? Thanks.
    Tested about half a load at LWS mine and everything went great

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Tested about half a load at LWS mine and everything went great
    Awesome!

    Probably one of the weirdest errors I've seen...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may post attachments
  • You may edit your posts
  •