SRL Archive - Outdated Tutorials

DRSARed(Auto Coloring Function By Me) * old


Avaphi

2006-05-25 01:00:57

function DRSARed(RedArrowcol:integer):boolean;
var xm,ym:integer;
begin
if FindMSColor(x,y,RedArrowCol)then
begin
GetMousePos(x,y);
xm:=x;
ym:=y;
curcolor:=GetColor(xm,ym);
Result:=True;
end;
Writeln('Current color is:'+ IntToStr(curcolor) + '!')
end;
Let Me explain, DRSARed, Is a method, to bring back autocolors into scar scripts. It was first used in my powerminer. Let me explain what it does. It is designed to run after you perform a click on an object, Such as clicking on an iron vein, In a rock. It runs after that function that clicks the iron, And it detects the Small red 'X'(THE SMALL RED 'X's COLOR IS ALWAYS 255, To CALL THIS FUNCTION, YOU WOULD TYPE DRSARed(255);) That appears for short period of time. Look At the picture below.


It detects what the arrow is pointing at. Then once it detects that it gets the color of where the mouse is at, In this case it was on an iron vein, On a rock. Look below to see what color it clicks and reads into scar.



As you can see here it gets the color directly below where the red 'X' Was.

So now you are asking me, How do I get this to work for me? Here is my answer. There is a variable in my function called, Curcolor. alls you have to do is after you run DRSARed(255); You would have the variable color you want to change, In my example it will be called 'Orecolor'. Here is an example of how it is used.

if(FindObj(x, y, 'Mine', orecolor, oretol1))then
begin
Mouse(x,y,0,0,true)
DRSARed(255);
OreColor := CurColor;

Let me explain this code to you, For those begginner scripters, Or those who do not understand fully. If it finds the text 'Mine' and the orecolor(A global variable) and a certain preset tolerance then it will mouse the mouse to where the color/text is found. Then DRSA run and it gets the color of where you clicked. Then after that you set your variable(Orecolor in this case) :=Curcolor;

And that is how you use my function. I hope it will sooner or later be implemented into srl, So everyone can get back on the right track with autocolors. DO NOT USE THIS TO MAPWALK, IF YOU WANT TO MAPWALK, USE RADIALWALK. Dont know what RadialWalk is? It is a genius function made by Fakawi, You can read about it here http://82.92.130.193/forums/showthread.php?t=452

Hope this was insightful, into re-autocoloring scar scripts

~db_cheater~

XxKanexX

2006-05-25 01:55:25

Why is this in the tutorial section if it's just a script?

WhiteShadow

2006-05-25 01:59:03

This is a different, good, and interesting idea to do AutoColorFinding.

A question though.
1) The arrow color has to be set each time?

XxKanexX

2006-05-25 02:00:49

From: XxKanexX
Why is this in the tutorial section if it's just a script?

My bad. You edited it an added information. Ty :)

Good tutorial.

Avaphi

2006-05-25 02:02:47

@:Kane: Thanks for teh comment :p

@:Whiteshadow: No, Alls you have to do is(For now) Copy my procedure into your script, and call it DRSA(255); and then set your variable you want to change constantly.(No you do not have to change arrow color all the time, It stays the same :D

WhiteShadow

2006-05-25 02:21:33

Than you don't even need the params, if they're never going to change. Well that's what I do. If a procedure/function I make is suppose to be made to post somewhere, I make params that are only needed.

And again, great job!

Avaphi

2006-05-25 02:39:35

The reason it has params is because I was considering making a version where you could map walk :o (DRSAYellow)

The Un-Named

2006-05-25 10:13:10

An intresting idea. Still, tolerance is better in my opinion because you just need to press play ;).

Avaphi

2006-05-25 10:56:49

Tolerance can throw off scripts at alarming rates. :eek:

leader

2006-05-25 12:05:18

I will try this out when I attempt to make my first script.

tarajunky

2006-05-25 12:26:33

This looks interesting, and I wanted to do a similar thing to detect 'mis-clicks' (where it would be a yellow X instead of a red one).

Do you run this procedure directly after the Mouse procedure you use? And how reliable is it? Does it detect the X every time or only once in a while?

Avaphi

2006-05-25 12:46:52

in my pminer it detects the right color all the time ;)