Results 1 to 12 of 12

Thread: Using worn equipment

  1. #1
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Using worn equipment

    Hi guys, I want to if there is a command(s) to use worn equipment. Im probably not making any sense but here is an example: Say I want to use the explorer's ring and teleport to the cabbage patch, how would i go about doing it using predefined commands.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    You can make a bitmap, bitmap mask or a DTM of the items, then you search them, and click them. This obviously needs some failsafes and that sort of stuff, but basically thats it, there are no built-in commands to wear equipments afaik.
    There used to be something meaningful here.

  3. #3
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    You can make a bitmap, bitmap mask or a DTM of the items, then you search them, and click them. This obviously needs some failsafes and that sort of stuff, but basically thats it, there are no built-in commands to wear equipments afaik.
    I'm asking how to use equipment that i am already wielding, not how to wear items from inventory. Anyways i found it, and it uses inbuilt functions, here it is:

    Simba Code:
    {*******************************************************************************
    procedure MouseEquippedItem(Which : String; Left : Integer);
    By: Nava2
    Description: Mouses Equipped item like MouseItem.
    *******************************************************************************}

    and

    Simba Code:
    {*******************************************************************************
    function ChooseOption(txt: String): Boolean;
    By: Wizzup?
    Description: Finds an option in a popup menu, then clicks on it.
    *******************************************************************************}

  4. #4
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Simba Code:
    function MockUpOperate: Boolean;
    var
      ExplorerBitmap, x, y, H, i: Integer;
      TPA: TPointArray;
      ATPA: Array of TPointArray;
    begin
      ExplorerBitmap := BitmapFromString(5, 5, 'alsjfa;lsjfa;lsfja');
      if FindBitmapToleranceIn(ExplorerBitmap, x, y, MIX1, MIY1, MIX2, MIY2, 4) then
      begin
        MMouse(x, y, 15, 15);
        if WaitUptext('plorer', 800) then
        begin
          ClickMouse2(False);
          Result := WaitOption('bbage', 800);
        end else
        begin
          Result := False;
          Exit;
        end;
      end else
      begin
        Writeln('couldn''t find ring bitmap, attempting TPA');
        if not FindColorsTolerance(TPA, 123456, MIX1, MIY1, MIX2, MIY2, 7) then
        begin
          Result := False;
          Exit;
        end;
        ATPA := TPAtoATPAEx(TPA, 15, 15);
        H := High(ATPA);
        for i := 0 to H do
        begin
          MMouse(x, y, 15, 15);
          if WaitUptext('plorer', 800) then
          begin
            ClickMouse2(False);
            Result := WaitOption('bbage', 800);
            if Result then
              Break;
          end;
        end;
      end;
    end;

  5. #5
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Thats a lot of coding for just right clicking explorer's ring. How long that did that take? But I think your method will only work for one or two versions of the ring since the 3rd and 4th are completely different from the 1st and 2nd ones, whereas those inbuilt functions can click any equipped item and operate them.

  6. #6
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    He included failsafes (Which is something every script should have). That is why the script is a lot just for clicking a simple ring. Something like he made only takes a few minutes at most if you know what you're doing exactly.

    Quote Originally Posted by kongking View Post
    Thats a lot of coding for just right clicking explorer's ring. How long that did that take? But I think your method will only work for one or two versions of the ring since the 3rd and 4th are completely different from the 1st and 2nd ones, whereas those inbuilt functions can click any equipped item and operate them.

  7. #7
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Quote Originally Posted by kongking View Post
    Thats a lot of coding for just right clicking explorer's ring. How long that did that take? But I think your method will only work for one or two versions of the ring since the 3rd and 4th are completely different from the 1st and 2nd ones, whereas those inbuilt functions can click any equipped item and operate them.
    it took 3 to 4 minutes. The colors, uptext, and options could be easily changed within 30 seconds to work with any item. Please note that that function won't work because the bitmap and colors are purely made up.

    Edit:
    BTW you should also call FreeBitmap(ExplorerBitmap) somewhere in there as well as a GameTab(tab_Gear) to make sure it's on the gear screen.
    Last edited by TomTuff; 12-10-2010 at 12:56 AM.

  8. #8
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    What's your opinion(s) on this code:

    Simba Code:
    function OperateEquippedItem(EquipSlot: Integer): Boolean;
    begin
      Result := false;
      if (GetCurrentTab <> tab_Equip) then
        GameTab(tab_Equip);
      if WaitUptext('xplorer', (652 + random(232))) then
        begin
          MouseEquippedItem(inttostr(Equipslot), 2);
          Result:= WaitOption('abb', 562 + random(210));
        end else
        begin
          writeln('Explorers ring is not equipped!');
          Logout;
        end;
    end;

    Note: The equipment slot constants are not the same for Reflection and SRL. The above function uses the constants for SRL. Also for the example i mentioned above, equipslot takes on the value of 11(it won't work for most people if not everyone, since the gametab.scar file for srl is missing the line for ring).

  9. #9
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Quote Originally Posted by kongking View Post
    What's your opinion(s) on this code:

    Simba Code:
    function OperateEquippedItem(EquipSlot: Integer): Boolean;
    begin
      Result := false;
      if (GetCurrentTab <> tab_Equip) then
        GameTab(tab_Equip);
      if WaitUptext('xplorer', (652 + random(232))) then
        begin
          MouseEquippedItem(inttostr(Equipslot), 2);
          Result:= WaitOption('abb', 562 + random(210));
        end else
        begin
          writeln('Explorers ring is not equipped!');
          Logout;
        end;
    end;

    Note: The equipment slot constants are not the same for Reflection and SRL. The above function uses the constants for SRL. Also for the example i mentioned above, equipslot takes on the value of 11(it won't work for most people if not everyone, since the gametab.scar file for srl is missing the line for ring).
    Nope. Doesn't mouse first, so the uptext check will always be bad. Also, there's no need for randomness on WaitOption() or WaitUptext(). And if you are going to put randomness, why such a random number?

  10. #10
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Yeah i forgot that bit, but ive scrapped the function and replaced it with the following to make it less lines of code and more efficient, since I already know that i have explorer's ring equipped(which doesn't need failsafe's logically):
    Simba Code:
    MouseEquippedItem(inttostr(11), 2);
      WaitOption('abb', 362 + randomrange(-100, 210));

    Quote Originally Posted by TomTuff View Post
    Nope. Doesn't mouse first, so the uptext check will always be bad. Also, there's no need for randomness on WaitOption() or WaitUptext(). And if you are going to put randomness, why such a random number?
    As for the random number, its just something that i personally do so that it seems more human(the emphasis being on the word 'more').

  11. #11
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Quote Originally Posted by kongking View Post
    Yeah i forgot that bit, but ive scrapped the function and replaced it with the following to make it less lines of code and more efficient, since I already know that i have explorer's ring equipped(which doesn't need failsafe's logically):
    Simba Code:
    MouseEquippedItem(inttostr(11), 2);
      WaitOption('abb', 362 + randomrange(-100, 210));



    As for the random number, its just something that i personally do so that it seems more human(the emphasis being on the word 'more').
    Checks are necessary in a good script. If you want to ever release public scripts and be considered a scripter by anyone, learn detection methods and failsafes.

    as for the function WaitOption, you must not understand how it works. Here's an extrapolated version of what it does

    Simba Code:
    function WaitOption(text: string; MaxWait: Integer);
    var
      T: Time;
    begin
      MarkTime(T);
      repeat
        if FindUptext(text) then
        begin
          Result := True;
          Break;
        end;
        Wait(10 + random(25));
      until(TimeFromMark(T) > MaxWait);
    end;

    so as you can see, the value of what maxwait is doesn't affect how human you seem.

  12. #12
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Yeah, looks like i misunderstood the function, thanks for clearing it up though.

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
  •