PDA

View Full Version : Back to scar preschool



Dadeer
12-18-2006, 07:54 PM
Part 1

Well if your reading this tutorial you might be really desprite because well it is beign done by a completely and totaly and utterly worthless noob but it might teach you something :D

First things first
Lets make a simple script
Open scar and it should look liek this

Program New;
Begin
End.

So far so good?
excellent

now ima throw something new out there

const

So now it should be


Program new;

const

Begin
end.


Now you may be thing WDF const can save you time and can be used for colors setting amount of players and other things but you wont learn them all here(im to noobish)

So lets say we are gonna make an autominer and you put isaxeequiped
you would put


Program New;

Const

isaxeequiped = true

Begin
end.

Then if the player useing your script had there axe equiped they would put true otherwise they would put false simple enough?
That would also be use friendly because if you didnt have that they would need to fix parts of your script up so it doesnt drop there axe or doesnt drop some of the ore like this


Program new;

const

isaxeequiped = true

Procedure dropore;
Begin
If(isaxeequiped = true) then
Dropto(1,28)
If(isaxeequiped = false) then
Dropto(2,28)
End;
end.

Thats an example butno wyour probly like uhhh if then dropto OMG ARE YOU TRYING TO KILL ME the awnser is yes probably

To use dropto(x,x) you must include srl like this


Program new;
{.include SRL/SRL.scar}

Procedure dropore;
and everything else from above

thanks to srl you dont have to do the very complicated things all you need to do is dropto(2,28) because the commands are already in there :D


Lets make a Nice little autominerscript
and this time lets use 2 procedures so open up scar and it looks like


Program New;
Begin
End.

Now lets add in the const's we will need so we will need
ispickaxeequiped = true/false
orecolor = 2898528<---color of the ore we are mineing

so it looks like this now

Program Autominer

Const
axeequiped = false;
orecolor = 2898528;

Begin
End.


Okay now lets add a procedure the mineing process

we will need a command to find the ore select teh option and mine untel the inv is full so
We need to dot his

Program autominer;
{.include SRL/SRL.scar}

Const
axeequiped = false;
orecolor = 2898528;

Procedure findandmine;
Begin
Repeat
If (FindColorSpiralTolerance(x, y, orecolor, MSX1, MSY1, MSX2, MSY2) then
Begin
Mmouse(x,y,1,1)
If IsUpText('ine') Then
Clickmouse(x,y,false)
Wait(100)
chooseoption(x,y, 'ine');
end;
Until(invfull)
End;

Procedure dropore;
Begin
If (invfull = true) then
Begin
If (axeequiped = true) then
Dropto(1,28)
If (axeequiped = false) then
Dropto(2,28)
end;
end;

Begin
setupsrl;
Repeat
findandmine;
dropore;
until(false)
end.

Begin
setupsrl;
repeat
findandmine;
until(false)
end.

And there is your first working actualy script i hope you know understand the basics of srl and scar

Dadeer
12-18-2006, 08:04 PM
Part 2

Simple commands

The most simple commands are well

Wait
example
Wait(2000)
Or
wait(2000+random(2000))

MMouse
example
MMouse(x,y,1,1
or
MMouse(543,435,2,2

ill explain teh x,y in part 3 when i get to it

Chooseoption
example
Chooseoption(x,y, 'ine')

i will continue this list later

syberium
12-20-2006, 12:03 AM
Hmm cant wait for part 3! thx man haha

Wcer Auto
12-20-2006, 01:23 AM
Can't wait. It's easier for me to follow.

Dadeer
12-20-2006, 01:26 AM
ill try and update it as i descover more and more complicated things

lefamaster
12-20-2006, 03:28 PM
This was a really excellent tool. It really brought the concept of an entire script together. I have a general question about FindColorSpiralTolerance.

the example you provided is:

If (FindColorSpiralTolerance(x, y, orecolor, MSX1, MSY1, MSX2, MSY2) then

was working on a wood chopper based off this example and when compiling it said it was looking for a parameter that didin't exist? So not quite entirely working.

looking through a few more tuts a discovered this

If (FindColorSpiralTolerance(x, y,color, cords, cords, cords, cords ,tol) then

It appeared the tolerance parameter is missing.

I plugged the tolerance in at 40 and my noobish woodcutter started to chop stuff. (after I changed the IsUpText to 'hop')

My question is this...how do you set the FindColor to look for say a box?

i used the dibbler and got 29,51 and 345,-213 but when it try and compile it really doesn't like the negative number. How do i set the find color params to the proper cordinates to search the entire screen?

Also what is a good tolerance to set?

Wcer Auto
12-20-2006, 04:35 PM
I'm using ur tutorial but it doesn't work it says


Failed when compiling
Line 11: [Error] (15509:70): Invalid number of parameters in script

Dadeer
12-20-2006, 04:56 PM
its not my tut its you u messed it up somehow i hope:spot:

lefamaster

you just get teh cordnates of the box i cant really help you there maybe a srl member can help you there i cant

lefamaster
12-20-2006, 05:54 PM
@ Wcer Auto----^

That is the exact error message a got. But if you look at some other tuts this

If (FindColorSpiralTolerance(x, y, orecolor, MSX1, MSY1, MSX2, MSY2) then


should actually be:

f (FindColorSpiralTolerance(x, y, orecolor, MSX1, MSY1, MSX2, MSY2, tolerance) then


or an example:

f (FindColorSpiralTolerance(x, y, 124563, 215, 15, 334, 151, 40) then


I got it to compile after adding in the red tolerance number after the two mouse cordinates

:spot:

alach11
12-29-2006, 06:58 AM
I get an error message whenever I try and use the drop functions in SRL.

All I have in SCAR when I run is

program New;
{.include SRL/SRL.scar}
begin
Dropto(1,28)
end.

I get.

Line 174: [Hint] (182:43): Variable 'NEWLINE' never used in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Globals.scar
[Runtime Error] : Exception: Access violation at address 006549BC in module 'scar.exe'. Read of address 00000000 in line 103 in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\GameTab.scar

alach11
01-02-2007, 03:32 AM
I get an error message whenever I try and use the drop functions in SRL.

All I have in SCAR when I run is

program New;
{.include SRL/SRL.scar}
begin
Dropto(1,28)
end.

I get.

Line 174: [Hint] (182:43): Variable 'NEWLINE' never used in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Globals.scar
[Runtime Error] : Exception: Access violation at address 006549BC in module 'scar.exe'. Read of address 00000000 in line 103 in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\GameTab.scar

alach11
01-02-2007, 03:53 AM
I get an error message whenever I try and use the drop functions in SRL.

All I have in SCAR when I run is

program New;
{.include SRL/SRL.scar}
begin
Dropto(1,28)
end.

I get.

Line 174: [Hint] (182:43): Variable 'NEWLINE' never used in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Globals.scar
[Runtime Error] : Exception: Access violation at address 006549BC in module 'scar.exe'. Read of address 00000000 in line 103 in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\GameTab.scar

japman
01-02-2007, 11:26 PM
i seem to be getting

Line 11: [Error] (17672:73): Close round expected in script


in my script i have


If (FindColorSpiralTolerance(x, y, orecolor, MSX1, MSY1, MSX2, MSY2, 40) then

any1 know why this is happening?

Dadeer
01-03-2007, 12:12 AM
u have 2 (( and only one) u need to add another ) to the end

japman
01-03-2007, 03:11 PM
Thanks but now i have

Line 174: [Hint] (182:43): Variable 'NEWLINE' never used in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Globals.scar

didnt know how to fix this one

r4ndom
01-06-2007, 04:10 PM
this is not an error its a hint which means it dosent actually need fixing it is just saying that the variable is never used

Sebo
01-07-2007, 05:53 PM
Good Job :) Helps the noobies.