FindObjOnScreen
What this allows you to do?
Have one function with the availability of to use it for many many many many many many many many many things!
This is my first TUT So dont hate!
Things Needed:
ACA/Auto Color Aid found Here
Simba
First step:
The function itself!
Simba Code:
Function FindObjOnScreen(Up:Array of String;Color,Tolerance:Integer;MC2:Variant;Hmod,Smod:Extended): Boolean;
var
X,Y:Integer;
CTS,I,T: Integer;
TPA: TPointArray;
begin
repeat
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hmod,Smod);//These are the modifiers you got from the ACA
FindColorsSpiralTolerance(MSCX, MSCY, TPA,(Color), MSX1, MSY1, MSX2, MSY2, Tolerance);//This finds the actual item on screen calls the color and the tolerance when finding the o0bject.
ColorToleranceSpeed(CTS);
if (Length(TPA) < 1) then
Exit;
MMouse(TPA[0].X, TPA[0].Y, 5, 5);
if WaitUpTextMulti(Up, 400) then//This is the uptext that it waits to see.
begin
GetMousePos(X, Y);//this goes to the declared position from FindColorsSpiralTolerance
ClickMouse2(MC2);//This is the Is the type of mouse Click that you want it to do.
ChooseOptionMulti(Options);//If the MC2 Was false then you use this to choose the options!
Result := True;
Exit;
end;
Until(Result = True);
end;
Now that is the function that does all the work!
2nd Step:
Calling that function into use!
This is part from my ghouler. As you can see i called it here, you can use it whereever you want as long as its below the actual function that we declared ^^^^^ there
Simba Code:
begin
Startup;
SetupChar;
LoadBMP;
LoadVars;
repeat
ToGhouls;
repeat
DoThePainting;
KillGhouls;
MarkTime(P);
Repeat
PickupCharms;
Until (TimeFromMark(P) > 500);
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);//Here is the function.
until (hppercent<50);
ToBank;
Proggy;
OpenBankNPC;
if BankScreen then
begin
DoThePainting;
DepositAll;
wait(50 + Random(250));
DoThePainting;
Withdraw(0, 0, 28);
wait(50 + Random(250));
DoThePainting;
Deposit(1,1,false);
wait(50 + Random(250));
DoThePainting;
CloseBank;
end;
FindNormalRandoms;
until not LoggedIn
writeln('stopping script');
Proggy;
TerminateScript;
end.
Now what each one of those things are!
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);
..........................................^^^ Is the up text it looks for!
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);
.................................................. ..............^^^^^ The color you found with ACA
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);
.................................................. .......................^^The 1 is the color tolerance that ACA showed you.
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);
.................................................. ..............................^^^True is for it to left Click false is for it to right click!
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);
.................................................. .....................................^^1.73 is the Hue Mod
FindObjOnScreen(['ake', 'Take', 'ke', 'ak'],8290940,1,False,1.73,0.01);
.................................................. ...........................................^^^ is the Saturation modifier!
Earlier in the Tut i had the function posted and in the function i had put The Mutliple Option choice, now for step 3 which shows you how this works!
Step 3:
Multiple uptext!
In the running of your script usually located at the bottom and has a
begin
end.
with the period you need to put this
What that does is make sure that the variable load into the script, the ones that we will declare like this!
Simba Code:
procedure LoadVars;
begin
Options:=['old charm','ffigy', 'rimson charm', 'reen charm', 'lue charm']
end;
This is an array of uptexts that we use, you put the text you want inbeetween 2 'like this' and seperate those by commas 'o','k','a','y','','e','t','c','.',
Drops:=['old charm','ffigy', 'rimson charm', 'reen charm', 'lue charm']
You can call it whatever you want, in my scripts i mainly use this for many different drops, or many different objects, ex rocks water table then furnace and so on!
Now for you not to get compile errors of not finding that variable you need to go to the top of your script.
the top should be something like this
Simba Code:
program WoodCutter;
{$DEFINE SMART}
{$i SRL/srl.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.simba}
//put
Var
Options: Array of String;//or whatever you want to call it instead of Options! :)
//Unless you already have your Variables declared up here! :)
procedure DeclarePlayers;
and so on! :)
And thats the end of the TuT, this is good to have a cleaner script that is more accurate!
I got the base of this function from Flight!
This is my first TuT so please dont hate.
I take no credit for ACA, the creators of that are in freaking sanely smart!