Results 1 to 8 of 8

Thread: Lunar Plank Making, first attempt

  1. #1
    Join Date
    Mar 2010
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Lunar Plank Making, first attempt

    So I quit RS a few years back, and quit autoing RS alongside. I have to say, it's annoying needing to relearn every syntax. So here's my first script after coming back.

    This script casts the Lunar spell Plank Make over all but your first three inventory spots. (Those are reserved for natures, astrals, and gp. Wield an earth staff.)

    For now it only does one round. I'm hoping to add banking and antirandoms later.

    EDIT: Please see later posts for improved versions. This is a work in progress.

    Code:
    program plank1;
    {.include SRL\SRL.scar}
    var invspot: integer;
    begin
    Wait(1000);
    SetupSRL;
    Wait(1000);
    for invspot := 4 to 28 do
    begin
      GameTab(tab_Magic);
      Wait(500 + Random(100));
      Mouse(714, 337, 5, 5, true);
      Wait(700 + Random(100));
      MouseItem(invspot, true);
      Wait(1000 + Random(100));
    end
    end.
    Last edited by ForgotMyName; 03-02-2010 at 05:07 PM.
    Wow. I've been gone a very long time indeed. So much has changed.

  2. #2
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    One thing is standards and co-ordinate clicking. It's a good attempt for a first script, you're grasping the basics. Here's a neater version for you to look at, with notes.

    SCAR Code:
    program plank1;
    {.include SRL\SRL.scar}

    var
      invspot : integer;   // Standarized

    procedure CastPlanks;        // Simple stand alone procedure
    begin
        GameTab(tab_Magic);        // Your code that was in the main loop
        Wait(500 + Random(100));
        Mouse(714, 337, 5, 5, true);    // Co-ord clicking is bad, Use MouseItem(i: Integer; left: Boolean); and/or
        Wait(700 + Random(100));        // MMouseItem(i: Integer);
        MouseItem(invspot, true);       // See that you used MouseItem, combine it with MMouseItem.
        Wait(1000 + Random(100));   // Try making a procedure to see if your player is moving or not,
    end;                            // Maybe checking for the staff if it's there or not?

    begin
    SetupSRL;
    for invspot := 4 to 28 do CastPlanks; // Shortened your mainloop
    end.

    You have potential, keep it up!

  3. #3
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Mr. Doctor View Post
    One thing is standards and co-ordinate clicking. It's a good attempt for a first script, you're grasping the basics. Here's a neater version for you to look at, with notes.

    SCAR Code:
    program plank1;
    {.include SRL\SRL.scar}

    var
      invspot : integer;   // Standarized

    procedure CastPlanks;        // Simple stand alone procedure
    begin
        GameTab(tab_Magic);        // Your code that was in the main loop
        Wait(500 + Random(100));
        Mouse(714, 337, 5, 5, true);    // Co-ord clicking is bad, Use MouseItem(i: Integer; left: Boolean); and/or
        Wait(700 + Random(100));        // MMouseItem(i: Integer);
        MouseItem(invspot, true);       // See that you used MouseItem, combine it with MMouseItem.
        Wait(1000 + Random(100));   // Try making a procedure to see if your player is moving or not,
    end;                            // Maybe checking for the staff if it's there or not?

    begin
    SetupSRL;
    for invspot := 4 to 28 do CastPlanks; // Shortened your mainloop
    end.

    You have potential, keep it up!
    Try to explain it a bit

    Procedures are sections of code separate from the mainloop that you can call later in the mainloop, or other procedures later in the script.

    MouseItem moves and clicks an item in the inventory spot specified by an integer, and right or left click by a true or false. eg MouseItem(5, true); would move the mouse to item slot 5 in the inventory and click it.

    MMouseItem is the same exept it dosn't click

    invspot was named as an integer at the beginning, and starts at 4. every time it bumps up an integer it does the procedure CastPlanks, and it will stop when invspot is equal to 28.


    So, just to say, blind clicking is never good. MouseItems are good, but you can use DTMs too, which would be better. To learn about them, you can look at the DTM section of Coh3n's guide. This ensures that even if the items are in the wrong place, it will still find them.
    http://villavu.com/forum/showthread.php?t=49089

    Good luck!

    E: Just realised Mr. Doc didn't add MouseItem i thought he did, nvm! But still, everything else i said still applys
    Last edited by Bionicle; 03-02-2010 at 12:45 AM.
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  4. #4
    Join Date
    Mar 2010
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you guys for the feedback!

    Hm, I'm using coordinates because I think SRL only covers the standard spellbook, and I think Lunars have the spells at different coordinates. So I'm not sure of a better option than clicking where the spell position is. I'm thinking using a bitmap/DTM might work better though.

    When I add other functionality, I'm definitely going to be separating it into functions. I just didn't feel like it for this one. I was just whipping up a basic script to save myself some clicks.

    I'm confused as to when the items in my inventory would change without my knowledge. When I make the banking version, why wouldn't it be safe to assume my inventory contains what I withdrew? (They took out boxes, etc, right?)
    Wow. I've been gone a very long time indeed. So much has changed.

  5. #5
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ForgotMyName View Post
    Hm, I'm using coordinates because I think SRL only covers the standard spellbook, and I think Lunars have the spells at different coordinates. So I'm not sure of a better option than clicking where the spell position is. I'm thinking using a bitmap/DTM might work better though.
    That's exactly wat i was going to suggest
    Bitmap would be better for a spell, DTMs are really only used for like items.
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  6. #6
    Join Date
    Mar 2010
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I made a second version. This one handles banking and anti randoms. I haven't tested very thoroughly but it's worked so far. I'm currently watching it carefully but letting it save me lots of clicks.

    I'm still using some constants for things I don't expect to change. (Positions in bank screen, position of spell, inventory positions, etc.) I may convert them to bitmaps and such later on.

    PS Is there a builtin random version of Wait?

    EDIT: I should include an explanation.
    Wield earth staff.
    First bank slots are nats, astrals, gp, and wood.
    Be sure to set the bank name, number of loads, and cost per plank.
    Waiting time could be tweaked for a bit more efficiency.

    Code:
    program PlankCaster;
    {.include SRL\SRL.scar}
    
    const
      numLoads = 10;
      whichBank = 'vwb';
      plankingCost = 175;
      waitingTime = 300;
    
    var
      thisLoad: Integer;
    
    Procedure DeclarePlayers;
    begin
         HowManyPlayers := 1;
         NumberOfPlayers(HowManyPlayers);
         CurrentPlayer := 0;
         Players[0].Name :='fake';
         Players[0].Pass :='fake';
         Players[0].Nick :='fake';
         Players[0].Loc  :='Bank';
         Players[0].Active:=True;
    end;
    
    procedure WaitRandom(t: Integer);
    begin
      Wait(t + Random(100));
    end;
    
    procedure GetMaterials();
    begin
      WriteLn('Withdrawing');
      OpenBankFast(whichBank);
      WaitRandom(waitingTime);
      Withdraw(0, 0, 25);
      WaitRandom(waitingTime);
      Withdraw(1, 0, 50);
      WaitRandom(waitingTime);
      Withdraw(2, 0, 25 * plankingCost);
      WaitRandom(waitingTime);
      Withdraw(3, 0, 25);
      WaitRandom(waitingTime);
      CloseBank;
      WaitRandom(waitingTime);
    end;
    
    procedure CastPlanks();
      var invSpot: Integer;
    begin
      WriteLn('Casting');
      for invSpot := 4 to 28 do
      begin
        GameTab(tab_Magic);
        WaitRandom(waitingTime);
        Mouse(714, 337, 5, 5, true);
        WaitRandom(2 * waitingTime);
        MouseItem(invSpot, true);
        WaitRandom(3 * waitingTime);
      end;
      WaitRandom(waitingTime);
    end;
    
    procedure BankResults();
    begin
      WriteLn('Depositing');
      OpenBankFast(whichBank);
      WaitRandom(waitingTime);
      DepositAll;
      WaitRandom(waitingTime);
      CloseBank();
      WaitRandom(waitingTime);
    end;
    
    begin
    SetupSRL;
    DeclarePlayers;
      for thisLoad := 1 to numLoads do
      begin
        WriteLn('Starting load ' + IntToStr(thisLoad));
        GetMaterials;
        FindNormalRandoms;
        CastPlanks;
        FindNormalRandoms;
        BankResults;
        FindNormalRandoms;
      end;
    end.
    Last edited by ForgotMyName; 03-02-2010 at 05:30 PM.
    Wow. I've been gone a very long time indeed. So much has changed.

  7. #7
    Join Date
    Sep 2009
    Posts
    580
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I couldn't approve more of this. You sure have the touch of a long timer !

    I made a lunar vial filler, following the same guidelines. If you want, you can check it out (see my sig). It's mostly the same stuff you did, with added failsafes and runechecks and whatnot.

    I like the part where you made waiting a function of its own. May I suggest making the Wait time in WaitRandom (t+random(t)/33) ?
    I don't check this place often, sorry.

    Currently working on - Software Engineering degree. Thank you SRL for showing me the one true path

  8. #8
    Join Date
    Mar 2010
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm currently trying to get this to use a bank chest or one of those bankers with a huge pack instead. All the usual f2p banks seem to get me unwanted attention.
    Wow. I've been gone a very long time indeed. So much has changed.

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
  •