Sir R. M8gic1an
2011-01-27 07:01:55
I think that functions that mix two things should have a place in SRL.
eg, not 1 thing, not 10 things, 2 things.
MouseUpText
MouseColorTol
MouseDoubleClick
why? because we repeat these things all the time
//SRLSettings.Simba
const
rX = 5;
rY = 5;
WAIT_UPTEXT = 200;
//SetupSRL
var
RP: TPoint;
sUTW: integer;
procedure SetupSRL;
begin
RP := Point(Max(rX, sX), Max(rY, sY));
sUTW := sUTW := Max(WAIT_UPTEXT, UT_Wait); //sUTW = SRL UpTextWait
end;
//Script.Simba
program AScript;
var
sX, sY, UT_Wait: integer;
procedure SetupScript;
begin
sX := 3;
sY := 3;
UT_Wait = 150;
end;
{ Replaces
MMouse(x, y, RP.X, RP.Y);
QuickMouse(TP, RP, LeftClick, 'uard'); //guard
}
//Contributors: Nielsie95, Sir R. Magician, Sex, Rich, Zyt3x
{ function: QuickMouse;
QuickMouse is a function that relies on preset values to allow maximum scripting efficiency.
These values can be changed in Settings.Simba, or on your own Script.
QuickMouse uses the variables set in SetupSRL.
}
function QuickMouse(TP, RP: TPoint; Action: (Move, LeftClick, RightClick); UpText: string): boolean;
var
MPos : TPoint;
begin
MMouse(TP.x, TP.y, RP.x, RP.y);
Result := WaitUpText(sUTW);
if (Action = Move) or ((not Result) xor (Action = Move)) then exit;
// by Rich
GetMousePos(MPos.x, MPos.y);
if Action = LeftClick then
Mouse(MPos.x, MPos.y, 0, 0, True)
else
Mouse(MPos.x, MPos.y, 0, 0, False)
Result := pos(UpText, GetUpText) > 0; // RM & Zyt3x fix
end;
and even more… you can have constants for your x and y randomness which you can then store into a TPoint which you pass on to the function.
~RM
