Results 1 to 15 of 15

Thread: I need help making my first script. (It makes Chocolate Dust)

  1. #1
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default I need help making my first script. (It makes Chocolate Dust)

    Is there a way to make it so the script will deposit the chocolate dust as soon as I'm done crushing the chocolate bars?

    Right now, I just have a wait time, and then it'll deposit after the wait time is up (I have this section in bold). Ordinarily, this system would work fine; However, since the user can either use a knife or a pestle and mortar, the wait time would either be too long or too short.
    (the pestle and mortar crushes chocolate twice as fast as a knife, btw.)

    Also, I'm pretty sure I'm not Freeing my DTM's properly. The script runs fine, but when the script ends, I get an error saying "The following DTMs were not freed: [2]"


    Script:
    Simba Code:
    program ChocolateCrusher;

    {$DEFINE SMART}
    {$i SRL\SRL.scar}
    {$i SRL\SRL\Misc\Stats.simba}

    var
      x, y: Integer;

    {YOU MUST HAVE EITHER A KNIFE OR A PESTLE AND MORTAR IN YOUR TOOLBELT!
      If You are a /member/, use the pestle and mortar. The pestle and mortar crushes
    chocolate twice the speed of a knife.
    Free to play people will have to stick with a knife.

    IMPORTANT:
      Make sure you have your Chocolate Bars in the FIRST bank slot.
      The script will end if it is in any other slot.}


    Const
      Mouse_Speed       = 17; // Mouse speed - Higher = Faster. (17 is default)
      Members           = false; // True = Members World. False = Free World.
      Version           = '1.0 Beta';
      NumbOfPlayers     = 1; //How many players you are using.
      StartPlayer       = 0; //Player to start with. (0 = first character)

    // YOU MUST HAVE EITHER A KNIFE OR A PESTLE AND MORTAR IN YOUR TOOLBELT

    procedure DeclarePlayers;
    var i:integer;
    begin
      NumberOfPlayers(NumbOfPlayers);
      CurrentPlayer := StartPlayer;
      for i := 0 to NumbOfPlayers-1 do
        Players[i].BoxRewards  := ['xp', 'oins', 'ostume', 'mote'];

      with Players[0] do
      begin
        Name        := ''; //Player username.
        Pass        := ''; //Player password.
        Pin         := ''; //Bank Pin. (Leave blank if you do not have a bank pin.)
        Loc         := 'vwb'; //Banking Location (See below)
        Active      := True;
      end;
      // YOU MUST HAVE EITHER A KNIFE OR A PESTLE AND MORTAR IN YOUR TOOLBELT!
      //
      // Banking Locations:
      //  'vwb' = Varrock West Bank
      //  'veb' = Varrock East Bank
      //  'fwb' = Falador West Bank
      //  'feb' = Falador East Bank
      //  'db'  = Draynor Bank
      //  'akb' = Al-Kharid Bank
      //
    end;


    Procedure Antiban;
    Begin
      Case Random (30) of
        0: Begin SleepAndMoveMouse(6000 + Random(750)); End;
        1: Begin GameTab(tab_Inv) ExamineInv; GameTab(28); End;
        2: Begin RandomAngle(1); End;
        3: Begin GameTab(Tab_Stats); Wait(3000 + Random(400)); GameTab(28); End;
        4: Begin GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); End;
        End;
    End;


    procedure AntiRandoms;
    begin
      FindNormalRandoms;
      LampSkill := 'random'
    end;


    procedure WithdrawChoc;
    begin
      AntiRandoms;
      if (PinScreen) then
        InPin(Players[CurrentPlayer].Pin);
      if (BankScreen) then
        DepositAll;
        WriteLn('    -Depositing Chocolate Dust.');
      Wait(400 + Random(300));
      Withdraw(0, 0, 28);
      WriteLn('-Withdrawing Chocolate Bars.');
      Wait(200 + Random(200));
      CloseBank;
    end;

    procedure CrushChoc;
    var
      chocbar, chocdust : Integer;
    begin
      begin
      chocbar := DTMFromString('mwQAAAHic42RgYOABYlYgFgFiQSBmY4AAkLgklOYAYgEomwmqBsQWBmJ2qHpfHXGoLG78n4EwYCQCwwEAFn4CcQ==');
      if FindDTM(chocbar, x, y, MIX1, MIY1, MIX2, MIY2) then
        Mouse(x, y, 7, 7, False)
        else
        begin
        wait(1000);
        WriteLn('Could not find Chocolate Bar. Trying again...');
        if FindDTM(chocbar, x, y, MIX1, MIY1, MIX2, MIY2) then
          Mouse(x, y, 7, 7, False)
          else
          begin
          wait(1000);
          WriteLn('Could not find Chocolate Bar. Trying again...');
          if FindDTM(chocbar, x, y, MIX1, MIY1, MIX2, MIY2) then
            Mouse(x, y, 7, 7, False)
            else
            begin
            wait(1000);
            WriteLn('Could not find Chocolate Bar. Logging out.');
            if FindDTM(chocbar, x, y, MIX1, MIY1, MIX2, MIY2) then
              Mouse(x, y, 7, 7, False);
              Logout;
              TerminateScript;
            end;
          end;
        end;
      ChooseOption('Powder')
      FreeDTM(chocbar);
      end;

      begin
      wait(1000)
      [B]chocdust := DTMFromString('m1gAAAHic42JgYOAEYnYg5gNiZiAWAGIOBgjgBmJ+IBaFqgHJMwIxLxBzQeW4oGrZgJgViO1VhIEkE0H8n4E4wEgkRgAAHfUCSg==');
      if FindDTM(chocdust, x, y, MCX1, MCY1, MCX2, MCY2) then
        Mouse(x, y, 22, 23, True);
        WriteLn('  -Crushing Chocolate Bars.');
        Wait(1500 + Random(2000));
        Antiban;
        AntiRandoms;
        Wait(11000 + Random(3000));
      FreeDTM(chocdust);[/B]
      end;
    end;





    begin
      Smart_Server := 10;
      Smart_Members := Members;
      SetupSRL;
      DeclarePlayers;
      MouseSpeed := Mouse_Speed;
      LoginPlayer;

      repeat
        repeat
          OpenBank(Players[CurrentPlayer].Loc, True, True);
          WithdrawChoc;
          CrushChoc;
        until (not LoggedIn);
      until False;
    end.

    Also, should I release this?
    It's a good money making technique, but do you think it would have too much of a negative impact on the economy?
    Last edited by Paula_Deen; 12-24-2011 at 04:58 AM.

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    HOLY COCKBALLS DUDE!
    You left user/pass in script. you are SO LUCKY I got to it first and changed it! Be careful next time!
    PMing you new pass now!
    Also, put SIMBA tags around script please, not quote tags

  3. #3
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    HOLY SHIT!
    Pretty nice account dude
    [20:37] YoHoJo: 51M in pouch
    [20:37] YoHoJo: 1523 total
    [20:37] YoHoJo: 92str
    [20:37] YoHoJo: 93magic
    [20:37] YoHoJo: 99cook
    [20:37] YoHoJo: 99fletch
    [20:37] YoHoJo: 99theiv
    [20:37] YoHoJo: 90wc
    You are very very lucky I got that first, I bet SO MANY losers here would have stolen it....

  4. #4
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Omgggg

    thanks!!!!!!

  5. #5
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You're my hero!!

    THANKS!!
    I can't thank you enough!

    Oh, and thanks for the awesome video tutorials!
    They inspired me!

  6. #6
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Glad to hear it! Many people have, and I love the feeling of helping out so many!
    That's a pretty damn nice account you got there, not too shabby, I can't imagine the stress and anger you would feel if someone nabbed it! Glad it's safe!

  7. #7
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    And thanks for the complement!
    I'm working on 99 magic ... well, I'm letting Simba do it for me.

    Yeah, I was about to rage quit if I'd lose the account.
    I had that account for around 6 years now without anyone ever hacking it.
    (I'm a off and on RSer ... I only recently started playing again. This community may change that though! )

    So, any help with the script?

  8. #8
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Just glanced.
    Since you're using the DTMs so often I wouldn't even bother freeing them.
    Just load the ONCE ONLY, and never free.

    As for deposit.
    Have script search for DTM of regular (non crushed) chocolate in inventory, and when it's not found, that means you've crushed it all. OR have it search for crushed chocolate in your last inventory slot (assuming there is one there) and if one is you are done crushing.

  9. #9
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    And that's a really good idea! Why didn't I think of that?

    Oh, and is Edgeville banking broken?
    I tried it yesterday, and it wouldn't work. :/

  10. #10
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Might be, report it in bug section.
    Check bank.simba and see if it's even a valid option.
    Most people end up writing their own banking

  11. #11
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    "The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105]"

    I don't think I'm understanding what you mean by saying to load them only once...

  12. #12
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    That's normal.
    Happens any time you stop any SRL scripts prematurely.

    As for load once,

    Have
    Procedure LoadDTMs;
    Bein
    bla bla my dtms
    End;

    and only call the procedure ONCE, like after setupsrl or something.

  13. #13
    Join Date
    Dec 2011
    Posts
    58
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay, so I have the script searching for Chocolate Bars in my inventory, but how would I tell the script to end that loop and continue on with the banking process?
    Right now it's searching for the chocolate bars, but it does nothing when it can't find them.
    This is probably going to be simpler than I'm making it.

    I can't use the latter method you suggested because it would just create an infinite loop if there was no item in the last inventory spot ... or would it... hm...

  14. #14
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    2,254
    Mentioned
    21 Post(s)
    Quoted
    238 Post(s)

    Default

    Hey there, if you wanted to not change too much stuff in your script you could just use a variable as your wait time and have a const set to whether or not you use a knife or pestle.

    So you'd have a procedure that says
    Simba Code:
    if (usingKnife=true) then
      begin
        waitvariable:=11000;
      end
    else
      begin
        waitvariable:=20000;
      end;

    Simba Code:
    Wait(waitvariable+ Random(2000));
    Last edited by cause; 12-26-2011 at 11:09 PM.

  15. #15
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Wow, that's an impressive account. Thankfully YoHoJo is an amazing person
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


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
  •