Results 1 to 8 of 8

Thread: Need help with my first script

  1. #1
    Join Date
    Apr 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Need help with my first script

    I decided to start learning Simba by attempting to make a power chopper and fletcher.
    The woodcutting part works decently enough, but I can't get the fletching part to run, whenever it gets to that part in the debug it says '---- TRSGameTab.__initTabs(): Setup gametab properties' and will just sit there til I exit the script. Any help is appreciated.
    Here's the fletching portion:
    Code:
    procedure fletchLogs();
    var
      logsDTM, x, y: integer;
    
    begin
        if not isLoggedIn() then
          exit;
    
        logsDTM := DTMFromString('mrAAAAHic42BgYGBhYmD4w8jAwA+k2YGYF4gZgFgAiP8DxScB8WQo7gHiWUA8E4h7gbgPiL0sFBmqk80Y4t21GGLcNIGaGRlasqwYfK2UwDQhwEgAwwAAvWUNNw==');
    
        if findDTM(logsDTM, x, y, tabBackPack.getBounds()) then
          begin
            mouse(x, y, 3, 3, MOUSE_MOVE);
            if isMouseOverText(['raft', 'ogs']) then
            fastClick(MOUSE_LEFT);
    
            if toolScreen.isOpen(3000) then
              toolScreen.select('Knife');
    
            if productionScreen.isOpen(5000) then
              productionScreen.selectBox(1);
              productionScreen.clickStart();
    
             if progressScreen.isOpen(5000) then
             begin
              repeat
                antiPattern();
                wait(1000);
               until (not progressScreen.isOpen());
              end;
          end;
    end;
    and here's the entire script:
    Code:
    Program ayoPowerFletcher;
    
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := ''; //change this
        password := '';   //and this
        isActive := true;
        isMember := false;
      end
      currentPlayer := 0;
    end;
    
    procedure antiPattern();
    begin
      if (not isLoggedIn()) then
       exit;
    
      case random(300) of
        1: hoverSkill(SKILL_WOODCUTTING);
        2: sleepAndMoveMouse(5000 + random(1000));
        3: smallRandomMouse();
        4: randomRClickItem();
        5: pickUpMouse();
        6: boredHuman();
        7: mouseOffClient(OFF_CLIENT_RANDOM);
        8: hoverRandomSkill();
        9:
      end;
    end;
    
    procedure clickTree();
    var
      x, y: integer;
    begin
      if (not isLoggedIn()) then
       exit;
      if (tabBackPack.isFull()) then
        exit;
      if mainscreen.findObject(x, y, 925721, 11, ['vergreen'], MOUSE_RIGHT) then
         begin
          chooseOption.select(['verg', 'gree']);
          tabBackPack.waitForShift(5000);
         end;
    end;
    
    procedure fletchLogs();
    var
      logsDTM, x, y: integer;
    
    begin
        if not isLoggedIn() then
          exit;
    
        logsDTM := DTMFromString('mrAAAAHic42BgYGBhYmD4w8jAwA+k2YGYF4gZgFgAiP8DxScB8WQo7gHiWUA8E4h7gbgPiL0sFBmqk80Y4t21GGLcNIGaGRlasqwYfK2UwDQhwEgAwwAAvWUNNw==');
    
        if findDTM(logsDTM, x, y, tabBackPack.getBounds()) then
          begin
            mouse(x, y, 3, 3, MOUSE_MOVE);
            if isMouseOverText(['craft', 'ogs']) then
            fastClick(MOUSE_LEFT);
    
            if toolScreen.isOpen(3000) then
              toolScreen.select('Knife');
    
            if productionScreen.isOpen(5000) then
              productionScreen.selectBox(1);
              productionScreen.clickStart();
    
             if progressScreen.isOpen(5000) then
             begin
              repeat
                antiPattern();
                wait(1000);
               until (not progressSCreen.isOpen());
              end;
          end;
    end;
    
    
    
    
    // main loop
    begin
      clearDebug();               // Clear the debug box
      smartEnableDrawing := true; // So we can draw on SMART
      setupSRL();                   // Load the SRL include files
      declarePlayers();             // Set up your username/pass
    
      if not isLoggedIn() then             // If player isn't logged in then
      begin
        players[currentPlayer].login();   // Log them in
        wait(randomRange(2000, 6000));
        minimap.setAngle(MM_DIRECTION_NORTH);  // Make compass north and angle high
        mainScreen.setAngle(MS_ANGLE_HIGH);
        exitTreasure();            // Exit treasure hunter
      end;
    repeat
      repeat
        clickTree();
      until tabBackPack.isFull();
        fletchLogs();
    until false;
    
    
    
    end.

  2. #2
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    It sounds like it isn't finding the logDTM in your inventory. I always set the logs to action bar "1" and then you only need to press 1 to open the fletching menu. Try that and see if the rest of your code will work with it?

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  3. #3
    Join Date
    Apr 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Thanks, that fixed it!
    Do you think my DTM values are off or why it couldn't find it in my invy?

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by jamesayo View Post
    Thanks, that fixed it!
    Do you think my DTM values are off or why it couldn't find it in my invy?
    It sounds to me like either the DTM didn't work properly or SRL didn't properly open your backpack tab. Something was keeping it from getting past the "if FindDTM" part though. I'm glad changing it up a bit worked. It should still work with a DTM though if you want to keep trying. You can add a few "writeln('Found DTM');" etc through that part though if you want to be sure what is happening. That's what I do in my scripts when I'm trying to figure out why something is broken.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  5. #5
    Join Date
    Apr 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I tried updating the DTM and adding in writeLns.
    Here's the new fletching part:
    Code:
    procedure fletchLogs();
    var
      logsDTM, x, y: integer;
    
    begin
        if not isLoggedIn() then
          exit;
    
        logsDTM := DTMFromString('mggAAAHicY2NgYDBlZGDQA2JHILYHYl1GiFg5ENcCcQ4Q1wBxIRDnA7GPpSJDQ5oFUCcjQ6SzOpgd6qDKgAsw4sAQAAC8Pgh6');
        writeLn('Log''s DTM has been converted!');
        if findDTM(logsDTM, x, y, tabBackPack.getBounds()) then
          begin
            writeLn('Logs have been found in the invy!');
            mouse(x, y, 3, 3, MOUSE_MOVE);
            if isMouseOverText(['raft', 'ogs']) then
            fastClick(MOUSE_LEFT);
            writeLn('Logs selected!')
         //actionBar.clickSlot(1);
    
            if toolScreen.isOpen(3000) then
              toolScreen.select('Knife');
              writeLn('Knife selected!');
    
            if productionScreen.isOpen(5000) then
              writeLn('production Screen is open!');
              wait(randomRange(500, 1000));
              productionScreen.selectBox(1);
              writeLn('Arrow shafts selected!');
              wait(randomRange(500, 1000));
              productionScreen.clickStart();
              writeLn('We are fletching!')
    
             if progressScreen.isOpen(5000) then
             begin
              repeat
                antiPattern();
                wait(randomRange(1000, 1500));
               until (not progressScreen.isOpen());
              end;
    inc(loadsDone);
    writeLn('Whole inventory fletched!')
      end;
    end;
    the debug box gets spammed with 'Log's DTM has been converted!'

  6. #6
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by jamesayo View Post
    I tried updating the DTM and adding in writeLns.
    Here's the new fletching part:
    Code:
    procedure fletchLogs();
    var
      logsDTM, x, y: integer;
    
    begin
        if not isLoggedIn() then
          exit;
    
        logsDTM := DTMFromString('mggAAAHicY2NgYDBlZGDQA2JHILYHYl1GiFg5ENcCcQ4Q1wBxIRDnA7GPpSJDQ5oFUCcjQ6SzOpgd6qDKgAsw4sAQAAC8Pgh6');
        writeLn('Log''s DTM has been converted!');
        if findDTM(logsDTM, x, y, tabBackPack.getBounds()) then
          begin
            writeLn('Logs have been found in the invy!');
            mouse(x, y, 3, 3, MOUSE_MOVE);
            if isMouseOverText(['raft', 'ogs']) then
            fastClick(MOUSE_LEFT);
            writeLn('Logs selected!')
         //actionBar.clickSlot(1);
    
            if toolScreen.isOpen(3000) then
              toolScreen.select('Knife');
              writeLn('Knife selected!');
    
            if productionScreen.isOpen(5000) then
              writeLn('production Screen is open!');
              wait(randomRange(500, 1000));
              productionScreen.selectBox(1);
              writeLn('Arrow shafts selected!');
              wait(randomRange(500, 1000));
              productionScreen.clickStart();
              writeLn('We are fletching!')
    
             if progressScreen.isOpen(5000) then
             begin
              repeat
                antiPattern();
                wait(randomRange(1000, 1500));
               until (not progressScreen.isOpen());
              end;
    inc(loadsDone);
    writeLn('Whole inventory fletched!')
      end;
    end;
    the debug box gets spammed with 'Log's DTM has been converted!'
    So since it's not making it to "Logs have been found in the invy!" We can say for sure it's not finding the logs. Try having the script debug your backpack location (Writeln(toStr(tabBackpack.getBounds())) would work, or you can debug with smartImage.drawBox(tabBackpack.getBounds())). That way you can tell if SRL is finding the right spot and you'll know if you did the DTM right.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  7. #7
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    You can try:

    Simba Code:
    procedure fletchLogs();
    var
      logsDTM: Integer := DTMFromString('mggAAAHicY2NgYDBlZGDQA2JHILYHYl1GiFg5ENcCcQ4Q1wBxIRDnA7GPpSJDQ5oFUCcjQ6SzOpgd6qDKgAsw4sAQAAC8Pgh6');
    begin
      if not isLoggedIn() then exit();

      if tabBackpack.clickDTM(logsDTM, MOUSE_RIGHT, 'raft', 1000) then
      begin
        if toolScreen.isOpen(3000) then
          toolScreen.select('Knife');

        if productionScreen.isOpen(5000) then
        begin
          writeLn('production Screen is open!');

          if productionScreen.getSelectedBoxText() <> 'Arrow shafts' then // or whatever
            productionScreen.selectBox(1);

          productionScreen.clickStart();

          if progressScreen.isOpen(5000) then
            repeat
              antiPattern();
              wait(randomRange(1000, 1500));
            until (not progressScreen.isOpen());

          inc(loadsDone);
          writeLn('Whole inventory fletched!')
        end;
      end;
    end;

    If that doesn't work then your DTM is probably bad

  8. #8
    Join Date
    Apr 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by The Simba Noob View Post
    You can try:

    If that doesn't work then your DTM is probably bad
    It worked! Thank you!
    I also tweaked colour for finding the trees to make it work better and made it left click instead of right click the trees. I think the next thing i'll work on is making sure it doesn't wander far from the main bunch of trees.
    Any idea what was wrong with my code?
    I also used smartImage.drawBox(tabBackpack.getBounds())) and it was working fine.

    EDIT: It works in a weird way, it clicks every log in the invy before it finally clicks the fletch button. It was right clicking them all and displaying a bunch of errors in debug, but I changed it to left click and it still did the same thing.
    EDIT: Ah-ha! Got it working with a mix of our codes:
    Code:
    procedure fletchLogs();
    var
      logsDTM: Integer := DTMFromString('mlwAAAHicY2dgYFjKwsCwDoi3AvECIJ4NxDOBeAkQazIxMEgDsQ4QmwKxIRCrAbEcEPtaKQJ1M0ExIxKbiYGLATdgxIOhAAAxdQaQ');
      x, y: integer;
    begin
      smartImage.drawBox(tabBackpack.getBounds());
      if not isLoggedIn() then exit();
    
      begin
      if findDTM(logsDTM, x, y, tabBackPack.getBounds()) then
          begin
            mouse(x, y, 3, 3, MOUSE_MOVE);
            if isMouseOverText(['raft', 'ogs']) then
            fastClick(MOUSE_LEFT);
    
        if toolScreen.isOpen(3000) then
          toolScreen.select('Knife');
    
        if productionScreen.isOpen(5000) then
        begin
          writeLn('production Screen is open!');
    
          if productionScreen.getSelectedBoxText() <> 'Arrow shafts' then // or whatever
            productionScreen.selectBox(1);
    
          productionScreen.clickStart();
    
          if progressScreen.isOpen(5000) then
            repeat
              antiPattern();
              wait(randomRange(1000, 1500));
            until (not progressScreen.isOpen());
    
          inc(loadsDone);
          writeLn('Whole inventory fletched!')
        end;
      end;
    end;
    end;
    Last edited by jamesayo; 04-09-2015 at 12:36 PM.

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
  •