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