SRL Archive - Help

Can't click item with DTM


blother

2012-03-25 18:23:25

Procedure ClickPieDish;
var
Dish, x, y: Integer;
begin
Dish := DTMFromString('m6wAAAHic42ZgYHBhZGAIAOIgIPYDYjcgtoBieyAOBGIfILYG4udA/BBKvwfij0D8BogfQ9mvgfgeVC7LXw9oOhNRmIsBP+CCYhEgZiQBIwEAuggOYg==');
If FindDTM(Dish, x, y, MSX1, MSY1, MSX2, MSY2) Then
begin
WriteLn('Found pie dish.');
MMouse(x, y, 5, 5);
If IsUpText('ish') Then
begin
WriteLn('Clicking Pie Dish');
Mouse(x, y, 0, 0, True);
end;
end;
FreeDTM(Dish);
end;

It moves the mouse to the pie dish, but it won't click on it. I changed the first MMouse to Mouse and it worked, but it does not work if i check for uptext then click on it.

begginer

2012-03-25 18:30:20

MMouse(x, y, 5, 5);
Mouse(x, y, 5, 5, false); // False is to right click it.

punkd

2012-03-25 18:32:05

MMouse (x, y, 5, 5);
if (IsUpTextMultiCustom(['ish'])) then

try that.

btw, is the dish in the inventory?

blother

2012-03-25 18:37:15

From: punkd
MMouse (x, y, 5, 5);
if (IsUpTextMultiCustom(['ish'])) then

try that.


Nope, that did not work.

MMouse(x, y, 5, 5);
Mouse(x, y, 5, 5, false); // False is to right click it.


I would just use Mouse if i didn't want to check the uptext for it. Using both seems somewhat redundant. Also, the second 5, 5 moves your mouse two times. One time for MMouse and then another for Mouse, which would seem kind of weird.

The dish is in the bank, could that be the problem? I got it to work in the inventory.

punkd

2012-03-25 18:41:22

MMouse (x, y, 5, 5);
if (IsUpTextMultiCustom(['ish'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);


that should do the job.

If your planning on withdrawing more than one, Use Mouse(x, y, 0, 0, False);

blother

2012-03-25 18:46:49

From: punkd
MMouse (x, y, 5, 5);
if (IsUpTextMultiCustom(['ish'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);


that should do the job.

If your planning on withdrawing more than one, Use Mouse(x, y, 0, 0, False);


There is something wrong with the uptext.
If (IsUpTextMultiCustom(['ish'])) Then
begin
WriteLn('Clicking pie dish');
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
end else
WriteLn('Did not click Pie dish.');

I used that to check it and it always says it does not click.

I haven't added withdrawing more, but i plan to. Should i use ChooseOption('ithdraw-x') then type 14 if i want to do half of the inventory worth?

punkd

2012-03-25 18:54:11

Maybe its the uptext. Whats the exact name of the item.

blother

2012-03-25 18:56:27

The name is "Pie dish"

I have tried using 'ie' and 'ie dish' but those did not work either.

It worked using 'Pie dish' but i thought you weren't supposed to use the exact word? Well, I tried to add ChooseOption and now it won't work even when i take that away. Not sure what is the problem now because it just worked a second ago.

begginer

2012-03-25 19:00:32

(*
Withdraw
~~~~~~~~

.. code-block:: pascal

function Withdraw(Col, Row, Amount: Integer): Boolean;

Withdraws Amount at Column/Row.

.. note::

Author: Starblaster100, Town, Wizzup? and Narcle
Last Modified: Unknown

Example:

.. code-block:: pascal

Withdraw(1, 3, 28);
*)

punkd

2012-03-25 19:03:42

If (IsUpTextMultiCustom(['ie','dish'])) Then
begin
WriteLn('Clicking pie dish');
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
end else
WriteLn('Did not click Pie dish.');

I thought it was one word -.-. kk use that. Probly will show did not click pie dish, they click it but it works. In my scripts when im withdrawing 14 items, I tell them to have x set to 14 and just use waitoptionmulti for withdrawing 14.

blother

2012-03-25 19:09:55

From: begginer
(*
Withdraw
~~~~~~~~

.. code-block:: pascal

function Withdraw(Col, Row, Amount: Integer): Boolean;

Withdraws Amount at Column/Row.

.. note::

Author: Starblaster100, Town, Wizzup? and Narcle
Last Modified: Unknown

Example:

.. code-block:: pascal

Withdraw(1, 3, 28);
*)


I might try that, but i didn't want to force putting the item in a specific bank slot.

If (IsUpTextMultiCustom(['ie','dish'])) Then
begin
WriteLn('Clicking pie dish');
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
end else
WriteLn('Did not click Pie dish.');

I thought it was one word -.-. kk use that. Probly will show did not click pie dish, they click it but it works. In my scripts when im withdrawing 14 items, I tell them to have x set to 14 and just use waitoptionmulti for withdrawing 14.


Still didn't work :( I don't understand why it won't find the uptext.

punkd

2012-03-25 19:19:12

0.o if u dnt mind sending me the script i can run a test.

blother

2012-03-25 19:22:58

Procedure ClickPieDish;
var
Dish, x, y: Integer;
begin
Dish := DTMFromString('m6wAAAHic42ZgYHBhZGAIAOIgIPYDYjcgtoBieyAOBGIfILYG4udA/BBKvwfij0D8BogfQ9mvgfgeVC7LXw9oOhNRmIsBP+CCYhEgZiQBIwEAuggOYg==');
If FindDTM(Dish, x, y, MSX1, MSY1, MSX2, MSY2) Then
begin
WriteLn('Found pie dish.');
MMouse(x, y, 7, 7);
If (IsUpTextMultiCustom(['ie', 'dish'])) Then
begin
WriteLn('Clicking pie dish');
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
end else
WriteLn('Did not click Pie dish.');
end;
FreeDTM(Dish);
end;

That is all i have as of now :/ I just started on it and haven't even gotten to opening up the bank and such like that.

I added 'ithdraw' to the uptext and it finds it, but not every time.

punkd

2012-03-25 19:27:39

Well, I tested the function on my system it works with the Function I sent you but try this

Procedure ClickPieDish;
var
Dish, x, y: Integer;
begin
Dish := DTMFromString('m6wAAAHic42ZgYHBhZGAIAOIgIPYDYjcgtoBieyAOBGIfILYG4udA/BBKvwfij0D8BogfQ9mvgfgeVC7LXw9oOhNRmIsBP+CCYhEgZiQBIwEAuggOYg==');
If FindDTM(Dish, x, y, MSX1, MSY1, MSX2, MSY2) Then
begin
WriteLn('Found pie dish.');
MMouse(x, y, 7, 7);
If (IsUpTextMultiCustom(['ie', 'dish'])) Then
begin
WriteLn('Clicking pie dish');
GetMousePos(x, y);
MMouse(x, y, 0, 0);
clickmouse2(true)
end else
WriteLn('Did not click Pie dish.');
end;
FreeDTM(Dish);
end;

Its just something you need to try using different functions. I use HumanMMouse, a function made by Flight.

Does the script even point on the DTM itself?

blother

2012-03-25 19:36:57

From: punkd
Well, I tested the function on my system it works with the Function I sent you but try this

Procedure ClickPieDish;
var
Dish, x, y: Integer;
begin
Dish := DTMFromString('m6wAAAHic42ZgYHBhZGAIAOIgIPYDYjcgtoBieyAOBGIfILYG4udA/BBKvwfij0D8BogfQ9mvgfgeVC7LXw9oOhNRmIsBP+CCYhEgZiQBIwEAuggOYg==');
If FindDTM(Dish, x, y, MSX1, MSY1, MSX2, MSY2) Then
begin
WriteLn('Found pie dish.');
MMouse(x, y, 7, 7);
If (IsUpTextMultiCustom(['ie', 'dish'])) Then
begin
WriteLn('Clicking pie dish');
GetMousePos(x, y);
MMouse(x, y, 0, 0);
clickmouse2(true)
end else
WriteLn('Did not click Pie dish.');
end;
FreeDTM(Dish);
end;

Its just something you need to try using different functions. I use HumanMMouse, a function made by Flight.

Does the script even point on the DTM itself?


It won't find the uptext with that I don't know why. The problem I am sure is solely with the uptext because it works fine if i don't check for it.

Do you mean does it move the mouse over the DTM? It does, but i thought i should use a failsafe to make sure it is clicking the right item if you are going to suggest taking that part out. I may end up doing that because it probably will not end up being an issue if i don't check for the uptext.

punkd

2012-03-25 19:39:49

Use the Procedure I showed. Its a bit different. It should work

blother

2012-03-25 19:42:58

I used it and it worked the first time i tried it, but then i tried to run it more to test it and it hasn't worked since.

punkd

2012-03-25 19:46:21

bro somethings wrong lol. Its not possible for it to work once and not work again.

MSN me [email]Jokerv818@live.com[/email]

blother

2012-03-25 19:49:35

Alright i added you

Brandon

2012-03-25 20:04:32

That's a fragile procedure.. use WaitUptext instead.. why? because the mouse procedure will return before the mouse even gets to x, y.. happening to me as well so a simple wait will help it.. then when it gets to x, y, check for uptext.. it'll work then.

U can even see for yourself:

MMouse(X, Y, 0, 0);
writeln(GetUptext); <— will return an uptext that is different from the object at x, y..

MMouse(X, Y, 0, 0);
if (Waituptext('vdfs', 600) then
writeln(GetUptext); <– will return the exact uptext at X, Y.

blother

2012-03-25 20:14:36

From: ggzz
That's a fragile procedure.. use WaitUptext instead.. why? because the mouse procedure will return before the mouse even gets to x, y.. happening to me as well so a simple wait will help it.. then when it gets to x, y, check for uptext.. it'll work then.

U can even see for yourself:

MMouse(X, Y, 0, 0);
writeln(GetUptext); <— will return an uptext that is different from the object at x, y..

MMouse(X, Y, 0, 0);
if (Waituptext('vdfs', 600) then
writeln(GetUptext); <– will return the exact uptext at X, Y.


Oh wow that is just so… simple lol. Thank you so much! Makes sense why it would work sometimes, but not always. Now i can get on to failing at the rest of my script :p