Results 1 to 4 of 4

Thread: (Falador) Firemaking

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

    Default (Falador) Firemaking

    Good day guys,

    I just started programming Pascal, I came from the Arduino environment.
    I wrote this little script that tells you if you have (Maple)logs in your inventory and a Tinderbox.
    It can also drag the tinderbox to the location I selected.

    I would like to hear your opinion so far, there is still a lot to do/learn.

    Simba Code:
    program Falador_Firemaking; //V1.0

    //{$define smart}
    {$DEFINE WALKER}

    {$i AeroLib/AeroLib.Simba}
     //{.include SRL-OSR/SRL.simba}
     //{$include_once srl-6/srl.simba}

    var
      Tinderbox, Willow_log, Maple_Log:TItem;

    Procedure LoadItem;
    begin
     //Get Tinderbox
     Tinderbox.DTM := DTMFromString('mlwAAAHicY2dgYOBjgAB2IJYAYmkgFoCKcQExNxCzQPk8QCwJxKJAPHviBCDJiBVzMeAG2HVAMBQAAPWRAoY=');

     //Get Logs
     Willow_log.DTM := DTMFromString('mlwAAAHicY2dgYBBggAARIJYEYhYglgViDiBmBmJOIOaBqmGC8vmB2N9NCkgyYsVcDLgBdh0QDAUAkUwBZg==');
     Maple_log.DTM := DTMFromString('mlwAAAHicY2dgYNjFysBwAYg3A/E5IL4IxNuB+AwQdzEyMLQBcTMQ1wFxE5SuBmIGBkY8GDcgQhcAbfUJKw==');



    end;


    //Looks if Logs and Tinderbox are in the inventory.
    Procedure CheckInventory;

    var
      log, box: Tpoint;
      X,Y:Integer;


     begin

        if Maple_Log.findIn(Area_Inv, log) = true then
           IntToStr(Maple_Log.GetSlot)

        if Maple_Log.findIn(Area_Inv, log) = false then
           writeln('No Logs, getting Logs. ');

        if Tinderbox.findIn(Area_Inv, box) = true then
           IntToStr(Tinderbox.GetSlot)

        if Tinderbox.findIn(Area_Inv, box) = false then
              writeln('No Tinderbox, getting Tinderbox. ');

    end;

      procedure Tinderbox_location

      var
      x,y,TinderboxX,TinderboxY,SumT :integer;
      pnt,TinderP :Tpoint;

      //Tinderbox location

      begin
      mouseSpeed := Random(30, 50);
      CheckInventory();

     //Tinderbox location
      TinderboxX = 664;
      TinderboxY = 332;
      TinderP := [664,332];

      FindDTM(Tinderbox.DTM, x,y, MIX1,MIY1,MIX2,MIY2);

      pnt := [x,y];
      SumT := (X + Y);
      writeln(X,' ',Y);
      writeln(SumT);

      if SumT = 996 = true or SumT = 998  = true then
       begin
          wait(20);
          writeln('Tinderbox slot 15, Okay!');
         end;

      if SumT <> 996 = false or SumT <> 998 = false then
          begin
          wait(20);
          writeln('Tinderbox not in slot 15, moving Tinderbox!');

          FindDTM(Tinderbox.DTM, x,y, MIX1,MIY1,MIX2,MIY2);

          HumanMMouse(pnt,6,5);
          HoldMouse(x, y, mouse_Left);
          wait(Random(125,225));
          HumanMMouse(TinderP,6,5);
          wait(Random(75,125));
          ReleaseMouse(x, y, mouse_Left);


        end;
      end;

     begin
      initAL;
      LoadItem();

      CheckInventory();
      Tinderbox_location ();

      FreeDTM(Willow_log.DTM);
      FreeDTM(Tinderbox.DTM);
      FreeDTM(Maple_log.DTM);
    end.

  2. #2
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Impressive stuff man, love your implementation of it. This would be a way you could shorten the tinderbox snip by using a couple of Aerolib's TItem methods (because you declared Willow_log as a TItem)

    Simba Code:
    procedure Tinderbox_location();
    var
      desiredSlot: integer;
    begin
      desiredSlot := 15;
      if (Tinderbox.inInventory()) then
      begin
        if (Tinderbox.getSlot() <> desiredSlot) then
          moveItemTo(Tinderbox.getSlot(), desiredSlot)
        else
          writeln('Tinderbox slot in ' , desiredSlot , ' Okay!');
      end else
        ('No Tinderbox in inv!');
    end;

  3. #3
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Just a few things to note;

    In your CheckInventory procedure you are locating the tinderbox and maple log and saving the points to the respective box/log variables but those variables are not global so you aren't using them anywhere. If you simply want to check if something is in your inventory without saving the point you can use inInventory.

    Ex:
    Simba Code:
    if(Tinderbox.inInventory) then
         writeln('Tinderbox found in inventory')
    else
         writeln('No tinderbox found.');

    For this part;

    Simba Code:
    if Maple_Log.findIn(Area_Inv, log) = true then
           IntToStr(Maple_Log.GetSlot)

    if Tinderbox.findIn(Area_Inv, box) then
          IntToStr(Tinderbox.GetSlot);
    The = true is not needed, you can just make it
    Simba Code:
    if(Maplelog.findIn(Area_Inv, log) then
    and it will do the same thing, if you want false you can do
    Simba Code:
    if(not (Maple_Log.findIn(Area_Inv, log))) then

    Also, how come you are converting the int to a string here? Where you gonna make it print something? Maybe like this?

    Simba Code:
    if (Maple_Log.findIn(Area_Inv, log)) then
          writeln('Maple logs found, slot: '+IntToStr(Maple_Log.getSlot()));


    Heres a shortened version of your script;

    Simba Code:
    program Falador_Firemaking; //V1.0
    {$i AeroLib/AeroLib.Simba}

    var
      Tinderbox, Willow_log, Maple_Log:TItem;

    Procedure LoadItem;
    begin
      //Get Tinderbox
      Tinderbox.DTM := DTMFromString('mlwAAAHicY2dgYOBjgAB2IJYAYmkgFoCKcQExNxCzQPk8QCwJxKJAPHviBCDJiBVzMeAG2HVAMBQAAPWRAoY=');

      //Get Logs
      Willow_log.DTM := DTMFromString('mlwAAAHicY2dgYBBggAARIJYEYhYglgViDiBmBmJOIOaBqmGC8vmB2N9NCkgyYsVcDLgBdh0QDAUAkUwBZg==');
      Maple_log.DTM := DTMFromString('mlwAAAHicY2dgYNjFysBwAYg3A/E5IL4IxNuB+AwQdzEyMLQBcTMQ1wFxE5SuBmIGBkY8GDcgQhcAbfUJKw==');
    end;

    procedure FreeDTMS();
    begin
      writeln('Freeing DTMs');
      FreeDTM(Willow_log.DTM);
      FreeDTM(Tinderbox.DTM);
      FreeDTM(Maple_log.DTM);
    end;

    procedure checkInventory();
    begin
      if(Tinderbox.inInventory) then //Checks if tinderbox is in inventory
      begin
        if(Tinderbox.getSlot() <> 15) then//Checks if tinderbox is in any slot but 15
        begin//If its not in slot 15
          writeln('Tinderbox found in Slot: '+IntToStr(Tinderbox.getSlot())+', moving to slot 15.');
          moveItemTo(Tinderbox.getSlot(), 15);
        end else//If it is in slot 15
          writeln('Tinderbox found in Slot: '+IntToStr(Tinderbox.getSlot()));
      end else//If it can't find a Tinderbox in your inventory
        writeln('Tinderbox not found.');

      //Checks if maple logs are in inventory, prints slot
      if(Maple_Log.inInventory) then
        writeln('Maple logs found! Slot: '+IntToStr(Maple_Log.getSlot()))
      else
        writeln('Maple logs not found.');

      //Checks if willow logs are in inventory, prints slot
      if(Willow_Log.inInventory) then
        writeln('Willow logs found! Slot: '+IntToStr(Willow_Log.getSlot()))
      else
        writeln('Willow logs not found.');
    end;

    begin
      initAL;
      mouseSpeed := Random(30, 50);
      AddOnTerminate('FreeDTMS');
      LoadItem();
      checkInventory();
    end.

    Not trying to be rude at all, just trying to help! I'm pretty new here as well so I'm still learning. Feel free to ask any questions!

  4. #4
    Join Date
    Apr 2017
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is amazing, thanks guys.

    I still have to get used to the amazing libraries that are available programming.
    I kind of knew I did thing the hard way and posted it here to see if anyone had some tips.
    I really appreciate this, I will implement the code suggestions and understand it so I can code some more.

    Thanks again !

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
  •