PDA

View Full Version : [TUT]Using Equipped Items[TUT]



Noob King
06-11-2012, 10:33 PM
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:
GameTab(Tab_Equip);

That one is pretty self explanatory on what it does.

The next piece of code is:
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:

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.
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:


'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
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.
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
WaitOption('eleport Edg', 1000);

And the other part of that snippet:
, 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.

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.

Gucci
06-11-2012, 10:35 PM
Things like these don't really need a tut but it's pretty cool didn't know about these functions until now

[S]paz
06-11-2012, 10:36 PM
Nice and simple. Well done. I appreciated it.

Noob King
06-11-2012, 11:14 PM
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.

Master BAW
06-18-2012, 06:59 PM
thanks. This will help me to make the bot use a ring teleport :D niceeeee:)

iraqownz
07-11-2012, 07:15 AM
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 :)

mounty
11-23-2012, 06:02 PM
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 :)

barrysingh101
10-06-2019, 10:59 AM
i'm unable to run the script, getting an error