solemn wishes
02-16-2006, 11:12 PM
-=[TUTORIAL]=-
Hello everyone, i hope this -=[TURTORIAL]=- helps you guys who are n ew to scar or dont understand some commands/procedure's, i hope to cover the following area's:
BITAMPS- How to use a simple bitmap in a mining script.
findcolorspiral- if you dont allready know how to use.
counters- how to make a simple counter.
progress reports- how to make a simple progress report.
simple commands- i am hopeing that this will help teach you some simple commands also.
OK let's begin....
BITMAPS:
A bitmap is bassicly a pitchure that scar can recconize through code, in this turtorial we are making a simple powerminer and therefor i will be creating a bitmap of the letter "M" that appears above the rock you want to be when you hover the mouse above it.
once you have cropped the image down to size it should look something like this.
(http://imageshack.us)
know because the background color changes if you move area ect we must mkae this so scar will not look for the background color's but just focus on the letter "M"
We can acheive this by simple grabbing the fill took and filling the area around the "M" with black, your letter "M" should know be the only thing viable on your picthure and everything else black.Once you have done this your image should look exactly like this.
[img=http://img233.imageshack.us/img233/6340/bitmapturtorial22ct.png] (http://imageshack.us)
Know save this and in the scar window go to "script" then down to "picture to string"simple open your image know look at the bottom of the scar window and you should have something very simular to this*
Mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
copy this and know start a new scar script, create a procedure called "loadbitmaps" or watever you like and know paste your bitmap into this procedure, know you need to declair what the bitmap is, i called my bitmap "mine" so i would write:
var Mine:integer;
at the beggining of my script. You should know have something very much like this.
program powerminer;
var mine:integer;
procedure loadbitmaps;
begin
mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
end;
begin
end.
Ok let's check that its all correct so far, head off to a mining area and get the color of the rock you want to mine.
know write this:
const
rock1color=thecoloroftherock;
Ok so we know have to get scar to find that color and move the mouse, we are going to use "findcolorspiraltolerance" for this. make a new procedure and call it "mine" know put this code in it.
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,5))
IF YOU DONT UNDERSTAND THAT THIS MAY HELP
[IMG]http://img226.imageshack.us/img226/3596/turtorial4ip.th.png (http://img226.imageshack.us/my.php?image=turtorial4ip.png)
know we need to declair the variables "x and y" type this.
var x,y,mine:integer;
Ok know this is my code, i have hopfully made it clear what each function does and you should be able to understand from this how it all works:
program powerminer;
var x,y,mine:integer;
const
rock1color=9079448;
procedure minethatore;//this is a simple procedure but works
begin
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,2))then
movemousesmooth(x,y) //moves the mouse towards the color
wait(1000+500)//wait a random time
if(FindBitmapToleranceIn(mine,x,y,6,6,126,23,1))th en//this is the bitmap we made earlier
begin
getmousepos(x,y) //gets the position of the mouse
clickmouse(x,y,true) // clicks the mouse at its current position
wait(3000+1000) //waits 3 seconds + 1 second
end;
end;
procedure loadbitmaps;
begin
mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
end;
begin
end.
Know press ctrl+alt+r and guess what!....it should work, know we need to tell scar what we want it do, firstly we want it to load the bitmaps(if it does not load the bitmaps scar will not reconise them. To get scar to load the bitmaps
simple scroll down to the bottom of our current script and write this:
begin
loadbitmaps;
end.
ok so know when you press ctrl+alt+r the bitmaps will load, know we want scar to mine the rocks until it is unable to, scroll down to the bottom of your scar script again and type this.
begin
loadbitmaps;
repeat //the repeat means for it to repeat what is bellow
minethatore
until(false)//this means until it is unable to or an error occur's
end.
now press "ctrl+alt+r" and the script will hopefully start mining! and to stop the script "ctrl+alt+s".
Know hopefully you have learnt some of the basics of scar lets go over some other thing's.
Adding a counter for example is simple but add's to a script by alot, a counter shows the ammount of times a certain procedure has been done.Let's begin by adding a simple counter to our script and then creating a full progress report for it.
go back to your var and type soemthing like this:
var rocksmined,x,y,mine:integer;
know go back to your script and type this
procedure minethatore;
begin
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,2))then
movemousesmooth(x,y)
wait(1000+500)
if(FindBitmapToleranceIn(mine,x,y,6,6,126,23,1))th en
begin
getmousepos(x,y)
clickmouse(x,y,true)
wait(3000+1000)
///////////////////////////////////////
rocksmined:=rocksmined+1; //this is what we added
///////////////////////////////////////
end;
end;
know it is time to show this in a writeln form, at the end of your script you have this:
begin
loadbitmaps;
repeat
minethatore
until(false)
end.
change that to something such as this...
begin
loadbitmaps;
repeat
minethatore
writeln('<this turtorial was created by solemn wsishes >');
writeln('mined '+inttostr(rocksmined)+ ' rocks so far');
until(false)
end.
this is whoing the ammoutn of rocks it has mined, you may have noticed that once it mined a rock the counter goes +1, this is a simple function of scar but yet very inportant when creating a detailed script.
this is my final code, and your's should look about the same.
program powerminer;
var rocksmined,x,y,mine:integer;
const
rock1color=16777215;
procedure minethatore;//this is a simple procedure but works
begin
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,2))then
movemousesmooth(x,y) //moves the mouse towards the color
wait(1000+500)//wait a random time
if(FindBitmapToleranceIn(mine,x,y,6,6,126,23,1))th en//this is the bitmap we made earlier
begin
getmousepos(x,y) //gets the position of the mouse
clickmouse(x,y,true) // clicks the mouse at its current position
wait(3000+1000) //waits 3 seconds + 1 second
end;
end;
procedure loadbitmaps;
begin
mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
end;
begin
loadbitmaps;
repeat
minethatore
writeln('<this turtorial was created by solemn wsishes >');
writeln('mined '+inttostr(rocksmined)+ ' rocks so far');
until(false)
end.
IF I HAVE MADE ANY CODEING ERROR'S OR WATEVER PLZ POST EM :)
copyright 2005-2006
solemn wishes
all rights reserved
error surpost pm me
Hello everyone, i hope this -=[TURTORIAL]=- helps you guys who are n ew to scar or dont understand some commands/procedure's, i hope to cover the following area's:
BITAMPS- How to use a simple bitmap in a mining script.
findcolorspiral- if you dont allready know how to use.
counters- how to make a simple counter.
progress reports- how to make a simple progress report.
simple commands- i am hopeing that this will help teach you some simple commands also.
OK let's begin....
BITMAPS:
A bitmap is bassicly a pitchure that scar can recconize through code, in this turtorial we are making a simple powerminer and therefor i will be creating a bitmap of the letter "M" that appears above the rock you want to be when you hover the mouse above it.
once you have cropped the image down to size it should look something like this.
(http://imageshack.us)
know because the background color changes if you move area ect we must mkae this so scar will not look for the background color's but just focus on the letter "M"
We can acheive this by simple grabbing the fill took and filling the area around the "M" with black, your letter "M" should know be the only thing viable on your picthure and everything else black.Once you have done this your image should look exactly like this.
[img=http://img233.imageshack.us/img233/6340/bitmapturtorial22ct.png] (http://imageshack.us)
Know save this and in the scar window go to "script" then down to "picture to string"simple open your image know look at the bottom of the scar window and you should have something very simular to this*
Mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
copy this and know start a new scar script, create a procedure called "loadbitmaps" or watever you like and know paste your bitmap into this procedure, know you need to declair what the bitmap is, i called my bitmap "mine" so i would write:
var Mine:integer;
at the beggining of my script. You should know have something very much like this.
program powerminer;
var mine:integer;
procedure loadbitmaps;
begin
mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
end;
begin
end.
Ok let's check that its all correct so far, head off to a mining area and get the color of the rock you want to mine.
know write this:
const
rock1color=thecoloroftherock;
Ok so we know have to get scar to find that color and move the mouse, we are going to use "findcolorspiraltolerance" for this. make a new procedure and call it "mine" know put this code in it.
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,5))
IF YOU DONT UNDERSTAND THAT THIS MAY HELP
[IMG]http://img226.imageshack.us/img226/3596/turtorial4ip.th.png (http://img226.imageshack.us/my.php?image=turtorial4ip.png)
know we need to declair the variables "x and y" type this.
var x,y,mine:integer;
Ok know this is my code, i have hopfully made it clear what each function does and you should be able to understand from this how it all works:
program powerminer;
var x,y,mine:integer;
const
rock1color=9079448;
procedure minethatore;//this is a simple procedure but works
begin
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,2))then
movemousesmooth(x,y) //moves the mouse towards the color
wait(1000+500)//wait a random time
if(FindBitmapToleranceIn(mine,x,y,6,6,126,23,1))th en//this is the bitmap we made earlier
begin
getmousepos(x,y) //gets the position of the mouse
clickmouse(x,y,true) // clicks the mouse at its current position
wait(3000+1000) //waits 3 seconds + 1 second
end;
end;
procedure loadbitmaps;
begin
mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
end;
begin
end.
Know press ctrl+alt+r and guess what!....it should work, know we need to tell scar what we want it do, firstly we want it to load the bitmaps(if it does not load the bitmaps scar will not reconise them. To get scar to load the bitmaps
simple scroll down to the bottom of our current script and write this:
begin
loadbitmaps;
end.
ok so know when you press ctrl+alt+r the bitmaps will load, know we want scar to mine the rocks until it is unable to, scroll down to the bottom of your scar script again and type this.
begin
loadbitmaps;
repeat //the repeat means for it to repeat what is bellow
minethatore
until(false)//this means until it is unable to or an error occur's
end.
now press "ctrl+alt+r" and the script will hopefully start mining! and to stop the script "ctrl+alt+s".
Know hopefully you have learnt some of the basics of scar lets go over some other thing's.
Adding a counter for example is simple but add's to a script by alot, a counter shows the ammount of times a certain procedure has been done.Let's begin by adding a simple counter to our script and then creating a full progress report for it.
go back to your var and type soemthing like this:
var rocksmined,x,y,mine:integer;
know go back to your script and type this
procedure minethatore;
begin
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,2))then
movemousesmooth(x,y)
wait(1000+500)
if(FindBitmapToleranceIn(mine,x,y,6,6,126,23,1))th en
begin
getmousepos(x,y)
clickmouse(x,y,true)
wait(3000+1000)
///////////////////////////////////////
rocksmined:=rocksmined+1; //this is what we added
///////////////////////////////////////
end;
end;
know it is time to show this in a writeln form, at the end of your script you have this:
begin
loadbitmaps;
repeat
minethatore
until(false)
end.
change that to something such as this...
begin
loadbitmaps;
repeat
minethatore
writeln('<this turtorial was created by solemn wsishes >');
writeln('mined '+inttostr(rocksmined)+ ' rocks so far');
until(false)
end.
this is whoing the ammoutn of rocks it has mined, you may have noticed that once it mined a rock the counter goes +1, this is a simple function of scar but yet very inportant when creating a detailed script.
this is my final code, and your's should look about the same.
program powerminer;
var rocksmined,x,y,mine:integer;
const
rock1color=16777215;
procedure minethatore;//this is a simple procedure but works
begin
if(FindColorSpiralTolerance(x,y,Rock1Color,5,5,514 ,337,2))then
movemousesmooth(x,y) //moves the mouse towards the color
wait(1000+500)//wait a random time
if(FindBitmapToleranceIn(mine,x,y,6,6,126,23,1))th en//this is the bitmap we made earlier
begin
getmousepos(x,y) //gets the position of the mouse
clickmouse(x,y,true) // clicks the mouse at its current position
wait(3000+1000) //waits 3 seconds + 1 second
end;
end;
procedure loadbitmaps;
begin
mine := BitmapFromString(17, 17, 'z78DADD94DB0' +
'A80200C407F69B38BFAA8ADFFFFA5861B44880F6952B60303 D9F4' +
'A0E000AA2282874573EF18C4B2DB7D65522EF590671C6D142 9B45' +
'8783F831E2DDAA225810601428B45B8545DAA76B00872BE5A DC09' +
'CC8C69B1E8FB64F7D2D5A396628F5826E62F16C3E0F016E9A 9B2D' +
'C0EB16433A7EE1FBD3CA53F603900F40458C2');
end;
begin
loadbitmaps;
repeat
minethatore
writeln('<this turtorial was created by solemn wsishes >');
writeln('mined '+inttostr(rocksmined)+ ' rocks so far');
until(false)
end.
IF I HAVE MADE ANY CODEING ERROR'S OR WATEVER PLZ POST EM :)
copyright 2005-2006
solemn wishes
all rights reserved
error surpost pm me