Results 1 to 7 of 7

Thread: Help with script

  1. #1
    Join Date
    Mar 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with script

    I'm trying to make my first script, and i got a lot of help. I got the whole skeleton for the script and just needed to fill things in. The script is a wine drinker and I need a way to click all the 28 wines in the inventory. When I try the script now it only opens the bank and close it again.

    here is the code I have now:
    Code:
    Program WineDrinker;
    {$DEFINE SMART} {Tells The Script To Open Smart Client}
    {$i SRL/srl.simba}
    
    Var
    X, Y, wine: Integer; // Variables
    
    Procedure CallThangs;
    Begin
      wine := DTMFromString('mrAAAAHic42BgYOAGYlYGCGADYjEglgRiYSQ5DihfEirPBcRMUD1dhtpQHnZsxIAfMBLAMAAA3PEB9Q==');
    End;
    
    
    Procedure FreeThangs;
    Begin
      FreeDTM(wine);
    End;
    
    
    
    Procedure OpenmyBank; {Going To Give You A Easy Shell}
    Begin
     If (FindObjCustom(X, Y, ['Bank', 'booth'], [5862270, 5928063, 5928320, 5862527], 10)) Then
     Begin
      ClickMouse2(False)
      Wait(150 + Random(50));
      ChooseOption('Bank'); {The Option Uptext Here}
      While(IsMoving) Do
        wait(2000+random(100)); {2 Second Wait For Bankscreen To Show}
     End;
    End;
    
    
    {In FindDTM(X,Y,MSX1 > The MSX1 + Rest Stands for Mainscreen Coords}
    Procedure WithdrawWines; {This Will Take Them out of Bank}
    Begin
        If (Bankscreen) Then
         Begin
          If FindDTM(wine, X, Y, MSX1, MSY1, MSX2, MSY2) Then
            Wait(150 + Random(50)); {To Give It Time To Move Mouse Over Object}
            ClickMouse2(False); {False Means Right Click, So Were Finding The Wines Then Right Clicking Them}
            Wait(150 + Random(50)); {This Gives It Time For The UpText To Show}
            ChooseOption('Withdraw-All'); {After Finding The Object And Right Clicking This Will Choose The Option 'Withdraw-All'}
         End;
    End;
    
    
    {Cant Remember How To Do The Case Here So Ask On Forums}
    Procedure DrinkWines; {Handles Drinking The Wines}
    Begin {Notice These are MIX? > I Stands For Inventory}
       Repeat
           If FindDTM(wine, X, Y, MIX1, MIY1, MIX2, MIY2) Then
              Begin
                If (IsUpText('Drink')) Then
                  Begin
                    wait(400 + random(150));
                    ClickMouse2(False);
                    Wait(150 + Random(100));
                    ChooseOption('Drink');
                  End;
              End;
           Until Not(FindDTM(wine, x, y, MIX1, MIY1, MIX2, MIY2));
       End;
    
    
    Procedure HandleBanking;
    Begin
        OpenmyBank;
        Deposit(1, 28, True);{Simple Deposit SRL Includes Function Will Deposit All Items In Invetory}
        WithdrawWines; {Calls The Procedure To Withdraw Wines}
        CloseBank;
    End;
    
    
    
    Begin
      Smart_Server := 10;
      Smart_Members := True;
      Smart_Signed := True;
    
      SetupSRL;
      AddOnTerminate('FreeThangs')
      SetAngle(SRL_ANGLE_HIGH)
      Repeat
      HandleBanking;
      DrinkWines;
      Until(False);
      FreeThangs;
      Terminatescript();
    End.
    The notes are to help me because i'm new to scripting.
    Thanks

    Alexmeh

  2. #2
    Join Date
    Nov 2011
    Location
    MA
    Posts
    545
    Mentioned
    3 Post(s)
    Quoted
    10 Post(s)

    Default

    The first thing I noticed was you don't move the mouse in your WithdrawWines or DrinkWines procedures

  3. #3
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Before using ClickMouse2, you must do MMouse(x, y, 0, 0) - this will move the mouse to where you want before clicking.

    To save from actually having to do this, you could just use Mouse(x, y, 0, 0, False) which moves the mouse and clicks

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Before using ClickMouse2, you must do MMouse(x, y, 0, 0) - this will move the mouse to where you want before clicking.

    To save from actually having to do this, you could just use Mouse(x, y, 0, 0, False) which moves the mouse and clicks
    Without randomness?
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  5. #5
    Join Date
    Mar 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i now got this, but it also doesn't withraw the wines.

    Code:
    Program WineDrinker;
    {$DEFINE SMART}
    {$i SRL/srl.simba}
    
    Var
    X, Y, wine: Integer;
    
    Procedure CallThangs;
    Begin
      wine := DTMFromString('mrAAAAHic42BgYOAGYlYGCGADYjEglgRiYSQ5DihfEirPBcRMUD1dhtpQHnZsxIAfMBLAMAAA3PEB9Q==');
    End;
    
    
    Procedure FreeThangs;
    Begin
      FreeDTM(wine);
    End;
    
    
    Procedure OpenmyBank;
    Begin
     If (FindObjCustom(X, Y, ['Bank', 'booth'], [5862270, 5928063, 5928320, 5862527], 10)) Then
     Begin
      Mouse(x, y, 5, 5, False)
      Wait(150 + Random(50));
      ChooseOption('Bank');
      While(IsMoving) Do
        wait(2000+random(100));
     End;
    End;
    
    
    Procedure WithdrawWines;
    Begin
        If (Bankscreen) Then
         Begin
          If FindDTM(wine, X, Y, MSX1, MSY1, MSX2, MSY2) Then
            Mouse(x, y, 5, 5, False);
            ChooseOption('Withdraw-All');
         End;
    End;
    
    
    Procedure DrinkWines;
    Begin
       Repeat
           If FindDTM(wine, X, Y, MIX1, MIY1, MIX2, MIY2) Then
              Begin
                Mouse(x, y, 5, 5, True)
              End;
       Until Not(FindDTM(wine, x, y, MIX1, MIY1, MIX2, MIY2));
    End;
    
    
    Procedure HandleBanking;
    Begin
        OpenmyBank;
        Deposit(1, 28, True);
        WithdrawWines;
        CloseBank;
    End;
    
    
    
    Begin
      Smart_Server := 10;
      Smart_Members := True;
      Smart_Signed := True;
    
      SetupSRL;
      AddOnTerminate('FreeThangs')
      SetAngle(SRL_ANGLE_HIGH)
      Repeat
      HandleBanking;
      DrinkWines;
      Until(False);
      FreeThangs;
      Terminatescript();
    End.

  6. #6
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by Rich View Post
    Without randomness?
    Ahah lol my bad. I'm currently working on a Mining Script where if I add randomness it may miss the ore.

    Oh well

  7. #7
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Simba Code:
    Procedure WithdrawWines;
    Begin
        If (Bankscreen) Then
         Begin
          If FindDTM(wine, X, Y, MSX1, MSY1, MSX2, MSY2) Then
          WriteLn('We Found the Wine'); // to see if it finds your DTM
          Begin // Missing the Begin
            Mouse(x, y, 5, 5, False);
            Wait(75 + Random(15)); // also would just give it a small wait for the uptext to show.
            ChooseOption('Withdraw-All');
           End;
         End;
    End;
    Last edited by Google; 05-05-2012 at 12:12 AM.

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
  •