SRL Archive - OSR Help

Taking Loot


RuneDragon

2013-05-16 17:11:16

I am modifying combat script to take loot.

I added procedure



Procedure CheckLoot;
begin
Writeln('CheckLoot');
if FindObjCustom(x,y,['ake','Take'],[7414386,7350664,6624140,5640311], 10) then
begin
Writeln('FOUND Loot');
PlaySound('G:\rs\beep.wav');
MMouse(x,y, 0, 0);
ClickMouse2(mouse_left);

while (IsMoving = True) do
begin
wait(100);
end;

ClickMouse2(mouse_left);
wait(randomRange(100,450));
ClickMouse2(mouse_left);
wait(randomRange(100,450));
end;
end;

Call it before attacking NPC.

Now script find the loot. Click on it. My char walk over the loot stack.

Since my char moved, x and y get changed. So next 2 ClickMouse2 miss click.

Calling the CheckLoot procedure while standing on loot stack won't work as.. loot is not visible.

How do i get the loot ? May be get my current x,y (where my char standing) and click to take loot. If there any function to do that ?

Shatterhand

2013-05-16 17:17:20

Why dont you take the item with the first click?
Check for uptext, if its 'Take' then left click, if its not, right click and choose option 'Take'.

The Mayor

2013-05-16 17:23:12

From: RuneDragon
I am modifying combat script to take loot.


How do i get the loot ? May be get my current x,y (where my char standing) and click to take loot. If there any function to do that ?


Why don't you just right click the loot and pick it up that way?



Procedure CheckLoot;
var
x, y: Integer;

begin
Writeln('CheckLoot');
if FindObjCustom(x,y,['ake','Take'],[7414386,7350664,6624140,5640311], 10) then
begin
Writeln('FOUND Loot');
PlaySound('G:\rs\beep.wav');
MMouse(x,y, 0, 0);
if IsUpTextMultiCustom(['rrow', 'oins']) then //you can add this uptext check if you don't want to pick up loot you don't want
begin
ClickMouse2(mouse_right); // right click
Wait(RandomRange(250, 500));
ChooseOption('ake'); // select Take
end;

while (IsMoving = True) do
begin
wait(100);
end;
end;
end;

E: Ninjad :(

t4q

2013-05-17 02:46:09

From: RuneDragon


Calling the CheckLoot procedure while standing on loot stack won't work as.. loot is not visible.

How do i get the loot ? May be get my current x,y (where my char standing) and click to take loot. If there any function to do that ?



I've combined this to loot taking procedure… after it doesn't find loot any more - it checks under yout feet:

mmouse(259, 184, 5, 5);
if IsUpTextMultiCustom(['ssence', 'rrow', 'icket', 'diamo', 'uby', 'Natu', 'Law', 'Coal','oins','ire']) then
begin
repeat
clickmouse2(mouse_left);
wait(100+random(50));
until
not IsUpTextMultiCustom(['ssence', 'rrow', 'icket', 'diamo', 'uby', 'Natu', 'Law', 'Coal']);

RuneDragon

2013-05-17 07:00:43

From: Shatterhand
Why dont you take the item with the first click?
Check for uptext, if its 'Take' then left click, if its not, right click and choose option 'Take'.


It take first item it click. But it won't take rest of the items in stack as x,y changed as player moved + they are below players leg.


From: The Mayor
Why don't you just right click the loot and pick it up that way?



Procedure CheckLoot;
var
x, y: Integer;

begin
Writeln('CheckLoot');
if FindObjCustom(x,y,['ake','Take'],[7414386,7350664,6624140,5640311], 10) then
begin
Writeln('FOUND Loot');
PlaySound('G:\rs\beep.wav');
MMouse(x,y, 0, 0);
if IsUpTextMultiCustom(['rrow', 'oins']) then //you can add this uptext check if you don't want to pick up loot you don't want
begin
ClickMouse2(mouse_right); // right click
Wait(RandomRange(250, 500));
ChooseOption('ake'); // select Take
end;

while (IsMoving = True) do
begin
wait(100);
end;
end;
end;

E: Ninjad :(


Thanks @The Mayor, i used some of your code. But we have a stack of items as drop, not just one item. For one item, just clicking on it will work.

From: t4q
I've combined this to loot taking procedure… after it doesn't find loot any more - it checks under yout feet:

mmouse(259, 184, 5, 5);
if IsUpTextMultiCustom(['ssence', 'rrow', 'icket', 'diamo', 'uby', 'Natu', 'Law', 'Coal','oins','ire']) then
begin
repeat
clickmouse2(mouse_left);
wait(100+random(50));
until
not IsUpTextMultiCustom(['ssence', 'rrow', 'icket', 'diamo', 'uby', 'Natu', 'Law', 'Coal']);


@t4q i think this is what i need.

But it is not working for me. as mouse is not correctly over the loot.

In my code, i put a big wait after the mmmouse, so i can see the mouse is not over the loot, so i am not getting any uptext.


mmouse(259, 184, 5, 5);
wait(randomRange(1100,1500));

I want to read mmmouse documentation to get it exactly over loot :)

my current function


Function CheckLoot:Boolean;
begin
Writeln('[CheckLoot] START');

if FindObjCustom(x,y,['ake','Take'],[7414386,7350664,6624140,5640311, 15000814], 10) then
begin
Writeln('[CheckLoot] FOUND Loot');
// playSound(ScriptPath + 'beep.wav');
MMouse(x,y, 0, 0);
ClickMouse2(mouse_right);
Wait(RandomRange(150, 300));
ChooseOption('ake');

mmouse(259, 184, 5, 5);

wait(randomRange(1100,1500));

if IsUpTextMultiCustom(['Grape', 'rape','ake']) then
begin
repeat
Writeln('[CheckLoot] Taking Loots below you');
ClickMouse2(mouse_left);
Wait(RandomRange(150, 300));
until not IsUpTextMultiCustom(['Grape', 'rape','ake']);
end;

wait(200+ random(100));

end;

wait(randomRange(600,900));
Writeln('[CheckLoot] END');
end;


IsUpTextMultiCustom(['Grape', 'rape','ake']) is always return FALSE as "mmouse(259, 184, 5, 5)" is not moving mouse over the loot.

Shatterhand

2013-05-17 07:07:17

From: RuneDragon
It take first item it click. But it won't take rest of the items in stack as x,y changed as player moved + they are below players leg

You should check the right click, store the wanted items in a list then click on avatar (make a box for the area and keep right clicking till you find it) for n-1 times (first item is walking there).

I have a similar method in my fighting script, but it might be a litle bit too complicated. :)

RuneDragon

2013-05-17 13:54:20

Thank you Shatterhand. That is little complicated for me, too bad at maths :)

Now it take most of the drops, but it is bot like, take a grape, kill a guard, run back and take next.. some times it pick all loot, may be some camera angle make it possible.

I tried your script, but i get some error. I will post it on your thread.