Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 52

Thread: Request a Function/Procedure

  1. #26
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh. I guess I didn't notice that :O

    Thanks for the advice and help. You've helped me finish my first script

  2. #27
    Join Date
    Nov 2011
    Location
    Jozi, South Africa
    Posts
    249
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No trouble at all. Good luck!
    Ciao
    NM

  3. #28
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    "[Error] (55:1): Identifier expected at line 54
    Compiling failed."

    This happened when I tried to compile my script after adding a proggy system. If anyone can help me I can send the entire script so you can help me out.

  4. #29
    Join Date
    Nov 2011
    Location
    Jozi, South Africa
    Posts
    249
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Smile Help on it's way

    Just post the procedure / function that line 54 is in.
    Ciao
    NM

  5. #30
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    procedure WalkBank;

  6. #31
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Phyaskou View Post
    procedure WalkBank;
    Did you miss an end; ?
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  7. #32
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Daniel View Post
    Did you miss an end; ?
    Turns out that I did. I had to put another 'End;' before the 'procedure WalkBank;'

    Thanks

  8. #33
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Phyaskou View Post
    Turns out that I did. I had to put another 'End;' before the 'procedure WalkBank;'

    Thanks
    All goods Do you need any more help?
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  9. #34
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Daniel View Post
    All goods Do you need any more help?
    Trying to add Progress Report System but it doesn't seem to work......

  10. #35
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Getting this when I try to compile my SwampToad Picker :
    "[Error] (59:12): Unknown identifier 'x' at line 58
    Compiling failed."

    if FindObj(x, y, 'taircase', 396561, 3) then

    That is the line it says that at.

  11. #36
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Phyaskou View Post
    Getting this when I try to compile my SwampToad Picker :
    "[Error] (59:12): Unknown identifier 'x' at line 58
    Compiling failed."

    if FindObj(x, y, 'taircase', 396561, 3) then

    That is the line it says that at.
    You need to declare 'x', like so: var x: Integer;
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  12. #37
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That worked and I forgot the ';' everytime after every procedure so it didn't compile until I figured it out.

  13. #38
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Edit : Nvm. Fixed it up.
    Last edited by Striken; 02-06-2012 at 01:21 AM.

  14. #39
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    what does tpointarray do? I was making a universal walkbank; procedure and i cant seem to get it to stick? any tips, dymamite?

  15. #40
    Join Date
    Dec 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright I gotta question ok so basically I want it to click the circled water source symbol

    and I never want it to click the other one to the north so I would like some help on FindSymbolMulti and stuff like that

    also one more question
    how do I do like
    if not findobj for 5000 then
    basicaly I want it if it cant find a warrior for five seconds then have it click on the circled water source to find more of em
    Last edited by poopy2177; 02-19-2012 at 09:11 PM.
    My Soul Wars Scipt Proggress:[100%....]
    Probably won't release though I like it for myself

  16. #41
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    procedure Obstacle;
    var x, y: integer;
    begin
    repeat
    FindNormalRandoms;
    WriteLn('Looking for obstacle net.');
    if FindObj(x, y, 'bstacle net', 4084847, 10) then
    WriteLn('Climbing Obstacle.');
    Mouse(x, y, 0, 0, true);
    If isUpText('limb-over') then
    ChooseOption('limb-over');
    end;

    [Error] (34:1): Identifier expected at line 33
    Compiling failed.

    Line 33 is "end;"

  17. #42
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Simba Code:
    function TrapDoorColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.20, 0.35);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 6186359, MSX1, MSY1, MSX2, MSY2, 24);
      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 >= 2.76) and (X <= 36.79) and (Y >= 2.82) and (Y <= 37.91) and (Z >= 2.39) and (Z <= 40.51) 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;

    ACA function for finding the door colors but I couldn't seen to find anywhere how to add in to climb down it, anyone free to help would be greatly appreciated.
    -GOOGLE

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

    Default

    Quote Originally Posted by poopy2177 View Post
    Alright I gotta question ok so basically I want it to click the circled water source symbol

    and I never want it to click the other one to the north so I would like some help on FindSymbolMulti and stuff like that

    also one more question
    how do I do like
    if not findobj for 5000 then
    basicaly I want it if it cant find a warrior for five seconds then have it click on the circled water source to find more of em
    There is a function
    Simba Code:
    FindSymbol(var rx, ry: Integer; Name: string) : Boolean;

    you could do something like

    Simba Code:
    Procedure ClickFountain;
    Var
      x, y : integer
    begin
      if(FindSymbol(x, y, 'water source'))then
        Mouse(x, y, 5, 5, mouse_Left);
    end;

    Quote Originally Posted by Phyaskou View Post
    Simba Code:
    procedure Obstacle;
    var x, y: integer;
    begin
    repeat
    FindNormalRandoms;
    WriteLn('Looking for obstacle net.');
    if FindObj(x, y, 'bstacle net', 4084847, 10) then
    WriteLn('Climbing Obstacle.');
    Mouse(x, y, 0, 0, true);
    If isUpText('limb-over') then
    ChooseOption('limb-over');
    end;

    [Error] (34:1): Identifier expected at line 33
    Compiling failed.

    Line 33 is "end;"
    You need an "Until" at the end for your "Repeat" part:
    Simba Code:
    Repeat
      ItIsRaining;
    Until(ItIsntRaining);

    So yours would look like:
    Simba Code:
    procedure Obstacle;
    var
      x, y: integer;
    begin
      repeat
        FindNormalRandoms;
        WriteLn('Looking for obstacle net.');
        if FindObj(x, y, 'bstacle net', 4084847, 10) then
          begin
            WriteLn('Climbing Obstacle.');
            Mouse(x, y, 0, 0, true);
            If isUpText('limb-over') then
              begin
                ChooseOption('limb-over');
                exit;
              end;
      Until(false);
    end;

    Quote Originally Posted by GOOGLE View Post
    Simba Code:
    function TrapDoorColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.20, 0.35);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 6186359, MSX1, MSY1, MSX2, MSY2, 24);
      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 >= 2.76) and (X <= 36.79) and (Y >= 2.82) and (Y <= 37.91) and (Z >= 2.39) and (Z <= 40.51) 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;

    ACA function for finding the door colors but I couldn't seen to find anywhere how to add in to climb down it, anyone free to help would be greatly appreciated.
    -GOOGLE
    I think you have used the wrong thing in ACA, use ACA again but us the FindObject, post what you get and I will help you turn that into a function for going down the trap door..
    Last edited by putonajonny; 04-06-2012 at 02:46 PM.

  19. #44
    Join Date
    May 2012
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i have two questions

    1. how do i use the MouseBox function(how do I find the coordinates of the box I want to make and how to do i make the box)

    2. not sure how to ask this so ill post some code from yojo's script, basically how do i use a function like this to accurately pick colors in my script.... I tried using object tpa's and it fails.... when i try to find colors in the mining guild it keeps finding the black outline of the map(color 0) even when its not highlighted in ACA. even when I adjust the color tolerence to 0 it still finds the outside of the map >.>

    Function MineRock(WutRock:Integer):Boolean;
    var I,PlusOne,tMine,J, L:Integer;
    RockInFoI: TIntegerArray;
    RockInFoE: TExtendedArray;
    RockPts:TPointArray;
    RockPtsBox: T2DPointArray;
    BingoPt: TPoint;

    Begin

    If Not(LoggedIn) Then Exit;

    J:=0;

    //StatsGuise('Searching For Rock: '+ IntToStr(InvCount));
    If InvFull Then Exit;

    Case WutRock of
    1: Begin RockInFoE:=[0.02 , 3.07]; RockInFoI:=[4622062, 5]; End; //BCop
    2: Begin RockInFoE:=[0.03 , 0.09]; RockInFoI:=[4088717, 9]; End; //DCop
    3: Begin RockInFoE:=[0.13 , 0.33]; RockInFoI:=[11382456, 12]; End; //Tin
    4: Begin RockInFoE:=[0.06 , 0.87]; RockInFoI:=[3293285, 7]; End; //Iron
    5: Begin RockInFoE:=[0.00 , 0.53]; RockInFoI:=[1579546, 5]; End; //Iron
    End;


    {Get Rock Points Only}
    ColorToleranceSpeed(2);
    SetColorSpeed2Modifiers(RockInFoE[0],RockInFoE[1]);
    FindColorsSpiralTolerance(MSCX, MSCY, RockPts, RockInFoI[0], MSX1, MSY1, 507, 270, RockInFoI[1]);
    SetColorSpeed2Modifiers(0.2,0.2);
    ColorToleranceSpeed(1);

    RockPtsBox:=TPAtoATPAEx(RockPts,35,35);
    //DebugATPA(RockPtsBox, '');
    {/Get Rock Points Only}

    L:= High(RockPtsBox)

    For I:=0 To L Do

    Begin

    PaintReport;
    If GetArrayLength(RockPtsBox[I])>7 Then
    Begin

    BingoPt:= MiddleTPA(RockPtsBox[I]);
    If CheckAndClick('ine', BingoPt.x,BingoPt.y, 'L') Then
    Begin
    PlusOne:=InvCount+1;
    Result:=True;
    MarkTime(tMine);
    StatsGuise('Mining Rock: '+ IntToStr(InvCount+1));
    Players[CurrentPlayer].Loc:='Mining';
    wait(500 + Random(1000));
    MMouse(582, 228, 7, 7);
    Repeat
    PaintReport;

    Antiban;

    RT:=GetSystemTime;
    If FindNormalRandoms Then
    IncEx(WeMined,GetSystemTime - RT);

    // If Random(2500)=1 Then SleepAndMoveMouse(3500+Random(500));

    Until (InvCount = PlusOne) Or (TimeFromMark(tMine) > ((Players[CurrentPlayer].Integers[2]*1000) + Random(500)));
    If InvCount=PlusOne Then
    Begin
    DebugXP;

    Inc(J);
    Inc(TOres);
    Inc(Players[CurrentPlayer].Integers[80]); //Ores

    Case Players[CurrentPlayer].Integers[1] Of

    1,2: Stats_IncVariable('Copper Ore (Mined)', J);
    3: Stats_IncVariable('Tin Ore (Mined)', J);
    4: Stats_IncVariable('Iron Ore (Mined)', J);
    5: Stats_IncVariable('Coal Ore (Mined)', J);

    End;

    Stats_IncVariable('Total EXP Gained', Round(J*(Players[CurrentPlayer].Extendeds[1])));
    IncEx(TExperiance, Round(J*(Players[CurrentPlayer].Extendeds[1])) );

    J:= 0;

    If ( (TOres Mod 28) = 0 ) Then
    Begin
    If TOres=0 Then Exit;
    Inc(TLoads);
    stats_IncVariable('Loads Done', 1);
    Inc(Players[CurrentPlayer].Integers[81]); //Total Loads
    Inc(Players[CurrentPlayer].Integers[82]); //Temp Loads
    ProgressReport;
    End;

    PaintReport;
    Break;
    End;
    Exit;
    End Else Continue;
    End Else Continue;
    End;
    End;

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

    Default

    Quote Originally Posted by samuri51 View Post
    i have two questions

    1. how do i use the MouseBox function(how do I find the coordinates of the box I want to make and how to do i make the box)

    2. when i try to find colors in the mining guild it keeps finding the black outline of the map(color 0) even when its not highlighted in ACA. even when I adjust the color tolerence to 0 it still finds the outside of the map >.>

    For your first problem:

    Imagine the box you want to search in.

    Now get the color picker tool and click the top left hand corner of the box.
    Now click the bottom right hand corner of the box.

    Now get those 4 numbers(2 coordinates) and replace them with xs, ys, xe and ye within the MouseBox function. It will now click within the box you want it to.


    For your second problem:

    Make sure you search within the mainscreen. to do this replace xs, ys, xe and ye in your color finding function with MSX1, MSY1, MSX2, MSY2

  21. #46
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Is there a code to restart the script after a certain amount of time? Like a sleep function? If something goes wrong, I want my script to stop and restart from the top after 30 minutes.
    Is there a function to do this or another way?

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

    Default

    Quote Originally Posted by MasterCrimez View Post
    Is there a code to restart the script after a certain amount of time? Like a sleep function? If something goes wrong, I want my script to stop and restart from the top after 30 minutes.
    Is there a function to do this or another way?
    Depending on how you have structured your script this could be very easy or involve a lot of re-structuring.. you'll have to post what you have...

  23. #48
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    I think I have just figured it out.

    Simba Code:
    program stopifyouwantabreak;

    function mainloop: boolean;
    vars
    stoptime : integer;

    begin
    //the purpose of the function.......here
    if(something = wrong) then
    begin
     
      //you want it to stop,
      stoptime = 3600;//in seconds
      result:= false;
      exit;

    end;

    //the rest of your mainloop function.... but whenever you want to stop, you just fill in stoptime, result false and exit;

    end;

    begin
      repeat
        repeat
     mainloop;
     logout;
     wait(stoptime*1000);

    until stop=true;


      until false;
    end.


    Will this work? Or is the variable stoptime I make in the function mainloop only functional in the function? I don't know if that's true in pascal, but in PHP this wouldn't work....

    and this way is maybe a little too hard, because if i also want to let it happen in other functions, (for example I use a function for checking a random, I want to logout and retry after 30 minutes if it fails) if this happens and it isnt in the main function, exit doesnt work because then it will only go back to the mainloop function.... is there a piece of code that will exit all your functions? Like
    Simba Code:
    exit(ALL);


    Thanks for your help, and if this isnt' the best way, please give me a little example for a better way.

  24. #49
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by MasterCrimez View Post
    I think I have just figured it out.

    [snip...]

    Will this work? Or is the variable stoptime I make in the function mainloop only functional in the function? I don't know if that's true in pascal, but in PHP this wouldn't work....

    and this way is maybe a little too hard, because if i also want to let it happen in other functions, (for example I use a function for checking a random, I want to logout and retry after 30 minutes if it fails) if this happens and it isnt in the main function, exit doesnt work because then it will only go back to the mainloop function.... is there a piece of code that will exit all your functions? Like
    Simba Code:
    exit(ALL);


    Thanks for your help, and if this isnt' the best way, please give me a little example for a better way.
    What you're looking to do could be as simple as:

    Simba Code:
    var
      BreakTime, t: Integer;

    begin
      BreakTime := (30 * 1000);
      repeat
        SetupScript;
        // ...
        MarkTime(t);
        repeat
          MainLoop;
          // ...
          if BreakEarly then // Nifty feature #1
            Break;
          if NoBreak then // Nifty feature #2
            MarkTime(t);
        until (TimeFromMark(t) >= BreakTime)
      until (Whatever)
    end.
    Last edited by Runaway; 06-15-2012 at 04:38 PM.

  25. #50
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Runaway View Post
    What you're looking to do could be as simple as:

    Simba Code:
    var
      BreakTime, t: Integer;

    begin
      BreakTime := (30 * 1000);
      repeat
        SetupScript;
        // ...
        MarkTime(t);
        repeat
          MainLoop;
          // ...
          if BreakEarly then // Nifty feature #1
            Break;
          if NoBreak then // Nifty feature #2
            MarkTime(t);
        until (TimeFromMark(t) >= BreakTime)
      until (Whatever)
    end.
    I don't understand. What does Breakearly mean and nobreak?

Page 2 of 3 FirstFirst 123 LastLast

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
  •