Results 1 to 17 of 17

Thread: Ultimate Alcher

  1. #1
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Ultimate Alcher

    Bazzbarretts Ultimate Alcher

    This script will alch (almost flawlessly) using high alch or low alch, works with members and non members and on any item you want.

    to run just start the script with fire staff equiped and nature runes + alch item(s) in your inventory

    Features:
    can work on more than one items in a session.
    high alch and low alch
    fancy on screen proggy with time till next level
    alot of failsafes
    alchs like a human (sets up items for minimal clicking)
    breaks
    antiban (i feel like i need to credit some one for this...)

    post any bugs/proggys below

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$i SRL\SRL.scar}
    {$i SRL\SRL\misc\arrayloader.scar}
    {$i Reflection\reflection.simba}
    {$i SRL/SRL/Misc/paintsmart.scar}

    type
    {Contains informations pertaining to Interface Components [aka child]
    From new reflcetion needed for MMouseSpell}

      TInterfaceComponent = record
        Actions: TStringArray;
        ID, ParentID, Stack: Integer;
        TextureID, ModelID, ModelZoom: Integer;
        RelativeX, RelativeY, Width, Height: Integer;
        X, Y: Integer;
        Bounds: TBox;
        Text, Name: String;
        IsHidden: Boolean;
      end;

    Var
      BlueB : Integer;
      AlchSpell, AlchSlot, AlchsDone, T, StartNats, NatSlot, TTotal, TimeTillBreak :Integer;
      Items: Array of string;
      LOW_ALCH, HIGH_ALCH, MEMBER: Boolean;

    {************************************************************************************
                                Edit this bit

    *************************************************************************************}

    procedure DeclarePlayers;
    begin
      LOW_ALCH := False;   // Low alch?
      HIGH_ALCH := True;   // High alch?
      Items := ['Iron platebody', 'Gold bracelet']; // Item(s) your are alching
      MEMBER := True; //is the acount members?

      HowManyPlayers := 1;       // How many players are we using?
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';         // Username
      Players[0].Pass := '';         // Password
      Players[0].Pin  := '';
      Players[0].Active := True;             // Use player?
    end;

    {************************************************************************************
                                Dont Edit Below here!

    *************************************************************************************}


    Procedure Fail(reason: String);
    begin
      FreeBitmap(BlueB);
      closebank;
      logout;
      writeln(' ');
      Writeln('Script terminated:');
      writeln(reason);
      terminatescript;
    end;

    {*******************************************************************************
    Function R_GetInterface(Index, ChildIndex: Integer): Integer;
    By: Bobarkinator
    Description: Returns the interface of InterfaceCache[Index][ChildIndex].
    *******************************************************************************}

    function R_GetInterface(Index, ChildIndex: Integer): Integer;
    begin
      Result := SmartGetFieldArray2DObject(0, hook_static_GetInterfaces, Index, ChildIndex);
    end;

    {*******************************************************************************
    function R_GetAbsolutePos(Parent, Child, Component: Integer): TPoint;
    By: Drags111
    Description: Returns the absolute x and y of the interface or interface
    component. If it is NOT a component, set Component to be -1.
    Example: to get the bank's close button absolute pos:
              R_GetAbsolutePosition(762, INTERFACE_BANK_BUTTON_CLOSE, -1);
    Example 2: To get an item's position in the bank:
              R_GetAbsolutePosition(762, INTERFACE_BANK_SLOTS, 7);
    *******************************************************************************}

    function R_GetAbsolutePos(Parent, Child, Component: Integer): TPoint;
    var
      inter, PID, rx, ry, comp: Integer;
      BoundsIndex, BoundsObject: Integer;
    begin
      try
        if(Component > -1)then
        begin
          comp := R_GetInterface(Parent, Child);
          inter := SmartGetFieldArrayObject(comp, hook_interface_GetChildren, Component);
        end else
          inter := R_GetInterface(Parent, Child);
        PID := SmartGetFieldInt(inter, hook_interface_GetParentID);

        if(PID > 0)then
        begin
          Result := R_GetAbsolutePos(PID shr 16, PID and $FFFF, -1);
        end else
        begin
          BoundsIndex := SmartGetFieldInt(inter, hook_interface_GetBoundsArrayIndex);
          BoundsObject := SmartGetFieldArrayObject(0, hook_static_GetInterfaceBoundsArray, BoundsIndex);
          if(BoundsObject > 0)then
          begin
            Result.x := SmartGetFieldInt(BoundsObject, 'x');
            Result.y := SmartGetFieldInt(BoundsObject, 'y');
          end;
        end;

        rx := SmartGetFieldInt(inter, hook_interface_GetX) + Result.x;
        ry := SmartGetFieldInt(inter, hook_interface_GetY) + Result.y;

        if(SmartGetFieldInt(inter, hook_interface_GetHorizontalScrollBarSize) <> 0)then
          rx := rx - SmartGetFieldInt(inter, hook_interface_GetHorizontalScrollBarPosition);
        if(SmartGetFieldInt(inter, hook_interface_GetVerticalScrollBarSize) <> 0)then
          ry := ry - SmartGetFieldInt(inter, hook_interface_GetVerticalScrollBarPosition);

        Result := Point(rx, ry);

      finally
        SmartFreeObject(inter);
        SmartFreeObject(BoundsObject);
      end;
    end;

    Function R_GetSpellCoords(SpellID:Integer):Tpoint;
    begin
      Result := R_GetAbsolutePos(192, SpellID, -1);
    end;

    { Custom spell uses reflection to MMouse a spell
    NORMAL = normal book
    false = lunar }

    Procedure R_MMouseSpellEX( SpellID: Integer; Normal:Boolean);
    var
      info: TPoint;
      Book, tmod: Integer;
    begin
      if member then tmod := 15;
      if Normal then Book := 192 else book := 430;
      if GameTab(TAB_MAGIC) then
      begin
        info :=  R_GetAbsolutePos(book, SpellID, -1);
        if IntInBox(Info.X, Info.Y, IntToBox(547, 205, 737, 430)) then       //spell vissible?
          MouseBox(info.X + tmod, info.Y + tmod, info.X+24, info.Y+24, 3) //move mouse
        else begin
          mouse(727, 385, 3, 5, true); //scroll down
          if IntInBox(Info.X, Info.Y, IntToBox(547, 205, 737, 434)) then       //spell vissible now?
            MouseBox(info.X + tmod, info.Y + tmod, info.X+24, info.Y+24, 3) //move mouse
          else
            writeln('MMouseSpell Failed');
        end;
      end;
    end;

    Procedure R_MMouseSpell( SpellID: Integer);
    begin
      R_MMouseSpellEX(SpellID, true);
    end;

    procedure R_MouseSpellEX( SpellID: Integer; Normal:Boolean);
    begin
      R_MMouseSpellEX(SpellID, Normal);
      ClickMouse2(true);
    end;

    procedure R_MouseSpell( SpellID:Integer);
    begin
      R_MMouseSpell(SpellID);
      ClickMouse2(true);
    end;

    function RC_WaitUpText(s :String; t : Integer):Boolean;
    begin
      Result := true;
      if not R_waitUpText(s, t) then
        result := WaitUpText(s, t);
    end;

    Procedure SetupPlayer;
    var
      I, ML: Integer;
    begin
      FindNormalRandoms;
      MouseSpeed:=10+random(5);
      if LOW_ALCH = HIGH_ALCH then fail('please select high alch or low alch, not both');
      LoginPlayer;
      wait(1500);
      NatSlot := -1;
      ML := R_GetSkillLevel('magic');
      if ML < 21 then Fail('Magic lvl is too low');
      if (ML < 55) and HIGH_ALCH then Fail('Magic lvl is too low');
      for I := 0 to 27 do
      begin
        if GetItemNameAt(I) = 'Nature rune' then
        begin
          startnats := GetItemStackSizeAt(I);
          natslot := I;
        end;
        if (I = 27) and (NatSlot = -1) then Fail('No Nature runes found');
      end;
      //MakeCompass('e');
    end;

    Function AntiBanEx:Boolean;
    begin
      Result := true;
      Case random(2000) of
      0..2,20..30: HoverSkill('magic',false);
      3..6: RandomRClick;
      7..14: PickUpMouse;
      15..16: RandomMovement;
      17: BoredHuman;
      18: ExamineInv;
      19: RandomAngle(random(1));
      31..2000: Result := false;
      end;
      if result then GameTab(TAB_MAGIC);
    end;

    procedure takeabreak;
    begin
      if (getsystemtime-T) > TimeTillBreak then
      begin
        logout;
        writeln('taking a break :)');
        wait(randomrange(600000,1500000));
        writeln('ok lets go again');
        loginplayer;
        T := Getsystemtime;
        TimeTillBreak := Randomrange(2700000, 5400000);
      end;
    end;

    procedure fixbook;
    begin
      GameTab(TAB_MAGIC);
     if SimilarColors(getcolor(727, 238), 4807781, 10) and HIGH_ALCH then mouse(727, 385, 3, 5, true);
     if SimilarColors(getcolor(725, 227), 4807781, 10) and LOW_ALCH then
       dragmouse(727, 303, 0, 4, 727, 317, 0, 4);
    end;

    Procedure SetupItems;
    var I, x, y:Integer;
    begin
      if high(items) > -1 then
      begin
        for I := 0 to high(items) do
          Items[I] := Lowercase(Items[I]);
      end;
      If Not LoggedIn then terminatescript;
      If(R_BankScreen) Then CloseBank;
      for I := 0 to 28 do
      begin
        if(StrInArr(lowercase(GetItemNameAt(I)),items)) then
        begin
          if I = AlchSlot then exit;
          MMouseItem(I);
          getmousepos(x, y);
          DragMouse(x, y, 0, 0,Itemcoords(AlchSlot).x, Itemcoords(AlchSlot).y, 5, 5);
          wait(randomrange(600,1200));
          exit;
        end;
      end;
      Fail('no Items found :(');
    end;

    Procedure SetupAlch;
    var
      SpellCoord: Tpoint;
    begin
      blueB := BitmapFromString(280, 100, 'meJztwkERAAAMAqD+EYxmBVOs' +
            'xh5wrJmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' +
            'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' +
            'qqqqqqqqr/HiMPHZ8=');
      if High(Items) < 0 then Fail('No items to alch selected');
      GameTab(TAB_MAGIC)
      fixbook;
      wait(100);
      SpellCoord := R_GetSpellCoords(alchspell);
      AlchSlot := CoordsToItem(SpellCoord.x, spellcoord.y);
      if alchslot = 0 then AlchSlot := CoordsToItem(SpellCoord.x+25, spellcoord.y+10);
    end;

    procedure Report(witch : String);
    var
      MSToNxtLvl, AlchsPerHour, Time, AD, xp : extended;
    begin
      case witch of
        'alch':
          begin
            Alchsdone := StartNats - GetItemStackSizeAt(NatSlot);
            if LOW_ALCH then xp := alchsdone * 31
              else xp := alchsdone * 65;
            time := (getsystemtime - TTotal);
            AD := Alchsdone;
            AlchsPerHour := (AD div time)*3600000;
            MsToNxtLvl := R_ExpToNextLevel('magic');
            MsToNxtLvl := MsToNxtLvl / (AlchsPerhour * 65);
            MsToNxtLvl := MsToNxtLvl * 3600000;
            ClearRSCanvas(SMART_Canvas.canvas);
            DrawBitmap(BlueB, SMART_Canvas.canvas, 5, 237);
            SMART_DrawTextEx(false, 15, 242, loginchars, 'Mage lvl: ' + inttostr(R_GetSkillLevel('magic')), 65535);
            SMART_DrawTextEx(False, 15, 257, loginchars, 'Alchs done: '+Inttostr(alchsdone), 65535);
            SMART_DrawTextEx(False, 15, 272, loginchars, 'Alchs Per Hour: ' + inttostr(floor(AlchsPerHour)), 65535);
            SMART_DrawTextEx(False, 15, 287, loginchars, 'Xp gained: ' + inttostr(floor(xp)), 65535);
            SMART_DrawTextEx(False, 15, 302, loginchars, 'Time Run: ' + MsToTime(GetTimeRunning, Time_Short), 65535);
            SMART_DrawTextEx(False, 15, 317, loginchars, 'Time Till next Lvl: ' + MsToTime(floor(mstonxtlvl), Time_Short), 65535);
          end;
      end;
    end;

    procedure WaitBetweenClicks;
    begin
      if not LOW_ALCH then wait(900+random(300)-random(300)); //models a real persons clicking behaviour
    end;

    procedure Alch;
    var
     Fails :integer;
    begin
      if Not Loggedin then terminatescript;
      FindNormalRandoms;
      Gametab(Tab_Magic);
      fixbook;
      R_MouseSpell(alchspell);
      repeat
        if AntibanEx then
        begin
          Gametab(Tab_Magic);
          fixbook;
          R_MouseSpell(alchspell);
        end;
        if RC_WaitUpText('options', 2000) then
        begin
          Fails := 0;
          FindNormalRandoms;
          if Not R_ItemSlotExists(NatSlot) then
          begin
            fail('Out of nature runes');
          end;
          clickmouse2(true);
          Waitbetweenclicks;
          levelup;
          if RC_WaitUpText('lch', 2000) then
          begin
            wait(200);
            clickmouse2(true);
          end else exit;
          Waitbetweenclicks;
          Report('alch');
          TakeABreak;
        end else
        begin
          if IsUpText('options') then
          begin
            writeln('its ok reflection is retarded');
            Fails := 0;
            FindNormalRandoms;
            clickmouse2(true);
            Waitbetweenclicks;
            levelup;
            clickmouse2(true);
            Waitbetweenclicks;
            Report('alch');
            TakeABreak;
          end else
          begin
            FindNormalRandoms;
            if Not R_ItemSlotExists(AlchSlot) then
            begin
              setupitems;
              exit;
            end;
            Gametab(Tab_Magic);
            fixbook;
            R_MouseSpell(alchspell);
            inc(Fails);
            if Fails > 3 then
              Fail('were stuck in a loop. terminateing script');
          end;
        end;
      until(false);
    end;


    procedure startsetup;
    begin
      Smart_Server := 36;
      Smart_Members:= false;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      Cleardebug;
      SetupSRL;
      SetupReflection;
      SMART_SetupDebug;
      T := getsystemtime;
      TTotal := T;
      TimeTillBreak := Randomrange(2700000, 5400000);
    end;

    procedure AlchMain;
    begin
      SetupAlch;
      setupItems;
      repeat
        Alch;
      until(false);
    end;

    begin
      StartSetup;
      DeclarePlayers;
      setupplayer;
      If LOW_ALCH then alchspell := 38 else alchspell := 59;
      AlchMain;
    end.
    Last edited by BazzBarrett; 07-19-2011 at 08:30 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    pretty large script for just alching (:
    but looks nice. grats on the release

  3. #3
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    what would happen if i set high and low alch both to true or false?

    also maybe make it a single option for each player

    ~shut

    EDIT: change this line

    if LOW_ALCH and HIGH_ALCH then

    to

    if LOW_ALCH = HIGH_ALCH then

    EDIT: or like i said, have it as one bool and have it in the Players[x]
    Last edited by Shuttleu; 07-19-2011 at 08:28 PM.

  4. #4
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Shuttleu View Post
    what would happen if i set high and low alch both to true or false?

    also maybe make it a single option for each player

    ~shut
    both to true it will come up with a warning and end. not sure about both to false. oh yer and it does not support multiplayer i forgot about that. ill add that in later.

  5. #5
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by BazzBarrett View Post
    both to true it will come up with a warning and end. not sure about both to false. oh yer and it does not support multiplayer i forgot about that. ill add that in later.
    change this line

    if LOW_ALCH and HIGH_ALCH then

    to

    if LOW_ALCH = HIGH_ALCH then

    or like i said, have it as one bool and have it in the Players[x]

    ~shut

  6. #6
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    why not just have HIGH_ALCH.
    OBVIOUSLY if your not high alching your low alching

  7. #7
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    why not just have HIGH_ALCH.
    OBVIOUSLY if your not high alching your low alching
    originaly it was gonna be a huge script that did alching plank making and auto heating, with a GUI how ever i never made the auto heater bit and alot of the script was built around the idea of all 4 (hence high alch and low alch option(and support for the lunar spellbook)) the script is not very idiot proof as well because the alching part was origionaly a personal script.

  8. #8
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    i always like to keep my script dynamic, make all of the changable bits a global var and set them at the start of the user, so things like the spell and the item, it makes adding things and extending the script much easier

    for a example take a look at my catherby fisher (red bar in siggy)

    ~shut

  9. #9
    Join Date
    Dec 2009
    Location
    i'm... wait where am i?!?
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    this works great! did a test run with a thousand magic longs and there wasn't a single problem that i saw, the on screen proggy is pretty cool to i don't have a way to put it on here though :/ but it finished the longs in record time since i always get bored of clicking lol. great script.

  10. #10
    Join Date
    Sep 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by BazzBarrett View Post
    both to true it will come up with a warning and end. not sure about both to false. oh yer and it does not support multiplayer i forgot about that. ill add that in later.
    I don't think there is really need for multiplayer for an alching script. I rarely see anyone adding multiplayer lately. Most of the scripts now are more focused on leveling mains and what not, which is definitely a good thing

  11. #11
    Join Date
    Dec 2009
    Location
    i'm... wait where am i?!?
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i'm loving this script iv'e done 10k magic longs and my magic level is going up so much easier it seems flawless!

  12. #12
    Join Date
    May 2011
    Location
    In an Island.
    Posts
    1,413
    Mentioned
    2 Post(s)
    Quoted
    149 Post(s)

    Default

    Great Script! Really great script, Bazz!
    I've used it to high alch all items I've done at crafting! It saved me a lot of time!
    Keep making these kind of scripts...good and efficient! *thumbs up*

  13. #13
    Join Date
    Sep 2010
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    This script always crashes for me. Idk why :S

  14. #14
    Join Date
    Sep 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it keeps saying "magic level too low" and terminates the script.
    My magic level is 72?

  15. #15
    Join Date
    Oct 2010
    Location
    Brasil PR Ponta Grossa
    Posts
    96
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    outdated =/, can you fix?

  16. #16
    Join Date
    Jan 2008
    Location
    Houston, Texas, USA
    Posts
    770
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by otavioafm View Post
    outdated =/, can you fix?
    Use Smurg's JackofAllTrades http://villavu.com/forum/showthread.php?t=62146

  17. #17
    Join Date
    Aug 2011
    Location
    Spooner Street
    Posts
    309
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by otavioafm View Post
    outdated =/, can you fix?
    MSI Alcher works nicely as well. http://villavu.com/forum/showthread.php?t=57723

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
  •