Results 1 to 16 of 16

Thread: Need Help

  1. #1
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default Need Help

    Hey, I have finally decided to try making my first script, after following some tutorials I have found, and have made a rough start to mine. It is a fishing script and as far as I can tell, it should just about get the job done, but I plan to improve it a lot before releasing it into the First Scripts Section.
    However, when I try to run it, I get these errors:

    [Hint] C:\Simba\Includes\SRL/SRL/core/mapwalk.simba(1353:3): Variable 'BOX' never used at line 1352
    Compiled successfully in 765 ms.
    Error: Exception: Access violation at line 101

    If I comment out the Smart at the top, i only get the 'BOX' never used issue, but this means I can't even test the script without using smart.

    I have never had these issues with other scripts, so it's not a problem with my java/simba, it must be my script.
    Any ideas?
    Thanks in advance for any help
    Stu

    (Also, yes i have googled/searched, I'm not one of those guys who just makes a post straight away, but nothing seems to help)

  2. #2
    Join Date
    Dec 2011
    Location
    Kosovo
    Posts
    831
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    You are getting a problem on line 101.
    Please post the script here and I can c the problem. About the 'box' it's just a hint
    Goals:
    Understanding TPAs
    Making Proggy for fighting
    Getting on SRL members
    Get 500 posts

  3. #3
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    begin
    Writeln('Failed to find the color, no result.');
    ColorToleranceSpeed(tmpCTS);
    SetColorSpeed2Modifiers(0.2, 0.2);
    Exit;
    end;

    arC := GetColors(arP); <---101
    ClearSameIntegers(arC);
    arL := High(arC);

    This is from using AutoColorAid so i dont see why it would have an error?

  4. #4
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    I think the error is line 101 of the Smart code, as this tab comes up when i press play

  5. #5
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by stu View Post
    I think the error is line 101 of the Smart code, as this tab comes up when i press play
    if you post the full script then we will be able to help better

  6. #6
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

  7. #7
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    ok
    Like I said, it's just a start to see what does what, trying to teach myself with no prior knowledge. And once I get this working I'll rewrite all the bits that are copied, and improve it alot!
    -And i'm not sure if the part at the end of my "Spotfinding" procedure will work, so could you take a look at that for me?

    program Myfirstfisher;

    {$DEFINE SRL5}
    {$DEFINE SMART}

    {$i SRL/srl.simba}
    {$i SRL/SRL/misc/paintsmart.simba}

    Const

    //SRL Stats
    SRLStats_Username = '';
    SRLStats_Password = '';

    //General settings
    SwitchWorlds = True; //Switch worlds after break?

    //Break settings
    BreakIn = 235; //How long before we take a break? (minutes)
    BreakFor = 15; //How long will we break for? (minutes)
    Bir = 13; //Random minutes to add/subtract from how long until we break
    Bfr = 7; //Random minutes to add/subjtract from break duraction

    Var x, y, Tries, Tried, FishCounter: integer;

    Procedure DeclarePlayers;
    begin
    HowManyPlayers := 1;
    NumberOfPlayers(HowManyPlayers);
    CurrentPlayer := 0;
    with Players[0] do
    begin
    Name := '';
    Pass := '';
    BoxRewards := ['XP','xp','lamp'];
    LampSkill := Skill_Fishing;
    Active := True;
    end;
    end;

    Function Antiban: Boolean;
    var
    i: Integer;
    begin
    if not LoggedIn then Exit;
    FindNormalRandoms;

    i := Random(300);
    case i of
    1:
    begin
    RandomRClick;
    Result := True;
    end;
    2..5:
    begin
    KeyDown(40);
    Wait(RandomRange(500, 1100));
    KeyUp(40);
    Wait(RandomRange(310, 865));
    SetAngle(SRL_Angle_High);
    Result := True;
    end;
    6:
    begin
    HoverSkill('Fishing', False);
    Result := True;
    end;
    7..300:
    begin
    Wait(RandomRange(250, 350));
    Exit;
    end;
    end;

    Wait(RandomRange(250, 350));
    end;


    function SpotColor: Integer;
    var
    arP: TPointArray;
    arC: TIntegerArray;
    tmpCTS, i, arL: Integer;
    X, Y, Z: Extended;
    begin
    tmpCTS := GetColorToleranceSpeed;
    ColorToleranceSpeed(2);
    SetColorSpeed2Modifiers(0.27, 0.83);

    FindColorsSpiralTolerance(MSCX, MSCY, arP, 11708319, MSX1, MSY1, MSX2, MSY2, 7);
    if (Length(arP) = 0) then
    begin
    Writeln('Failed to find the color, no result.');
    ColorToleranceSpeed(tmpCTS);
    SetColorSpeed2Modifiers(0.2, 0.2);
    Exit;
    end;

    arC := GetColors(arP);
    ClearSameIntegers(arC);
    arL := High(arC);

    for i := 0 to arL do
    begin
    ColorToXYZ(arC[i], X, Y, Z);

    if (X >= 27.52) and (X <= 46.16) and (Y >= 28.88) and (Y <= 48.80) and (Z >= 39.69) and (Z <= 55.71) then
    begin
    Result := arC[i];
    Writeln('AutoColor = ' + IntToStr(arC[i]));
    Break;
    end;
    end;

    ColorToleranceSpeed(tmpCTS);
    SetColorSpeed2Modifiers(0.2, 0.2);

    if (i = arL + 1) then
    Writeln('AutoColor failed in finding the color.');
    end;


    Procedure Spotfinding;
    Begin
    If Not loggedin Then
    Exit;
    If (not (FindObjCustom(x, y, ['Use', 'rod'], [SpotColor], 5))) Then
    Wait(100+random(70));
    Tried:= Tries + 1;
    if(Tries = 15)Then
    Begin
    Logout;
    Exit;
    End else
    if FindObjCustom(x, y, ['Use', 'rod'], [SpotColor], 5)Then
    Mouse(x, y, 0, 0, True);
    End;

    Begin
    Repeat
    If InvCount=+1 Then
    MarkTime(FishCounter);
    Antiban;
    Wait(1000);
    Until(TimeFromMark(FishCounter) > 7000) or (InvFull)
    End.
    End.

    Procedure DropFish;
    Begin
    If InvFull Then
    DropAllExcept(1);
    End;

    Begin
    SetupSRL;
    Repeat
    Spotfinding;
    DropFish;
    AntiBan
    Until (False)
    End.

  8. #8
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Your last Until(False) in the main loop, switch it to
    Simba Code:
    Until(AllPlayersInactive)
    Other people have been getting the 101 error, also.

    In your global variables, it's easier to define x,y in them, but it's better if you define them in each procedure itself, to prevent any type of bugs.

    Simba Code:
    Begin
    Repeat
    If InvCount=+1 Then
    MarkTime(FishCounter);
    Antiban;
    Wait(1000);
    Until(TimeFromMark(FishCounter) > 7000) or (InvFull)
    End.
    End.
    You can't end the End's in periods, only the mainloop can. End them in ;
    Simba Code:
    Begin
    Repeat
    If InvCount=+1 Then
    MarkTime(FishCounter);
    Antiban;
    Wait(1000);
    Until(TimeFromMark(FishCounter) > 7000) or (InvFull)
    End;
    End;

    It's also better if you use the tab key, makes the script a lot easier to read.

    Try to keep all the Begins,Ends,Ifs,Thens,ect all the same. If you capitalize them, capitalize all of them. If not, make them all lowercase. They all look better lowercase, anyway. ;D

    Here's the script with all the spacing, to the best of my ability. (My standards aren't perfect)
    Simba Code:
    program Myfirstfisher;

    {$DEFINE SRL5}
    {$DEFINE SMART}

    {$i SRL/srl.simba}
    {$i SRL/SRL/misc/paintsmart.simba}

    Const

    //SRL Stats
    SRLStats_Username = '';
    SRLStats_Password = '';

    //General settings
    SwitchWorlds = True; //Switch worlds after break?

    //Break settings
    BreakIn = 235; //How long before we take a break? (minutes)
    BreakFor = 15; //How long will we break for? (minutes)
    Bir = 13; //Random minutes to add/subtract from how long until we break
    Bfr = 7; //Random minutes to add/subjtract from break duraction

    Var
     x, y, Tries, Tried, FishCounter: integer;

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name := '';
        Pass := '';
        BoxRewards := ['XP','xp','lamp'];
        LampSkill := Skill_Fishing;
        Active := True;
      end;
    end;

    Function Antiban: Boolean;
    var
    i: Integer;
    begin
      if not LoggedIn then Exit;
      FindNormalRandoms;
      i := Random(300);
      case i of
        1:
          begin
           RandomRClick;
           Result := True;
         end;
        2..5:
         begin
           KeyDown(40);
           Wait(RandomRange(500, 1100));
           KeyUp(40);
            Wait(RandomRange(310, 865));
            SetAngle(SRL_Angle_High);
            Result := True;
         end;
        6:
          begin
            HoverSkill('Fishing', False);
            Result := True;
          end;
        7..300:
          begin
            Wait(RandomRange(250, 350));
            Exit;
          end;
      end;

      Wait(RandomRange(250, 350));
    end;


    function SpotColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.27, 0.83);
      FindColorsSpiralTolerance(MSCX, MSCY, arP, 11708319, MSX1, MSY1, MSX2, MSY2, 7);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 27.52) and (X <= 46.16) and (Y >= 28.88) and (Y <= 48.80) and (Z >= 39.69) and (Z <= 55.71) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
      Writeln('AutoColor failed in finding the color.');
    end;


    Procedure Spotfinding;
    Begin
      If Not loggedin Then
      Exit;
      If (not (FindObjCustom(x, y, ['Use', 'rod'], [SpotColor], 5))) Then
      begin
        Wait(100+random(70));
        Tried:= Tries + 1;
      end;
      if(Tries = 15)Then
      Begin
      Logout;
      Exit;
      End else
      if FindObjCustom(x, y, ['Use', 'rod'], [SpotColor], 5)Then
      Mouse(x, y, 0, 0, True);
    End;
    ////////////What is this?
    //Begin
    //Repeat
    //  If InvCount=+1 Then
    //  begin
    //    MarkTime(FishCounter);
    //    Antiban;
    //    Wait(1000);
    //    end;
    //Until(TimeFromMark(FishCounter) > 7000) or (InvFull)
    //End;


    Procedure DropFish;
    Begin
    If InvFull Then
      DropAllExcept(1);
    End;

    Begin
      SetupSRL;
      Repeat
        Spotfinding;
        DropFish;
        AntiBan
      Until (AllPlayersInactive)
    End.
    Last edited by NKN; 04-15-2012 at 01:49 PM.

  9. #9
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    ok thanks, making these changes now
    the only reason they had periods instead of semi-colons is because i tried to compile and it said "period expected", thought it was wrong though

    edit:
    like this
    [Error] (149:6): period ('.') expected at line 148

    also my script is spaced with tabs in simba, just didnt come out like that when i pasted it here.
    What is the correct way to paste scripts?
    Last edited by stu; 04-15-2012 at 01:51 PM.

  10. #10
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Quote Originally Posted by stu View Post
    ok thanks, making these changes now
    the only reason they had periods instead of semi-colons is because i tried to compile and it said "period expected", thought it was wrong though

    edit:
    like this
    [Error] (149:6): period ('.') expected at line 148

    also my script is spaced with tabs in simba, just didnt come out like that when i pasted it here.
    What is the correct way to paste scripts?
    I commented all that out, because it wasn't in a procedure, which is why it said that. That might be the problem to your script.

    Instead of CODE tabs, use SIMBA tabs.

    If it's not in a procedure, it is the mainloop, so you need that in a procedure.

  11. #11
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    Ahh ok, thanks a lot for your help, sorry I'm such a noob.

    The part where you said "What is this?" is the main bit i wanted to test, as i was fairly sure it wouldn't work so I wanted to have a play with it.
    The plan was for it to start a counter every time a new fish is caught, and if that counter exceeds 7 seconds, to start spot finding again (as chances are this means the spot has moved)

  12. #12
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Make it a procedure.
    You ran it was your mainloop, so that would be all it would do, check for fish.

    Add it to one of your procedures after you defined it.

  13. #13
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    oh I see what you mean now. It is actually in my SpotFinding procedure, but the way i pasted it didn't really show that (as it doesn't show my tabbed lines)

    no wait my bad it's not, changing now :P

  14. #14
    Join Date
    Dec 2011
    Posts
    134
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    yay, with your fixes and a few tweaks i made i am no longer getting the error at line 101 error
    However i am getting a dialog box saying error starting SMART, ensure the applet page has target declaration, ill have a little search around to fix this

  15. #15
    Join Date
    Feb 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I got this error with smart, I had to un-install simba and re-install the last stable release, it also did not work with any of my ODTM's >.<

  16. #16
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Just start the script a few times, it'll work.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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