SRL Archive - Help and Support

String Problem


maxzzz

2006-03-17 13:26:28

The problem is that I made a script for stringing, but I got a problem at the stringing itself. It drags the string to the right place but then it starts moving very crazy in right bottom corner or doesn't move.

This is the script:


procedure DragBs;
begin
MMouse(626, 336, 4, 4);
GetMousePos(x, y);
HoldMouse(x, y, true);
Wait(20+random(10));
MMouse(670, 436, 4, 4);
Wait(20+random(10));
GetMousePos(x, y);
ReleaseMouse(x, y, true);
end;

procedure StringsInBows;
var X, Y : Integer;
begin
DragBs;
if(InvFull)then
begin
repeat
ItemCoords(23); // returns coords of bow
CMouse(x, y, 5, 5, true); // Moves mouse to string and clicks left
wait(50+random(50)); // wait 50-100 ms
ItemCoords(24); // returns coords of string
CMouse(x, y, 5, 5, true); // Moves mouse to pos and clicks left
wait(50+random(50)); // wait 50-100 ms
Stringed:=Stringed+1; // obvious
until(Stringed=14+random(1));
end;
end;

inferno

2006-03-17 13:47:23

With the ItemCoords command you need to use it like this:

SomeVar := ItemCoords(23);
The SomeVar will need to be defined as a TPoint variable
Var
SomeVar : Tpoint;
and to use the co-ordinates you use this:
MoveMouse(SomeVar.X, SomeVar.Y);

maxzzz

2006-03-17 13:52:07

Can I use something like this:

var
InvString : Tpoint;

InvString := ItemCoords(23);

CMouse(InvString.X, InvString.Y, 5, 5, true);

The script would look like this:

program String;
{.include SRL/SRL.scar}

var
Stringed : Integer;
InvString, InvBow : Tpoint;

procedure DragBs;
begin
MMouse(626, 336, 4, 4);
GetMousePos(x, y);
HoldMouse(x, y, true);
Wait(20+random(10));
MMouse(670, 436, 4, 4);
Wait(20+random(10));
GetMousePos(x, y);
ReleaseMouse(x, y, true);
end;

procedure StringsInBows;
begin
DragBs;
if(InvFull)then
begin
repeat
InvString := ItemCoords(23); // returns coords of bow
CMouse(InvString.X, InvString.Y, 5, 5, true); // Moves mouse to string and clicks left
wait(50+random(50)); // wait 50-100 ms
InvBows := ItemCoords(24); // returns coords of string
CMouse(InvBow.X, InvBow.Y, 5, 5, true); // Moves mouse to pos and clicks left
wait(50+random(50)); // wait 50-100 ms
Stringed:=Stringed+1; // obvious
until(Stringed=14+random(1));
end;
end;

begin
SetupSRL;
StringsInBows
end.

inferno

2006-03-17 13:54:18

Yes, that would work fine I think.

Don't forget to define InvBows as a TPoint varaible as well ;)

maxzzz

2006-03-17 13:58:22

Thnx, I'll try that now :p , I already edited the InvBow : Tpoint; :p
Oops, and offcourse I need to use ItemCoords(27) and (28) :p

EDIT:* Thnx, it works now. Now I need to test my bankprocedure :p
EDIT2:* Well my scripts works =)