Results 1 to 8 of 8

Thread: [TUT]Using Equipped Items[TUT]

  1. #1
    Join Date
    May 2008
    Location
    Mental Hospital
    Posts
    414
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default [TUT]Using Equipped Items[TUT]

    This is for people who are just starting to learn to script and want to know the basics of using the equipment you are wearing.

    I have seen a few people asking about how to use items that are equipped, so I decided to make a short tutorial on it.

    The first thing we need to do, is have our script switch us to the game tab.
    For this we do:
    Simba Code:
    GameTab(Tab_Equip);

    That one is pretty self explanatory on what it does.

    The next piece of code is:
    Simba Code:
    if WearingItem(Integer) then
    What this does is checks if you are wearing something in the given slot then continues to the next line if you are.


    The equipment slots are numbered as follows:
    Code:
              Helmet Slot = 1
              Cape Slot = 2
              Amulet Slot = 3
              Arrows Slot = 4
              Weapon Slot = 5
              Chest Slot = 6
              Shield Slot = 7
              Legs Slot = 8
              Gloves Slot = 9
              Boots Slot = 10
              Ring Slot = 11
    The next thing we need to do is interact with the equipment slot.
    Simba Code:
    MouseEquippedItem('Equipment', MOUSE_RIGHT);
    So what this does is it moves the mouse to the selected equipment slot and right clicks on it. We want to right click if we are choosing something besides the first option, which is usually remove.

    The options for clicking Equipped Items are as follows:
    Code:
            'helm', 'helmet' 
            'cape'
            'amulet', 'neck', 'necklace' 
            'arrows', 'bolts'
            'right hand', 'weapon'
            'plate', 'chest', 'platebody'
            'left hand', 'sheild', 'shield'
            'legs', 'platelegs', 'skirt', 'plateskirt'
            'gloves', 'gauntlets'
            'boots'
            'ring'
    If you are removing something, or want to use the first option, then you can use
    Simba Code:
    MouseEquippedItem('Equipment', MOUSE_LEFT);
    This will just left click on the equipment slot, making it do whatever the first option of that item is.

    Now if we are right clicking something and need to choose an option we are going to use WaitOption or WaitOptionMulti.
    Simba Code:
    WaitOption('eleport', 1000);
    Lets break this down a little bit.

    The first thing is setting the option you want to click. Remember though these are case sensitive. Also say you are using a glory, it has more then one teleport option so that isn't going to work. For things like that you would need to do something like
    Simba Code:
    WaitOption('eleport Edg', 1000);

    And the other part of that snippet:
    Simba Code:
    , 1000);
    This is the time in milliseconds to wait. 1000 milliseconds = 1 second.

    Now lets put it all together.
    So lets say we wanted to teleport to Castle Wars with a ring of dueling.

    Simba Code:
    program Equipment;
    {$i srl/srl.simba}

    begin
      if WearingItem(11) then //Checks If We Are Wearing A Ring.
      begin //If We Are It Continues Here, If Not It Will Skip To The End Of This Begin Statement.
        MouseEquippedItem('ring', MOUSE_RIGHT); //This Moves The Mouse To The Ring Slot, Then Right Clicks.
        WaitOption('astle W', 1000); //This Is How We Find The Option We Want, And Then The Time In Milliseconds to wait. Then It Clicks It.
      end; //Ends Our Second Begin Statement
    end. //Ends Our First Begin Statement, Thus Ending The Script.

    Did I forgot something? Want to learn something else? Tell me and Ill add it.
    Last edited by Noob King; 06-12-2012 at 12:20 AM.

  2. #2
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Things like these don't really need a tut but it's pretty cool didn't know about these functions until now
    Current Project: Retired

  3. #3
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice and simple. Well done. I appreciated it.

  4. #4
    Join Date
    May 2008
    Location
    Mental Hospital
    Posts
    414
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Gucci View Post
    Things like these don't really need a tut but it's pretty cool didn't know about these functions until now
    There are people that are starting out scripting that either don't know there are docs, or are to lazy to use them. I like to help the people with lack of knowledge not people with lack of motivation.

  5. #5
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    thanks. This will help me to make the bot use a ring teleport niceeeee

  6. #6
    Join Date
    May 2012
    Posts
    78
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    it does need a tutorial also not the whole tut, but it is good to post the slot numbers, so that people know, what number those slot's have

  7. #7
    Join Date
    Nov 2008
    Location
    UK
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Defiantly a useful tutorial. It's very clear and each step is broken down and explained well. Also like the inclusion of the possible values for the variable. Great TUT

  8. #8
    Join Date
    Sep 2019
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i'm unable to run the script, getting an error

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
  •