SRL Archive - OSR Help

Telekinetic Grab > Item?


bas

2014-05-27 19:12:17

Hello!
I'm working on a script, everything is running fine espect the main part of the script!

It needs to cast Telekinetic Grab on a item on the ground.

Can anyone give me a working example code

Any help would be great! Its the last part i need :(

Many thanks.,

ATM have this but its hovering over the item (also other things that have same colour) but wont click it!:

[BANANA]procedure UseGrabSpell;
begin

GameTab(tab_Magic);
makecompass('n');
setangle(0);
Wait(RandomRange(75, 150));


if FindColorsTolerance(TPA,TELE_GRAB,673,267,708,297,39) then
begin
writeln('found Telegrab spell, we have Law runes!');

mmouse(690,284,5,5);
wait(randomrange(200,350));
clickmouse2(true);

end;
end;



procedure ClickKnife;
var
time: Integer;
begin
if not LoggedIn then Exit;
repeat
Wait(RandomRange(500,700));

if (FindObj(x, y, 'nife', KNIFE, 7)) then

mmouse(x,y,0,0);
wait(randomrange(600,800));

until IsUpTextMultiCustom(['Knife', 'nife']);

Writeln('# Found Knife! #');
clickmouse2(true);
Writeln('# Clicked! #');
end; [/BANANA]

I'm sorry, Simba tags are screwing up for me.

Eduard

2014-05-27 19:20:46

Are u sure you have declared TPA? I see no color options or any procedures in it for finding the right TPA?

bas

2014-05-27 19:26:28

From: Eduard
Are u sure you have declared TPA? I see no color options or any procedures in it for finding the right TPA?


Dont mind, i have it above somewhere. the clicking spell is working perfect :) it just wont click the item :(… very strange never had issue like this before.

Nebula

2014-05-27 19:26:32

I have formatted this using proper standards so it is easier for everyone to read


procedure ClickKnife;
var
time: Integer;
begin
if not LoggedIn then
Exit;
repeat
Wait(RandomRange(500,700));
if (FindObj(x, y, 'nife', KNIFE, 7)) then
mmouse(x,y,0,0);
wait(randomrange(600,800));
until IsUpTextMultiCustom(['Knife', 'nife']);

Writeln('# Found Knife! #');
clickmouse2(true);
Writeln('# Clicked! #');
end;

bas, I think your problem lies in not understand the FindObj function's parameters. It requires an x and y coordinate, uptext, COLOR, and a tolerance. your color is not a color, it is the word knife. To get the knife color, use the color picking tool in simba (blue eye drop thing). If you are using knife as a variable/constant to store the color of the knife, then I guess it's fine the way it is. in that case, this is your problem:


repeat
Wait(RandomRange(500,700));
if (FindObj(x, y, 'nife', KNIFE, 7)) then
mmouse(x,y,0,0);
wait(randomrange(600,800));
until IsUpTextMultiCustom(['Knife', 'nife']);

The function FindObj returns true if it finds the object. Therefore if FindObj returns true, the mouse must already be on the object and the uptext is correct as well – so you may remove the mmouse and IsUpText functions, so you may be left with this:


while not FindObj(x, y, 'nife', KNIFE, 7) do
wait(randomrange(600,800));

This will try and find the knife, waiting 600-800ms if unsuccessfull then try again until successfull.

let me know how that works for you!

bas

2014-05-27 19:29:47

From: Nebula
I have formatted this using proper standards so it is easier for everyone to read


procedure ClickKnife;
var
time: Integer;
begin
if not LoggedIn then
Exit;
repeat
Wait(RandomRange(500,700));
if (FindObj(x, y, 'nife', KNIFE, 7)) then
mmouse(x,y,0,0);
wait(randomrange(600,800));
until IsUpTextMultiCustom(['Knife', 'nife']);

Writeln('# Found Knife! #');
clickmouse2(true);
Writeln('# Clicked! #');
end;

bas, I think your problem lies in not understand the FindObj function's parameters. It requires an x and y coordinate, uptext, COLOR, and a tolerance. your color is not a color, it is the word knife. To get the knife color, use the color picking tool in simba (blue eye drop thing). If you are using knife as a variable/constant to store the color of the knife, then I guess it's fine the way it is. in that case, this is your problem:


repeat
Wait(RandomRange(500,700));
if (FindObj(x, y, 'nife', KNIFE, 7)) then
mmouse(x,y,0,0);
wait(randomrange(600,800));
until IsUpTextMultiCustom(['Knife', 'nife']);

The function FindObj returns true if it finds the object. Therefore if FindObj returns true, the mouse must already be on the object and the uptext is correct as well – so you may remove the mmouse and IsUpText functions, so you may be left with this:


while not FindObj(x, y, 'nife', KNIFE, 7) do
wait(randomrange(600,800));

This will try and find the knife, waiting 600-800ms if unsuccessfull then try again until successfull.

let me know how that works for you!


Thanks, i will try that right now. i have the const KNIFE areally.

edit: It does hover over the knife, but it doesnt click it.. it repeat moving over and over..

Nebula

2014-05-27 19:53:08

From: bas
Thanks, i will try that right now. i have the const KNIFE areally.

edit: It does hover over the knife, but it doesnt click it.. it repeat moving over and over..


run this and then copy/paste what the debug box says.


while not FindObj(x, y, 'nife', KNIFE, 7) do
begin
writeln('looping');
wait(randomrange(600,800));
end;
wait(randomrange(600,800));
writeln(rs_getuptext);
Writeln('# Found Knife! #');
clickmouse2(true);
Writeln('# Clicked! #');

bas

2014-05-28 09:42:36

From: Nebula
run this and then copy/paste what the debug box says.


while not FindObj(x, y, 'ine', WINE, 7) do
begin
writeln('looping');
wait(randomrange(600,800));
end;
wait(randomrange(600,800));
writeln(rs_getuptext);
Writeln('# Found WINE! #');
clickmouse2(true);
Writeln('# Clicked! #');


Thank very much, i tried it. but still no success…….

"found Telegrab spell, we have Law runes!
Looping: Search/Click WINE…
Looping: Search/Click WINE…
Looping: Search/Click WINE…"

Edit1: i Changed to WINE of zamorak.
EDIT2:

When i do move the mouse over (correct coords, no findObj)

it say:

found Telegrab spell, we have Law runes!
Looping: Search/Click WINE…
&pab Tp|p^|&pb|p &[p& _& M|&p pj zp^p[p^
&pab Tp|p^|&pb|p &[p& _& M|&p pj zp^p[p^
# Found WINE! #
# Clicked! #

else if i move with findobj it just repeats and hover over wine, then hover over pray altar, wine again, some door? wine, wine, pray, wine, door pray..? So i guess it dont see the 'ine' in FindObj?

EDIT 3:

Changed rs_getuptext to getuptext.
Now it show:

Cast
Looping: Search/Click WINE…
Cast
Looping: Search/Click WINE…
Cast
Looping: Search/Click WINE…

Nebula

2014-05-28 15:10:10

From: bas
Thank very much, i tried it. but still no success…….

"found Telegrab spell, we have Law runes!
Looping: Search/Click WINE…
Looping: Search/Click WINE…
Looping: Search/Click WINE…"

Edit1: i Changed to WINE of zamorak.
EDIT2:

When i do move the mouse over (correct coords, no findObj)

it say:

found Telegrab spell, we have Law runes!
Looping: Search/Click WINE…
&pab Tp|p^|&pb|p &[p& _& M|&p pj zp^p[p^
&pab Tp|p^|&pb|p &[p& _& M|&p pj zp^p[p^
# Found WINE! #
# Clicked! #

else if i move with findobj it just repeats and hover over wine, then hover over pray altar, wine again, some door? wine, wine, pray, wine, door pray..? So i guess it dont see the 'ine' in FindObj?

EDIT 3:

Changed rs_getuptext to getuptext.
Now it show:

Cast
Looping: Search/Click WINE…
Cast
Looping: Search/Click WINE…
Cast
Looping: Search/Click WINE…


okay so pretty much the client isnt recognizing the uptext that says something like "cast telekentic grab -> knife/wine/whatever". Maybe a good way to solve this is to find the wine/whatever using find obj BEFORE clicking tele grab so that the uptext is the regular font. Save the coordinates of the wine/whatever as x,y in findobj– then click telegrab and then mouse to x,y so you're back to where it found the wine. It might not be the most human thing, but who even knows if jagex would even detect that.

bas

2014-05-30 19:22:54

From: Nebula
okay so pretty much the client isnt recognizing the uptext that says something like "cast telekentic grab -> knife/wine/whatever". Maybe a good way to solve this is to find the wine/whatever using find obj BEFORE clicking tele grab so that the uptext is the regular font. Save the coordinates of the wine/whatever as x,y in findobj– then click telegrab and then mouse to x,y so you're back to where it found the wine. It might not be the most human thing, but who even knows if jagex would even detect that.


I found it :) Made uptext if find 'take' option it save the mouse pos then click telegrab then move back to saved coords and release em.

Thanks for the help anyways :)