XxKanexX
2006-04-12 11:33:19
——————————————————————————————-
GUESS WHAT! I found nearly everyone of my tutorials on Flaxpicker :). Since i posted them there a while ago. So now, I'll post the ones that might help. They are a little pathetic now since i wrote them when i was only just learning.. But, i hope others learn. :)
——————————————————————————————-
OK I Have written this Quick tutorial about Bitmaps And Colors. It shall give an understanding about what they do and what they are about.
Before Starting, Using "//" Or "{ + }" Or "(* + *)" In A Script Are All Comments, The Script You Have Written/Are Writing Will Not Go Through Them..
[Bitmaps:]
Bitmaps - Bitmaps are useful in scripts for if you dont want to use colors and other complicated whats so evers. To make a bitmaps you must go through these steps:
Take a screen shot of the bitmap you wish to make ("Print Screen" - NEXT TO F12).
Open Mspaint.exe Or Whatever Photo editor your computer has. Hold down Ctrl+V Or go to edit>Paste . Your bitmap (Screen shot) Should be there. Zoom in on your bitmap and cut around it, open a new file. Paste it, now make the attributes just around that picture/object and color the background black (Not the object, The background) So everything is black but the object. Now save it as 24 Bit (Bitmap). Go into scar, Script > Picture to string. Select your picture and click OK. now some coding shall be down the bottom. This is your bitmap. Declare the name of it up the top Like so:
OK, now that we have declared it we can add the file to the script :
OK, Now lets make scar move the mouse to it. We have to declare the X + Y Co-ords first. Add this to the top:
OK Now that they are declared we add the movemouse function :
This will move the mouse to the bitmap. As you know now the function to find a bitmap is "Findbitmap".. If you are aware about xs, ys, xe, ye/x1, y1, x2, y2 Then you can use then "Findbitmapin". It finds the bitmap in a box supplied by the xs, ys, xe, ye/x1, y1, x2, y2 , I have added xs, ys, xe, ye Help down the bottom in the colors section. Ty
Now lets make it click the bitmap!
There you have it! Will Click The bitmap supplied ! For more help on other bitmap commands go to Scar>Help>Help. Or press "F1" while in scar :D. Now Colors!
[Colors:]
Colors are extremely useful in scripts. They are used alot to find objects/pictures etc.
Lets start with a simple script to find black on your screen anywhere. Begin with Making color an integer
OK, Now we make the color integer do something :
Lets Declare The Width And Hight.
Now we add the command : Getclientdimensions
This will determine the Hight and width of the client Selected. OK Now we add the If(Findcolor) Function. This will find a color in the selected client. We will also add that if it finds the color black ( 0 ) then it says Yay If Not, Dam..
There you have it! You can also use getcolor which is faster than findcolor, findcolor will find a color in a box like findbitmapin (As written above in bitmaps). It will find a color in the xs, ys, xe, ye Box. I Will Describe This Now:
OK Heres our box. Now we will show the xs, ys Co ords (Which are normally 0,0 for the top left corner of the selected client. Else use the color picker and use the crosshair as a guide to the top left half of the box. :
Now XE And YE, again use the color picker and the crosshair as a guide to this bottom half.:
Theres the final verdict. Now it will try and find "Color" In The box. Heres an example of it being used, Lets just say XS And YS Are 0, 0 And XE + YE Are 20, 20:
For getcolor its just a simple:
Also you can make it say that color. We're back to this script again:
Just add : " Writeln('Found Color: '+Inttostr(color)) TO The End, As Shown:
This concludes My help. If you need anymore help please PM Me, Email me or post a question in this thread, Enjoy!
-Kane!
-:-CONTINUE FROM ABOVE-:-
[Else + Using Not's:]
Using else in a script like above can be used in two ways. If your only using one command after then like:
Now, see how after then theres 1 command then the next line is else?
This can only work if theres 1 command. If you want it to do more than one, lets say 3 at the moment then you'd do this:
Now to add else you would do this:
You can also make it do another 3 commands after it:
[Now for not's :]
If(Findcolor(~Bla Bla)) -
Instead of adding else you can add:
This can also be used with findbitmap:
If(findbitmap(Bitmap_Name, x, y)) -
This can be used in Untils Aswell, Untils Are used with repeat in a script: Example:
You can make it:
I felt like including this aswell to help other people:
And's And Or's:
Above In The Until's You Can Do This :
This will stop the script (Stop the repeat) If it didnt find the bitmap and color.
You can use it in other commands/functions. Like this:
Using or's is basically the same:
I Hope Any Of This Helped. Please Leave Comments+Suggestions :) Ty-
-Kane
Felt Like Throwing In Color Tolerance!
OK, I guess this concludes It! *Also On Kaitnieks.com*
No links are Guaranteed to work anymore since this is 5 months or so old..
GUESS WHAT! I found nearly everyone of my tutorials on Flaxpicker :). Since i posted them there a while ago. So now, I'll post the ones that might help. They are a little pathetic now since i wrote them when i was only just learning.. But, i hope others learn. :)
——————————————————————————————-
OK I Have written this Quick tutorial about Bitmaps And Colors. It shall give an understanding about what they do and what they are about.
Before Starting, Using "//" Or "{ + }" Or "(* + *)" In A Script Are All Comments, The Script You Have Written/Are Writing Will Not Go Through Them..
[Bitmaps:]
Bitmaps - Bitmaps are useful in scripts for if you dont want to use colors and other complicated whats so evers. To make a bitmaps you must go through these steps:
Take a screen shot of the bitmap you wish to make ("Print Screen" - NEXT TO F12).
Open Mspaint.exe Or Whatever Photo editor your computer has. Hold down Ctrl+V Or go to edit>Paste . Your bitmap (Screen shot) Should be there. Zoom in on your bitmap and cut around it, open a new file. Paste it, now make the attributes just around that picture/object and color the background black (Not the object, The background) So everything is black but the object. Now save it as 24 Bit (Bitmap). Go into scar, Script > Picture to string. Select your picture and click OK. now some coding shall be down the bottom. This is your bitmap. Declare the name of it up the top Like so:
Var
Bitmaps_Name : Integer;
OK, now that we have declared it we can add the file to the script :
Var
Bitmaps_Name : Integer ;
Begin
~Copy And Paste Here What Scar Created Down In The Debug Box From The Bitmap.
End.
OK, Now lets make scar move the mouse to it. We have to declare the X + Y Co-ords first. Add this to the top:
Var
Bitmaps_Name, x, y : Integer;
OK Now that they are declared we add the movemouse function :
Var
Bitmaps_Name, x, y : Integer;
Begin
~Copy And Paste Here What Scar Created Down In The Debug Box From The Bitmap.
If(Findbitmap(Bitmaps_Name, x, y))Then
Movemouse(x, y)
End.
This will move the mouse to the bitmap. As you know now the function to find a bitmap is "Findbitmap".. If you are aware about xs, ys, xe, ye/x1, y1, x2, y2 Then you can use then "Findbitmapin". It finds the bitmap in a box supplied by the xs, ys, xe, ye/x1, y1, x2, y2 , I have added xs, ys, xe, ye Help down the bottom in the colors section. Ty
Now lets make it click the bitmap!
Var
Bitmaps_Name, x, y : Integer;
Begin
~Copy And Paste Here What Scar Created Down In The Debug Box From The Bitmap.
If(Findbitmap(Bitmaps_Name, x, y))Then
Begin //Since there is more than 1 function going to be done we add begin.
Movemouse(x, y)
wait(200) //Enough Time For The Mouse To Get There
Clickmouse(x, y, true) //True = Left click, False = Right Click.
End; //Add an end to the functions.
End.
There you have it! Will Click The bitmap supplied ! For more help on other bitmap commands go to Scar>Help>Help. Or press "F1" while in scar :D. Now Colors!
[Colors:]
Colors are extremely useful in scripts. They are used alot to find objects/pictures etc.
Lets start with a simple script to find black on your screen anywhere. Begin with Making color an integer
Var
Color : Integer;
OK, Now we make the color integer do something :
Var
Color : Integer;
Begin
Color := 0 // 0 = Black..
End.
Lets Declare The Width And Hight.
Var
Color, w, h : Integer;
Begin
Color := 0 // 0 = Black..
End.
Now we add the command : Getclientdimensions
Var
Color,w, h : Integer;
Begin
Color :=0 // 0 = Black..
Getclientdimensions(w, h)
This will determine the Hight and width of the client Selected. OK Now we add the If(Findcolor) Function. This will find a color in the selected client. We will also add that if it finds the color black ( 0 ) then it says Yay If Not, Dam..
Var
Color,w, h : Integer;
Begin
Color :=0 // 0 = Black..
Getclientdimensions(w, h)
If(Findcolor(w, h, color, 0, 0, w, h))then //Will Find "Color" Which As We Declared Above
//Is Black. If Not We'll Make It Say : Dam.
writeln('Yay!')
Else
writeln('Dam!')
End.
There you have it! You can also use getcolor which is faster than findcolor, findcolor will find a color in a box like findbitmapin (As written above in bitmaps). It will find a color in the xs, ys, xe, ye Box. I Will Describe This Now:
|-------------------|
| Color |
|-------------------|
OK Heres our box. Now we will show the xs, ys Co ords (Which are normally 0,0 for the top left corner of the selected client. Else use the color picker and use the crosshair as a guide to the top left half of the box. :
XS+YS------------|
| Color |
|-------------------|
Now XE And YE, again use the color picker and the crosshair as a guide to this bottom half.:
XS+YS------------|
| Color |
|-------------XE+YE
Theres the final verdict. Now it will try and find "Color" In The box. Heres an example of it being used, Lets just say XS And YS Are 0, 0 And XE + YE Are 20, 20:
If(Findcolor(x, y, color, 0, 0, 20, 20))Then
Writeln('W00t, Found Color!')
For getcolor its just a simple:
If(Getcolor(X, Y)=Color)then
writeln('W00tzness!')
Also you can make it say that color. We're back to this script again:
Var
Color,w, h : Integer;
Begin
Color :=0 // 0 = Black..
Getclientdimensions(w, h)
If(Findcolor(w, h, color, 0, 0, w, h))then //Will Find "Color" Which As We Declared Above
//Is Black. If Not We'll Make It Say : Dam.
writeln('Yay!')
Else
writeln('Dam!')
End.
Just add : " Writeln('Found Color: '+Inttostr(color)) TO The End, As Shown:
Var
Color,w, h : Integer;
Begin
Color :=0 // 0 = Black..
Getclientdimensions(w, h)
If(Findcolor(w, h, color, 0, 0, w, h))then //Will Find "Color" Which As We Declared Above
//Is Black. If Not We'll Make It Say : Dam.
writeln('Yay!')
Else
writeln('Dam!')
writeln('Found Color:'+inttostr(color))
End.This concludes My help. If you need anymore help please PM Me, Email me or post a question in this thread, Enjoy!
-Kane!
-:-CONTINUE FROM ABOVE-:-
[Else + Using Not's:]
Using else in a script like above can be used in two ways. If your only using one command after then like:
Var
Color,w, h : Integer;
Begin
Color :=0 // 0 = Black..
Getclientdimensions(w, h)
----------------------------------------------
If(Findcolor(w, h, color, 0, 0, w, h))then
writeln('Yay!')
----------------------------------------------
Else
writeln('Dam!')
writeln('Found Color: '+inttostr(color))
end.
Now, see how after then theres 1 command then the next line is else?
This can only work if theres 1 command. If you want it to do more than one, lets say 3 at the moment then you'd do this:
If ~Bla Bla~ Then
BEGIN //Added Begin
movemouse(x,y)
movemouse(x,y)
movemouse(x,y)
end;
Now to add else you would do this:
If ~Bla Bla~ Then
BEGIN //Added Begin
movemouse(x,y)
movemouse(x,y)
movemouse(x,y)
end else
movemouse(x,y)
You can also make it do another 3 commands after it:
If ~Bla Bla~ Then
BEGIN //Added Begin
movemouse(x,y)
movemouse(x,y)
movemouse(x,y)
end else BEGIN //Added Begin
movemouse(x,y)
movemouse(x,y)
movemouse(x,y)
End; //Added End; To End The Begin Created.
[Now for not's :]
If(Findcolor(~Bla Bla)) -
Instead of adding else you can add:
If(NOT(Findcolor(~Bla Bla))) //Added NOT And An Extra ')' To Stop The Not.
This can also be used with findbitmap:
If(findbitmap(Bitmap_Name, x, y)) -
if(NOT(Findbitmap(Bitmap_Name, x, y))) //Added NOTE And An Extra ')' To Stop The Not.
This can be used in Untils Aswell, Untils Are used with repeat in a script: Example:
Begin
REPEAT
writeln('Kane Is Your Master!')
Wait(500)
UNTIL(False)
End.
You can make it:
UNTIL(not(findcolor(x, y, color ~Etc Etc)))
I felt like including this aswell to help other people:
And's And Or's:
Above In The Until's You Can Do This :
Until(Not(Findbitmap(~BlaBla)))and
(Not(Findcolor(~BlaBla)))
This will stop the script (Stop the repeat) If it didnt find the bitmap and color.
You can use it in other commands/functions. Like this:
If(Findcolor(~Bla Bla))and
(Findcolor(~Bla Bla))then
begin
writeln('Found 1st Color')
writeln('Found 2nd Color')
end;
Using or's is basically the same:
If(Findcolor(~Bla Bla))or //And TO Or
(Findcolor(~Bla Bla))then
begin
writeln('Found 1st Color Or 2nd Color')
writeln('Found 2nd Color Or 1st Color')
end;
I Hope Any Of This Helped. Please Leave Comments+Suggestions :) Ty-
-Kane
Felt Like Throwing In Color Tolerance!
Findcolortolerance(x, y, color, xs, ys, xe, ye, TOLCOLOR) <-- Change 'TOLCOLOR' to your number of tolerance, The higher the tolerance, the more common it will look for the same Color. Example:
Findcolortolerance(x, y, color, xs, ys, xe, ye, 55)
OK, I guess this concludes It! *Also On Kaitnieks.com*
No links are Guaranteed to work anymore since this is 5 months or so old..