SRL Archive - Discussions and Debates

ChooseOption; too 'random'?


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.

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;

Wanted

2007-08-22 13:36:32

I don't think I've ever had any problems with choose option, maybe it's because I didn't use the whole word so it finds closer to the center.

Edit: Actually, you're right, now that I think of it, I have had problems with choose option missing the text -.- ; I'll try your fix.

Sumilion

2007-08-22 14:29:56

What kind of problems? A minor miss-click ? (adjustable) Or really a big fat miss ?

Wanted

2007-08-22 14:50:15

From: Sumilion
What kind of problems? A minor miss-click ? (adjustable) Or really a big fat miss ?


No, not a big fat miss, maybe like maybe about 5 pixels off so that it misses the text and what ever operation you just tried failed unless you have clever loops like repeating until a bankscreen ect.. It's pretty annoying.

solemn wishes

2007-08-22 14:58:20

From: Sumilion
What kind of problems? A minor miss-click ? (adjustable) Or really a big fat miss ?


its only a minor misclick mate, and my post makes it seems like a horible problem im sorry. Just think we should fix this because a very large ammount of SRL scripts do not have the failsafes needed to prevent there scripts from screwing over,

WT-Fakawi

2007-08-22 15:00:54

I have been Thieving the MasterFarmer for over three days now using nothing but ChooseOption 1000* of times ….. Never failed me. I like the way it randomly clicks on the menutext. sum :)


Odd how SRL suits some PC's more then others :confused:

Wanted

2007-08-22 15:03:01

For some options it never fails, but for others it some times misses because the random range is too high; that's all…

Sumilion

2007-08-22 15:19:52

From: WT-Fakawi
I have been Thieving the MasterFarmer for over three days now using nothing but ChooseOption 1000* of times ….. Never failed me. I like the way it randomly clicks on the menutext. sum :)


Odd how SRL suits some PC's more then others :confused:


Haha, good, no problem.

From: Icefire908
For some options it never fails, but for others it some times misses because the random range is too high; that's all…


Whats the option and what is the text your looking for where it messes up ?

Santa_Clause

2007-08-22 17:45:42

Perhaps you could just use ClickOption?

Bobarkinator

2007-08-22 19:54:01

I've never had this problem but it's good to orient SRL to as many PC's as possible so I believe it should be changed.

R0b0t1

2007-08-23 18:20:20

And here comes bob out of no where.


What's the difference between ChooseOption and ClickOption? You're mojo levels?

The Claw

2007-08-23 21:19:07

its never messed up for me, its a lot faster for me than what it use to be actually, the old one lagged me a bit.

Sumilion

2007-08-24 04:00:06

The only way its changed is how it clicks ^^

The Claw

2007-08-24 04:24:11

maybe it was clickoption that lags me idk lol. all i know is that when i started using chooseoption since srl 4 came out, the slight lag was gone :p

n3ss3s

2007-08-24 09:11:36

Choose option works great for me?

Actually it has never misclicked for me in my whole life?

Kik

2007-08-24 14:22:26

It works great for me, as long as I don't include the end letters ('uickl' instead of 'quickly').

Wanted

2007-08-24 15:34:45

In SRL Beta 4 it's working fine, I guess it was the mouse or something…