Results 1 to 9 of 9

Thread: Script Do Not Execute

  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Script Do Not Execute

    Hey All

    I need Some help here. I don`t know what I`m doing wrong. I`m working on a all in one pottery script. I have Simba open and use select a client to work with the browsers RuneScape Client. The script go to the right procedure but does not execute it.

    Here is the code. Can Someone tell me what I`m doing wrong, where to look for the problem in finding the potters wheel.

    Includes

    Simba Code:
    //{$DEFINE SMART}
    //{$DEFINE PAINT}
    {$i SRL\SRL.simba}
    //{$i SRL\SRL\Misc\PaintSmart.simba}
    {$i sps\sps.simba}
    {$I SRL\SRL\Skill\magic.simba}
    {$i ObjectDTM\ObjDTMInclude.simba}


    Simba Code:
    // Create Pottery
    procedure MakePottery;
     var
      x, y , PlusOne, PotteryCounter: Integer;
      Wheel: Boolean;
      Begin
        // Setup Pottery For Finding Item To Use
        // If Pottery Then Find Wheel
        // If Pottery Is made Find Oven
        WriteLn('In Pottery Shop');
        SetAngle(SRL_ANGLE_HIGH); // Set Camera Angle
        MakeCompass('W');
        x:=MSCX;  // This is the Center Of the Main Screen Where Your Character is standing at the moment
        y:=MSCY;  // The Search for your object will start from this location outwards in a spiral
        WriteLn('Looking For Pottery Wheel');
        If FindObjTPA(x, y, 9079697, 6, 1, 15, 60, 600, ['Pott']) then
          Begin

            Case random(2) of
            0:  Begin
                  WriteLn('Left Clicked Potters Wheel');
                  GetMousePos(x,y); // Get Mouse Current Position
                  mouse(x, y, 5, 5, True); // Left Click On Potters Wheel
                End;
            1: Begin
                  WriteLn('Right Clicked Potters Wheel');
                  GetMousePos(x,y); // Get Mouse Current Position
                  mouse(x, y, 5, 5, False); // Right Click To Bring Up Options
                  WaitOption('Form', 500); // Wait A Certain X Amount Of Seconds Before Clicking Option
               End;
             End;
          End;
      End;

    It Does not Set the camera Angle, neither set the compass location and as far as I can tell neither does it find the potters wheel. What am I doing wrong? According to me it should at least set the camera angle as well as the compass setting, but it does`nt even do that.

    I would appreciate some suggestions and help. Be gentle as I`m new to this, also is it possible to use something else to find the potters wheel than FindObjTPA?

    Thanks in advance for the help.

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Can u post the whole script in 1 piece?
    I dont see ur mainloop.

    Also u do not have to leave 2 spaces if the line is 'begin' (u only leave 2 spaces for the line after begin)

  3. #3
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    This is just one part off the whole script, in fact this is the first part to find the pottery wheel only.

    If this is done and the choices are made what to craft then the rest will be easy to make. I have looked at other pottery scripts but it is too complicated for me to understand at the moment. So I would rather create something from scratch and learn the process better to be able to understand scripting and how it is done better.

    The walking to the well, to the clay mine, to the bank to the pottery is all done and works well. That was easy to do, the only thing I have difficulty with that, is to compare the locations to find out where in rs I am at the moment and where to go from where I am to where I should be for the option I have chosen.

    This is a problem for me. I`m also a bit confused about how to use cases in the correct manner.

    One thing I would like to do with the walking, instead of having different procedures to do the walking, is it possible just to have one procedure for walking and to assign the Path that should be used to a constant variable from which you can call the path to the location you want to go in relation to where you are at that specific moment and location? And if possible, can some one show me and example of how to do it?

    At the moment you can start up anywhere in rs and it will teleport you to the right location with the lodestones. From there you go to the bank and then equip with what ever you need and go to the location. That was not too difficult to make.

    But without the pottery this is useless.

    So here is just a sample off the code that just focus on the pottery. At the moment you must be in the pottery to execute. That is where my focus is at the moment.

    Simba Code:
    program TestBed;

    //{$DEFINE SMART}
    //{$DEFINE PAINT}
    {$i SRL\SRL.simba}
    //{$i SRL\SRL\Misc\PaintSmart.simba}
    {$i sps\sps.simba}
    {$I SRL\SRL\Skill\magic.simba}
    {$i ObjectDTM\ObjDTMInclude.simba}


    // Declare Constants Used
    const
      SRLStats_User     = '';   // Your SRL Stats Username
      SRLStats_Password = '';   // Your SRL Stats Password
      SERVER            = 0;  // Enter "0" to pick a random server.
      MEMBERS           = False;
      NumbOfPlayers     = 1;
      StartPlayer       = 0;
      WorldSwitching    = False; // Switch world after the break
      ChooseActivity    = 2;  // Choose Option To run
                              // Valid Options:
                              // 0 = Mine Clay And Bank It
                              // 1 = Mine Clay And Soften It Then Bank It
                              // 2 = Get Soft Clay From Bank And Craft It Then Bank It
                              // 3 = Get Soft Clay From Bank And Craft It And Drop It
                              // 4 = Mine Clay,Soften It,Craft It,Bank It
                              // 5 = Mine Clay,Soften It,Craft It,Drop It

    // Declare Variables
    var
     BreakTime: Integer;
     Drops: TStringArray;
     WalkToBank:TPointArray;
     WalkToWaterWell:TPointArray;
     WalkToPottery:TPointArray;
     GoToMinery:TPointArray;
     BankLocation, WellLocation, PotteryLocation,
     MineLocation, ArrivalLocation:Boolean;


    // Setup Players
    procedure DeclarePlayers;
      begin
        WriteLn('Declaring Player');
        HowManyPlayers := 1;
        NumberOfPlayers(HowManyPlayers);
        CurrentPlayer := 0;
        Players[0].Name := '';
        Players[0].Pass := '';
        Players[0].Nick := '';
        Players[0].Member := False;
        Players[0].Active := True;
      end;

    // Status Update in PinBar
    procedure StatsGuise(wat:string);
      Begin
        Status(wat);
        DisGuise(wat);
      End;

    // GlobalFailSafe
    Procedure GlobalFailSafe(Reason:String);
      Begin
        WriteLn('We Have A Bug. Kill IT !!');
        Players[CurrentPlayer].Loc := Reason;
        Logout;
        Stats_Commit;
    //    ProgressReport;
        TerminateScript;
      End;

    // FailSafe
    Procedure FailSafe(Reason:String);
      Begin
        WriteLn('We Have A Bug. Kill IT !!');
        Players[CurrentPlayer].Loc := Reason;
        Logout;
        Stats_Commit;
    //    ProgressReport;
        TerminateScript;
      End;

      // Find Current Location Coordinates, Check against Destination Location
    // If not in destination Location Then Start Transport Destination
    procedure FindLocation;
      Begin
        WriteLn('Find Current Location');
    //  if CurrentPos = Mine Location then // Mining Location
          Begin
    //        MineLocation = True;
    //        BankLocation = False;
    //        WellLocation = False;
    //        PotteryLocation = False;
          End;

    End;

    // Create Pottery
    procedure MakePottery;
     var
      x, y , PlusOne, PotteryCounter: Integer;
      Wheel: Boolean;
      Begin
        // Setup Pottery For Finding Item To Use
        // If Pottery Then Find Wheel
        // If Pottery Is made Find Oven
        WriteLn('In Pottery Shop');
    //    Wheel := False;
        SetAngle(SRL_ANGLE_HIGH); // Set Camera Angle
        MakeCompass('W');
        x:=MSCX;  // This is the Center Of the Main Screen Where Your Character is standing at the moment
        y:=MSCY;  // The Search for your object will start from this location outwards in a spiral
        WriteLn('Looking For Pottery Wheel');
        If FindObjTPA(x, y, 9079697, 6, 1, 15, 60, 600, ['Pott']) then
          Begin
            Case random(2) of
            0:  Begin
                  WriteLn('Left Clicked Potters Wheel');
                  GetMousePos(x,y); // Get Mouse Current Position
                  mouse(x, y, 5, 5, True); // Left Click On Potters Wheel
                End;
            1: Begin
                  WriteLn('Right Clicked Potters Wheel');
                  GetMousePos(x,y); // Get Mouse Current Position
                  mouse(x, y, 5, 5, False); // Right Click To Bring Up Options
                  WaitOption('Form', 500); // Wait A Certain X Amount Of Seconds Before Clicking Option
               End;
             End;
          End;
      End;

    // Choose Activity To Implement
    procedure Activity(Choice:Integer);
    Begin
      WriteLn('Choose Activity to Do');
      Case Choice of
          0: Begin
              DisGuise('Mine Clay And Bank It');
                  // Mine Clay And Bank It
    //            ArriveAtLocation;
                  // Check If InvFull, If Full, Then Bank, If empty Then Get PickAxe And Go To Mine
              if InvFull then
                Begin

                End;

              End;
           1: Begin
                DisGuise('Mine Clay And Soften It Then Bank It');
                  // Mine Clay And Soften It Then Bank It
    //            ArriveAtLocation;
                  // Check If InvFull, If Full, Then Bank, If empty Then Get PickAxe And Go To Mine And then Wet Clay And Then Bank

              End;
            2: Begin
                DisGuise('Get Soft Clay From Bank And Craft It Then Bank It');
                  // Get Soft Clay From Bank And Craft It Then Bank It
    //            ArriveAtLocation;
                  // Check If InvFull, If Full, Then Bank, If empty Then Get Soft Clay Go To Craft Shop, Then Bank Crafted Item
                if InvFull then
                  Begin
    //                DepositInventory;
                  End;
                MakePottery;

                End;
            3:  Begin
                DisGuise('Get Soft Clay From Bank And Craft It And Drop It');
                  // Get Soft Clay From Bank And Craft It And Drop It
    //            ArriveAtLocation;
                  // Check If InvFull, If Full, Then Bank, If empty Then Get Soft Clay Go To Craft Shop, Then Drop Crafted Item

                End;
            4:  Begin
                DisGuise('Mine Clay,Soften It,Craft It,Bank It');
                  // Mine Clay,Soften It,Craft It,Bank It
    //            ArriveAtLocation;
                  // Check If InvFull, If Full, Then Bank, If empty Then Get PickAxe And Go To Mine, Soften Clay Go To Craft Shop, Then Bank Crafted Item

                 End;
            5:  Begin
                  DisGuise('Mine Clay,Soften It,Craft It,Drop It');
                  // Mine Clay,Soften It,Craft It,Drop It
    //            ArriveAtLocation;
                  // Check If InvFull, If Full, Then Bank, If empty Then Get PickAxe And Go To Mine, Soften Clay Go To Craft Shop, Then Drop Crafted Item

                End;
          End;
      End;

    // Setup Client For Run
    procedure SetupClient;
    begin
      WriteLn('Start Bot Client');
    //  Smart_Signed := TRUE;
    //  Smart_Members := FALSE;
    //  Smart_SuperDetail := FALSE;
    //  Smart_Server := 120;

      ClearDebug;
    //  ActivateClient;
      SetupSRL;
      ObjDTM_Setup;
      ObjDTM_Debug := True;

      DeclarePlayers;
      if not (LoggedIn) then
      LoginPlayer;
      Wait(4000+random(400));
    //  ResetBreakTimer;
    //  SetAngle(SRL_ANGLE_HIGH);
    end;

    // Begin Main Loop
    begin
      SetupClient;
    //  ArriveAtLocation;
    //  repeat
    //    Findlocation;
    //    CompareLocation;
      Activity(ChooseActivity);
    //    AntiBan;
    //  Until AllPlayersInactive;
    end.

    I want to give here some thanks to @YoHoJo for his tutorials, although it is really basic it will steer you in the right direction to learn. Thanks YoHoJo, good work.

    I know my code is not very tidy at the moment and that you would be able to do these things in much shorter steps that what I am doing at the moment, but it is a new language I must learn, so at the moment baby steps will do until I understand the process.

    I have broken this up at the moment to understand it better and easier. So that all the code don`t take away from the area I`m focusing on at the moment.

  4. #4
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Ur MakePottery procedure is not in ur mainloop, so its not going to be executed.
    U must call all ur procedures in ur mainloop (in the correct order) for them to be executed.

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

    Default

    VastlySuperior,

    What is the debug output you are getting when running the full script you gave to us?

    Cheers,
    Daniel.

    Quote Originally Posted by riwu View Post
    Ur MakePottery procedure is not in ur mainloop, so its not going to be executed.
    U must call all ur procedures in ur mainloop (in the correct order) for them to be executed.
    He/She is calling it.
    Last edited by Daniel; 07-06-2012 at 11:00 AM.
    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 |

  6. #6
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Oh sorry didn't look at it carefully. It should definitely set ur angle high and turn it west then.

    Make sure u are using the correct graphic mode (Min/fixed screen) and have the crosshair correctly dragged to the RS window.

  7. #7
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    This is the Debug report:

    SRL Compiled in 16 msec
    Object DTM Include: Setup complete.
    Declaring Player
    Choose Activity to Do
    In Pottery Shop
    Looking For Pottery Wheel
    Successfully executed.

    As you can see, it does go to the procedure and run through it but nothing happens.

  8. #8
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I have done a little test now, if I enable the smart functions the script works flawlessly. It finds the potter wheel and click on it.

    Why will it not work if I`m not using smart?

    I target the browser client window correctly.

    Any other suggestions would also be appreciated.

  9. #9
    Join Date
    Mar 2012
    Location
    Australia
    Posts
    625
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    perhaps you did not target the rs screen?
    Bored of playing rs, and bored of botting it, why am i here?

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
  •