SRL Archive - OSR Help

[HELP] FindDTM & Clicking Problem


Enox

2012-05-12 23:36:06

Hi guys! I'm new here, just joined actually.

I came here figuring I'd probably just end up a generic leecher, but there wasn't a script for what I wanted (Grenwalls, for the sake of the economy) and so I thought I'd start to learn a bit. Not that I would even release this if I make one… (Not that I even CAN make one, hah. Newb here.) but if I learned more I guess I could contribute something less damaging to such a good money method. But anyways…

I used this tut from YoHoJo, and its oldish but not THAT old so I figured it would work. (http://www.youtube.com/watch?v=SlS4q9MiFX4)

I just figured out how to make a DTM, so I did that. It only detects what I want it to, which is good (I found that out in the DTM editor.) My problem is I was trying to make my mouse right click the DTM (in this case, a Fruitbat Pouch) and then I want it to click summon. Thats all I want right now. FindDTM, Move mouse, right click, summon. Thats it.

I am using RS in my internet browser so I made sure I selected the screen as my client. My problem is that when I start the script, it looks like it isn't making it to this line :

WriteLn('Bat Pouch found.');


It doesn't print it in the debug area. The mouse does not move at all. All it says is this:


[Hint] C:\Simba\Includes\SRL/SRL/core/animation.simba(257:3): Variable 'X' never used at line 256
[Hint] C:\Simba\Includes\SRL/SRL/core/animation.simba(257:3): Variable 'Y' never used at line 256
Compiled successfully in 514 ms.
Successfully executed.



Heres the script:


program SumBat;


{$i srl/srl.simba}

var
BatPouch, X, Y: Integer;


begin

SetupSRL;

BatPouch := DTMFromString('mrAAAAHic42BgYOAHYmYGCOAEYnEglgFiaSDmA2JBIJYEYh6oGkaouBQQywLxlNP2QJIJJ5ZkwA8YCWAYAAA51gLJ');
if FindDTM(BatPouch, X, Y, MIX1, MIY1, MIX2, MIY1) Then
Begin
WriteLn('Bat Pouch found.');
MMouse(X, Y, 7, 7);
If IsUpText('ruit') Then
Mouse(X, Y , 0, 0, False);
ChooseOption('ummon');
End;

FreeDTM(BatPouch);
end.





ALSO

In YoHoJo's vid, he said

Mouse(X, Y , 0, 0);

should move the mouse AND click. Does that mean I could just omit the MMouse command and jump straight to this:

Mouse(X, Y , 7, 7, False);

?


Just wondering. SORRY FOR THE LONG POST!



It's probably something really simple, but I am a newb so I don't really understand I guess. Its also really late, and I'm tired. Any help would be great. I wanna move on so I can understand more. Thanks, and please help me out if you can!

Brandon

2012-05-12 23:51:07

In the code you posted you cannot omit anything there. One will move the mouse, the other will check for the uptext and finally the next mouse command will right click and choose the option.

I personally would prefer:


MMouse(X, Y, 7, 7);
if (IsUptext....) then
begin
Clickmouse2(MOUSE_RIGHT);
ChooseOption
end;

punkd

2012-05-12 23:55:59

Well, The most obvious solution of them alll =P Your dtm is invalid. you most likley didnt copy the full dtm. Otherwise it should work

DeiJaiVui

2012-05-12 23:58:42


punkd

2012-05-13 00:26:26

Dnt be a Moron dejavu

Enox

2012-05-13 00:30:27

Mmm, okay. Thanks all. :P

Also, I like that better too Brandon. Changed, but it's still not writing my line out in the debug area. Why not?

EDIT: No, my DTM still printed the same. What do?

Valithor

2012-05-13 00:32:55

From: punkd
Well, The most obvious solution of them alll =P Your dtm is invalid. you most likley didnt copy the full dtm. Otherwise it should work


It would have to be this, because if your DTM was valid then FindDTM(); would return true and then it would writeln();
Right? :insecurity:

But to help clarify your confusion between MMouse and Mouse…
MMouse will ONLY move the mouse to the specified spot, while Mouse will move AND click. Write "mouse_right" to Right-Click, and "mouse_left" to Left-Click. It's just that easy.

Otherwise, I would do what Brandon suggested.

Also, look over some of YoHoJo's other video tutorials. They were a great help to me when I was first learning to script. Hope that helps. :)

punkd

2012-05-13 00:42:30

Enox, your doin something wrong with the dtm. Add my skype yeshayem2 I'll give u some help

Enox

2012-05-13 00:49:28



Theres DTM found and what it prints.

CephaXz

2012-05-13 01:01:50


program SumBat;


{$i srl/srl.simba}

var
BatPouch, X, Y: Integer;


begin
SetupSRL;

BatPouch := DTMFromString('mrAAAAHic42BgYOAHYmYGCOAEYnEglgFiaS DmA2JBIJYEYh6oGkaouBQQywLxlNP2QJIJJ5ZkwA8YCWAYAAA5 1gLJ');
writeln('Start finding DTM');

if FindDTM(BatPouch, X, Y, MIX1, MIY1, MIX2, MIY1) Then
Begin
WriteLn('Found DTM');
MMouse(X, Y, 7, 7);
If IsUpText('ruit') Then
begin
writeln('Found pouch');
Mouse(X, Y , 0, 0, False);
ChooseOption('ummon');
end else
begin
writeln('Cant find pouch');
terminatescript;
end;
end else
begin
writeln('Cant find DTM');
TerminateScript;
end;

FreeDTM(BatPouch);
end.


or use this procedure

Procedure Checking;
var
x, y, BatPouch: Integer;

begin
BatPouch := DTMFromString('mrAAAAHic42BgYOAHYmYGCOAEYnEglgFiaS DmA2JBIJYEYh6oGkaouBQQywLxlNP2QJIJJ5ZkwA8YCWAYAAA5 1gLJ');

if FindDTM(BatPouch, x, y MIX1, MIY1, MIX2, MIY2) then
writeln('Found DTM')
else
writeln('Not Found');

FreeDTM(BatPouch);
end;

Enox

2012-05-13 01:41:15

CephaXz,

I changed it and added the else. It appears that it cannot find the pouch. Punkd thinks it may be the client since its outside of Simba.

punkd

2012-05-13 01:55:56

mistake was invalid dtm and

if FindDTM(BatPouch, X, Y, MIX1, MIY1, MIX2, MIY1) Then


simple change

CephaXz

2012-05-13 01:57:31

From: punkd
mistake was invalid dtm and

if FindDTM(BatPouch, X, Y, MIX1, MIY1, MIX2, MIY1) Then


simple change


Whops. Stupid mistake there. Sorry, I wrote this without checking inside the message box.


From: Enox
CephaXz,

I changed it and added the else. It appears that it cannot find the pouch. Punkd thinks it may be the client since its outside of Simba.


So did you find it yet after changing the mistake I done?

Enox

2012-05-13 01:57:57

Thanks punkd. Spent a lot of time to help me.

Really appreciated.


Resolved.

Brandon

2012-05-13 01:59:54

I see Punk'd solved it but Try using some waits in there..

{$I SRL/SRL.Simba}

Function UseFruitBat: Boolean;
var
BatPouch, X, Y, Tries: Integer;
begin
BatPouch := DTMFromString('mrAAAAHic42BgYOAHYmYGCOAEYnEglgFiaSDmA2JBIJYEYh6oGkaouBQQywLxlNP2QJIJJ5ZkwA8YCWAYAAA51gLJ');

Tries:= 0;
while (Tries < 3) do
begin
if (WaitFindDTM(X, Y, BatPouch, 600)) then
begin
MMouse(X, Y, 0, 0);
if (WaitUptextMulti(['at', 'ouch', 'pouch', 'uch'], 600)) then
begin
ClickMouse2(MOUSE_RIGHT);
Result:= WaitOptionMulti(['ummon', 'mmon', 'Summon'], 600);
if Result then break;
end;
end;
Inc(Tries);
end;
FreeDTM(BatPouch);
end;

Function ShutdownFruitBat(Reason: String): Boolean;
begin
if (Not UseFruitBat) then
begin
if (BankScreen) then
CloseBank;
CloseWindow;

Result:= LogOut;
WriteLn(Reason);
TerminateScript;
end;
end;

begin
SetupSRL;
ShutdownFruitBat('~UseFruitBat~ Failed At Line: 29');
end.

CephaXz

2012-05-13 02:02:14

Since this is solved, you guys can go to my thread and help me now lol.

Moron

2012-05-13 07:48:37

From: punkd
Dnt be a Moron dejavu


:garfield: