SRL Archive - OSR Help

DTM failed


Main

2009-09-04 04:04:16


program DTMw;
{.include SRL\SRL.scar}

Function Dced: Boolean;
var Dc, Dcx, Dcy:Integer;
Begin
Dc := DTMFromString('78DA638C626060D0644001C9060C0CFF81342' +
'394CFB8054818A0A909B584C8C1D43001096354355181686AD881' +
'841C01355B08AB01000D3207CD');

Result:= (FindDTM(Dc, Dcx, Dcy, 280, 170, 470, 200));
FreeBitmap(Dc);
End;

Procedure CDTM;
begin
if (Dced) then writeln('found dtm') else
begin
writeln('not found dtm');
exit;
end;
end;

begin
setupsrl;
CDTM
end.

that dtm is a dtm of the login character on the main screen. the "test" option finds it, but the script doesn't.

Smarter Child

2009-09-04 04:32:02

By the way, your using FreeBitmap to free a DTM :p

As for the dtm, maybe try doing it again? And, loginplayer; is fixed in latest dev svn.

Main

2009-09-04 04:42:16

Ok ty.

An other question, how do I make my script keep on looking for a color/bitmap until "Isuptext=xx"?


procedure lookforcolor;
var x, y, color:integer;
Begin
Color:=Bitmapfromstring('1337');
repeat //?
Findbitmap(color, x, y)
until ?

kyleisntwild

2009-09-04 04:46:36

Bet you need more tolerance.

Mr. Doctor

2009-09-04 04:50:27

From: Main_Ftw
Ok ty.

An other question, how do I make my script keep on looking for a color/bitmap until "Isuptext=xx"?




procedure lookforcolor;
var x, y, color:integer;
Begin
Color:=Bitmapfromstring('1337');
repeat
Findbitmap(color, x, y)
until(findbitmap(color,x,y)
writeln('found') //or status
terminatescript;

Pretty sure it is. Add a
writeln('')
And a terminatescript; so it stops when its found, knowing it works. or use status('').

Smarter Child

2009-09-04 04:53:04

From: Junkj
Pretty sure it is. Add a
writeln('')
After the until so you know it works.


Not at all, do:


repeat
if findbitmap(BLAH)then
mmouse(x, y, 2, 2);
until(IsUpText('WTF'));//Child's play lol
if IsupText('WTF')then
begin
writeln('yay it worked');
result := true;
end;

Something like that, sorry for standards wrote in comment box :p

Main

2009-09-04 04:53:49

That wasn't what I meant (because that isn't really a script).
I want to ask, How do you make the script KEEP ON LOOKING for the color? cause if I just do



If (Findbitmaptolerance(somebitmap, somex, somey, sometolerance)) then
Writeln('found')
else writeln('not found');
Does it look for the color/bitmap only once? (Because thats what I think it does.), if it DOES, how do I make it keep on looking until (lets say

until (Isuptext('some text')
)?

Smarter Child

2009-09-04 04:54:38

Main_FTW: I just posted, and good luck with your script :)

Edit: Yah, read my example, ignore standards pl0x :p

It will repeat finding the bitmap until the uptext is 'WTF' of course that is an example. then if the uptext is it will write in yay and result true, make sure you free bitmap! :D

Edit: You might wanna do a time marker as a failsafe just in case it doesn't find the bitmap.

Main

2009-09-04 04:59:31

Dumb me, ty.

Smarter Child

2009-09-04 05:00:41

No problem, I live to help :) Also Rep+ me if you want….

Mr. Doctor

2009-09-04 05:01:14

From: Main_Ftw
That wasn't what I meant (because that isn't really a script).
I want to ask, How do you make the script KEEP ON LOOKING for the color? cause if I just do



If (Findbitmaptolerance(somebitmap, somex, somey, sometolerance)) then
Writeln('found')
else writeln('not found');
Does it look for the color/bitmap only once? (Because thats what I think it does.), if it DOES, how do I make it keep on looking until (lets say

until (Isuptext('some text')
)?


Using some vars…

Procedure lookforbitmap;
var found :integer;
begin
repeat
If (Findbitmaptolerance(somebitmap, somex, somey, sometolerance)) then
found:=found+1
until(false)
end;
And smarter btw you dont need
until(poop)
if(poop)//this
As until already will find it.

Smarter Child

2009-09-04 05:03:02

From: Junkj
Using some vars…

Procedure lookforbitmap;
var found :integer;
begin
repeat
If (Findbitmaptolerance(somebitmap, somex, somey, sometolerance)) then
found:=found+1
until(false)
end;
And smarter btw you dont need
until(poop)
if(poop)//this
As until already will find it.


WTF, that will just keep repeating the bitmap search and increasing 1 until it becomes FALSE!!!

And you do need the if/then statement after if you want it to debug and result. :duh:

Main_FTW: Trust me, I know what I am doing, I have done something similar to this before. ;)

Edit: @ junkj - found := found +1; is slower than Inc(Found), and that could be an extra failsafe, but time markers are just as easy to work with.

Mr. Doctor

2009-09-04 05:06:02

No it wouldn't, if it finds the bitmap, then it will increase by 1 and keep repeating to find the bitmap, and if it finds it again it increase the var by 1.

Smarter Child

2009-09-04 05:11:41

From: Junkj
No it wouldn't, if it finds the bitmap, then it will increase by 1 and keep repeating to find the bitmap, and if it finds it again it increase the var by 1.


…..lol, are you dumb or something? I just explained why that wouldn't work……try opening scar and running this:
program New;
var
tries: integer;
begin
repeat
Writeln('OMG');
Tries := Tries + 1;
until(false);
end.

It will just debug omg endlessly…false is when it results false, that is an endless loop.

i am
THE Smarter Child :p, lol. Main_FTW : good luck~!:)

Mr. Doctor

2009-09-04 05:16:03

Writeln('') is not the same as If(123)then. I wouldn't be the one calling other people dumb.

Smarter Child

2009-09-04 05:18:02

Lol?? try it with an if and then statement, similar results will occur ;). By the way, it doesn't look like your that smart either..Anyways, i am not going to continue arguing with you.

hmm, well try something like this, drag cross hairs over the play button bar.
program New;
var
tries: integer;
x, y: integer;
begin
repeat
if FindColor(x, y, 6126318, 54, 4, 73, 20)then
Tries := Tries + 1;
Writeln(IntToStr(Tries));
until(false);
end.

See it debug the tries forever..

Edit: 5 people viewing the thread, wow lol.

Mr. Doctor

2009-09-04 05:26:07

Well, if you want this to end please try and refrain to call other people dumb and wtf. You aren't gonna get any far with that.

Smarter Child

2009-09-04 05:27:15

From: Junkj
Well, if you want this to end please try and refrain to call other people dumb and wtf. You aren't gonna get any far with that.


:confused: Get any far with what, I was right and you were wrong :duh:

Main

2009-09-04 05:30:38

So if I wanna (lets see.. find a bank!)
IGNORE STANDARDS AND CRAP

Procedure findbank;
var bankcol, x, y:integer;
begin
x:=mscx;
y:=mscy;
bankcol:=1337;
repeat
if FindColorSpiralTolerance(x, y, bankcol, msx1, msy1, msx2, msy2, 255) then
MMouse(x,y,0,0)
until (Isuptextmulticustom('bank'))
mouse(x,y,0,0,true);
end;
?

Smarter Child

2009-09-04 05:31:57

Do: if Isuptextmulticustom('bank') after the until. yes that seems about right.:)

Edit: but i don't see why you need to repeat it, findcolorsspiraltolerance should find it in one shot. and lower the tol, lol, unless its only gonna be in example ;)

Mr. Doctor

2009-09-04 05:32:52

Rule #3 - Don't get yourself into flame wars

Flaming is heavily insulting or fighting with another member of the forums. It really is just a waste of space and causes two (or more) people to hate each other. If you get in a big flame war, you're scarred for life in the eyes of anyone who sees it, thinking you have a short temper. Even so, it's always nice if you make up in the end . If you REALLY have to do it, then take it to the BBQ Pit section of the forums, or on IM.

Rule #5 - Get at least some SRL/Scar knowledge

As you use scripts, look through the script and think, "What does this procedure do?". Try to answer your own question. If you really can't do it, look at some basic tuts in the Tutorial Island section under Beginner Tutorials. This way, you'll be able to fix simple errors without bugging other people. Don't forget to learn to make your own scripts eventually though (I'll explain why in a bit).

Btw main, Smarter Child can answer this one.


i am
THE Smarter Child

Smarter Child

2009-09-04 05:35:00

Okay lol, I am not really trying to flame you, but, i do have SRL\Scar knowledge, I am an SRL member for crying out loud, that rule is meant for you, don't confuse people . And the THE Smarter child is a joke. Don't take things way too seriously, can't you take a joke.

Edit: 5 members, 1 guest viewing thread, lol, didn't know this would get views :p

Mr. Doctor

2009-09-04 05:37:04


Lol??



Lol??


Get any far with what, I was right and you were wrong


lol, are you dumb or something


Can i still take a joke??

Main

2009-09-04 05:38:47

@smart
Can you remake that example procedure?

Smarter Child

2009-09-04 05:39:35

From: Junkj
Can i still take a joke??


Why the hell are you taking this so far? What is done is done, stop leading this thread off topic. For our selfish reasons, we're messing this thread with comments relating nothing to Main_FTW's problem.

@ Main_FTW: Pm me and i give you my msn, then i can help you anytime you need.

Main

2009-09-04 05:52:19

Sorry that I got both of you into this fight(:

I will now end this thread with one more question:
Is this how I can typesend a range of numbers?


Procedure typecrap;
var
numbai:integer;
numbas:string;
begin
numbai:=27+random(300000);
numbas:=numbai;
typesend(numbas);
end;

Smarter Child

2009-09-04 05:57:00

Not exactly, do:


Procedure typecrap;
begin
TypeSend(IntToStr(RandomRange(27, 4000)));
end;

or not sure if that really wroks

procedure typecrap;
var
rnum: integer;
begin
rnum := RandomRange(27, 8000);
TypSend(IntToStr(Rnum));
end;

Basically, your taking a randomrange of integers then converting it to a string so TypeSend can type it. IDK if first one works or compiles, lol, but the second one should work.

Main

2009-09-04 06:07:53

Kk, Just finished installing msn, adding you now.

Daniel

2009-09-04 13:40:02

From: Junkj

procedure lookforcolor;
var x, y, color:integer;
Begin
Color:=Bitmapfromstring('1337');
repeat
Findbitmap(color, x, y)
until(findbitmap(color,x,y)
writeln('found') //or status
terminatescript;

Pretty sure it is. Add a
writeln('')
And a terminatescript; so it stops when its found, knowing it works. or use status('').

That wouldn't be the smartest way to do it, as you're searching for the bitmap twice, which in turn will be slower. Try:

while(not(FindBitmap(color, x, y))) do
Null;
From: Smarter Child
Not at all, do:


repeat
if findbitmap(BLAH)then
mmouse(x, y, 2, 2);
until(IsUpText('WTF'));//Child's play lol
if IsupText('WTF')then
begin
writeln('yay it worked');
result := true;
end;

Something like that, sorry for standards wrote in comment box :p

That is correct in what Main_FTW wants…
From: Junkj
Using some vars…

Procedure lookforbitmap;
var found :integer;
begin
repeat
If (Findbitmaptolerance(somebitmap, somex, somey, sometolerance)) then
found:=found+1
until(false)
end;
And smarter btw you dont need
until(poop)
if(poop)//this
As until already will find it.

…except Junkj is correct. You will not need the if(poop) statement, since it'll break the loop once it is found.
From: Junkj
No it wouldn't, if it finds the bitmap, then it will increase by 1 and keep repeating to find the bitmap, and if it finds it again it increase the var by 1.

It'll keep increasing it to the maximum value it can go. After that, it'll just return 0 (a.k.a False) ;)

And guys, please, the arguing ends here.