SRL Archive - Help and Support

Why won't this work?


Boreas

2006-12-08 15:03:42

Here's what I'm trying to do:
(manually) Login to RS, open up a bank, open a scar, drag crosshairs to rs, and open dtm editor (rs can now timeout, its not needed)
Then open another scar with the following script and drag crosshairs to picture in dtm editor of first scar. Then run the script.
The script should then (as it is configured now):
STEP 1: Look at the second bank slot, reading the pixels left to right and top to bottom like a book (besides where the numbers are), and when the color is 65536, it clicks that pixel.
STEP 2: Then save the dtm as b4iron4, and do dtmtotext and new.
Then repeat these steps for b4coal in the first bankslot.

Step 2 is fine, but in step 1 its clicking colors besides 65536. I added a wait an it got a little better, but it has to be only 65536. This is what I am having trouble with. The only thing I can think of is that color gets distorted from one scar to the next, I am hoping this is not the case because there's nothing I can do about it. Any ideas?

(If you look at the script and see clickmouse and no srl and no randomness and post about it, you are an idiot for not reading the post to see that it isn't needed.)




program B4DTMMaker;
const howmanyitem=2; // how many items
var
ItemName:array [0..(howmanyitem-1)]of string;
ItemPos:array [0..(howmanyitem-1)]of integer;

procedure DeclareItems;
begin

ItemName[0]:='iron4';
ItemPos[0]:=2;

ItemName[1]:='coal4';
ItemPos[1]:=1;

end;
type
BSlot = record
row,column,
x1,x2,y1,y2,
ItemNumber,ItemAmount:integer;
ItemName:string;
end;

var
BankSlot: array [1..48] of BSlot;
procedure LoadBankSlotArray;
var i:integer;
begin
for i:= 1 to 48 do
begin
BankSlot[i].row:=((i-1)/8)+1;
BankSlot[i].column:=((i+7)mod 8)+1;
BankSlot[i].x1:=79+((Bankslot[i].column-1)*47);
Bankslot[i].y1:=62+((Bankslot[i].row-1)*38);
BankSlot[i].x2:=Bankslot[i].x1+31;
BankSlot[i].y2:=Bankslot[i].y1+31;
Bankslot[i].y1:= Bankslot[i].y1+10;
end;
end;
procedure makedtm(pos:integer);
var x,y:integer;
begin
y:= BankSlot[pos].y1;
repeat

x:= BankSlot[pos].x1;
repeat

if (getcolor(x,y)=65536) then
begin
movemouse(x,y);
wait(200);
//if (getcolor(21,-42)=65536) then
if (getcolor(x,y)=65536) then
clickmouse(x,y,true);

end;
x:=x+1;
until (x=(BankSlot[pos].x2+1));
y:=y+1;
until (y=(BankSlot[pos].y2+1));


end;


procedure savedtm(name:string);
begin
clickmouse(7,-85,true); //file
wait(500);
clickmouse(23,-31 ,true);//save
wait(500);
Sendkeys('b4'+name+ chr(13));//filename
wait(500);
clickmouse(7,-85,true);//file
wait(500);
clickmouse(34, -12,true);//dtmtotext
wait(500);
clickmouse(7,-85,true);//file
wait(500);
clickmouse(12, -63,true);//new
wait(500);
end;

var i:integer;
begin
declareitems;
LoadBankSlotArray;
repeat
makedtm(itempos[i]);
savedtm(ItemName[i]);
i:=i+1;
until (i=(howmanyitem));
end.

How can I make it only click 65536?

EDIT: I guess I could make it look at the scroll thing on the right and check the text and delete, but that would probably cause even more problems, so I just want it to click only 65536 the first time.

TOB

2006-12-08 16:12:34

Why not have the script draw the client to a debug window and search on there?

Boreas

2006-12-08 17:21:40

But it still needs to actually click the dtm editor in those points to make the dtm.

Boreas

2006-12-10 14:14:03

Sorry for double posting but I really need help with this. Can anyone figure out why it's clicking colors besides 65536?

IronTeapot

2006-12-10 15:24:56

wow, I have no clue. and logically, if (getcolor(21,-42)=65536 should work no problem :S

Boreas

2006-12-10 15:36:25

Yea that's why this is driving me nuts.

IronTeapot

2006-12-10 16:00:52

maybe it cant read outside of the focused window ( like #,-#) is there a way to have focus to the whole window, not just the dtm window part? if you can maybe try that.

Boreas

2006-12-10 16:10:51

I could but I would have to mess around with more stuff to get the bank position coords relative.
But even when I do the get color on the actual pixel instead of the 3x3 magnified bit it doesn't work. And I have no idea why. 65536 is 65536.

c0de

2006-12-11 09:13:35

Try using SRL's Mouse(x,y,0,0,true);

;-)

[PHP]
program New;
{.include SRL/SRL.scar}
var
x, y : integer;
begin
SetupSRL;

if FindColor(x, y, 65536, 0,0,1024,768) then
begin
Mouse(x,y,0,0,True);
Writeln('('+inttostr(x)+', '+inttostr(y)+') = '+inttostr(getcolor(x,y)));
end;

end.
[/php]

Boreas

2006-12-11 11:28:55

Mouse function shouldn't matter but it's worth a shot. I'll stick with getcolor though because i need to find every occurrence not just the first it finds.

IronTeapot

2006-12-11 11:31:25

From: Boreas
I'll stick with getcolor though because i need to find every occurrence not just the first it finds.

Why not just have the color finding in a loop till it cannot find that color any longer?

Boreas

2006-12-11 11:35:31

Yea I guess I could. I'll try mouse/getcolor, clickmouse/findcolor, mouse/findcolor.