solemn wishes
2007-08-22 11:31:21
hi guys,
Well i've been writing a new script for the last few days and its become apparent that the ChooseOption; Function is too random at the moment. It misclicks 6/10 times for me which i had trouble codeing with.
Ive put together this very simple peice of code for you guys to test, please run it like 10 times and tell me how many times it misclicks for you. Maybe its my pc? maybe my wireless im not sure.
If it is the case that it is too random and not my PC ive found a veyr simple fix, but i dont wna go changing things without discussing them first.
For those of you who have the same problem as me in your scripts i simply changed the mouse function and it works flawless (every time).
Sorry this is a lil bit of a noob post.
Well i've been writing a new script for the last few days and its become apparent that the ChooseOption; Function is too random at the moment. It misclicks 6/10 times for me which i had trouble codeing with.
Ive put together this very simple peice of code for you guys to test, please run it like 10 times and tell me how many times it misclicks for you. Maybe its my pc? maybe my wireless im not sure.
program ChooseOptionTest;
{.include SRL\SRL.scar}
const
ObjectName = 'Banker'; //Target name text
Option2click = 'Bank'; //Option you want to click
color1 = 7763582; //object colors (array used)
color2 = 611167;
color3 = 1695199;
color4 = 5769305;
var
x, y: integer;
function OptionTester(Name, OptionTc: string): boolean;
var
ColorT: array[1..4] of Integer;
tol, i: integer;
begin
ColorT[1] := color1
ColorT[2] := color2
ColorT[3] := color3
ColorT[4] := color4
I := random(4) + 1;
Repeat
If FindObj(x, y, name, ColorT[i], tol) then
Begin
mouse(x, y, 5, 5, false)
wait(250 + random(100 + random(100)))
result := true;
End;
If Not Result Then
tol := tol + 1;
If (tol > 50) then tol := 0; if (tol = 0) then i := random(4) + 1;
Until Result;
ChooseOption(OptionTc);
End;
begin
SetupSrl;
OptionTester(ObjectName, Option2click);
end.If it is the case that it is too random and not my PC ive found a veyr simple fix, but i dont wna go changing things without discussing them first.
For those of you who have the same problem as me in your scripts i simply changed the mouse function and it works flawless (every time).
Sorry this is a lil bit of a noob post.
Function ChooseOption2(txt : string): Boolean; //By Stupid3ooo, modded by Sumilion, small mod by me
Var
x1, y1, x2, y2, LeftCorner, RightCorner, x, y: Integer;
Begin
LeftCorner := BitmapFromString(4, 4, 'z78DA33753135313137C5' +
'411A600064715CEA914500CACE13F0');
RightCorner := BitmapFromString(4, 4, 'z78DA33753135313137' +
'C5200D30002E35F8C501C9C013F0');
If (FindBitmap(LeftCorner, x1, y1)) And (FindBitmap(RightCorner, x2, y2)) Then
Begin
If (FindText(x, y, txt, upchars, x1, y1, x2, 502)) Then
Begin
Result := True;
Mouse(x1 + 5, y + 4, 0, 0, True);
End
Else If(FindText(x, y, 'Cancel', upchars, x1, y1, x2, 502)) Then
MouseBox(x1 + 5, y + 4, x2, y + 10, True);
End;
FreeBitmap(LeftCorner);
FreeBitmap(RightCorner);
End;