Log in

View Full Version : Can't figure out the command! =/



osunateosu
03-12-2012, 03:05 AM
So I know this command is probably very simple, but I can't figure one out that I can use. On my script I've gotten it to where the mouse will find the rock and click it but it just keeps mass clicking it. I was wondering what the command was to make it wait until the rock is mined and then move on to the other rock.

Thank you!

lilcmp1
03-12-2012, 03:25 AM
You can use simply Wait(10000); which would wait 10000 ms or 10 seconds. Wait(5000+RandomRange(1000,2000)); Would wait 5 seconds plus a random 1-2 seconds.

Nemesis3X
03-12-2012, 03:27 AM
So I know this command is probably very simple, but I can't figure one out that I can use. On my script I've gotten it to where the mouse will find the rock and click it but it just keeps mass clicking it. I was wondering what the command was to make it wait until the rock is mined and then move on to the other rock.

Thank you!

You have to use Animation.

basically, I guess you have a function that search for the uptext of the rock and when it find it, it clicks it.

First, you need to add this single Function in your Script.


Function Mining: boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 350);
end;



What this function do. Every 250 Ms, it counts the pixel shift of your character for 500 ms. If the Pixel Shift is higher than 350, the function return true and it continue to repeat until it = false. For sure, the value 350 may not work for your script, so you may play with or look for what the value people used on their own mining script in the mining section.

Now, How do you use this function correctly in your script. Take a look at this peace of code I will show you here.


Function CrushBones: Boolean;

Var
TPAA: T2DPointArray; //Declare the variables
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3688504, MSX1, MSY1, MSX2, MSY2, 7);
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 5, 5);
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 10 Then
Begin
inc(Retry);
MiddleTPAEx(TPAA[i], X, Y);
MMouse(X, Y, 1, 1);
If WaitUpText('opper', 300) Then // We found the Rock
Begin // Lets begin into action!
Result := True; // Our function return true, so it wont repeat because we have found the Rock!
GetMousePos(X, Y); // We get the Pos of the mouse on the screen
mouse(x,y,1,1,true); // We click on the Rock
Wait(1500 + random(1000)); // We wait 2 sec
FindNormalRandoms; // We look if we did get a lucky random to piss us off
Makecompass('s'); // Make sure my compass is in the good direction but this is particular to my script
while Mining do // Count the pixel shift to determinate if we are still mining or if We did mine the rock
antirandoms; // Do Antirandoms like moving the mouse while we Are mining
Break; // Stop the function, since we are no more mining now
end; // The function end here
if (Retry = 10) then
begin
Antistuck := Antistuck + 1
if (Antistuck = 15) then
begin
terminatescript;
end;
Crushbones;
end;
End;
End;


I placed // Where I wanted to bring your attention on, since if you are a begineer, you won't understand what is going on in this function. Basically, think that I found the Rock in your Script. Now, My script get the Coord and Click on the Rock. The script wait 1,5s to lets the time of your character the get into action. After, the script make sure We didn't get a random or We didn't change our compass while clicking than that is where we are using the Function showed above. If we are mining, Our function mining will return true because our character is doing a animation of mining and the pixel animation will be higher than the number added in the function(350 in this case) and While this function return true, We can add Antiban Features like moving the Mouse on the Screen or simply adding a Wait if you still don't have one right now.

Hope I helped you out.

So basically, What you need to Add After your Clicked on the Rock is This

Wait(1500 + random(1000));
While mining do
wait(500 + random(500)); // You can change this for a Antiban procedure you made.

osunateosu
03-12-2012, 04:29 AM
Alright awesome, I'm not that advanced into scripting so that kind of threw me off, what I don't get is

while Mining do // Count the pixel shift to determinate if we are still mining or if We did mine the rock

because I don't see where it commands it to count the pixels.

Also I'm doing this to mine a rock like addy that takes a long time, thats why I need a command and wait won't work, because you can't really predict how long it'll take to mine a rock like that.

osunateosu
03-12-2012, 06:55 PM
I'm sorry, but I didn't quite understand that and was wondering if anyone had like MSN that I could talk to them by or could help explain my question? All help is much appreciated!

LordJashin
03-12-2012, 08:20 PM
I'm sorry, but I didn't quite understand that and was wondering if anyone had like MSN that I could talk to them by or could help explain my question? All help is much appreciated!

Forgot about that way O_O well here's my list I can think of off the top of my head -

1. Color/DTM/Bitmap/ w/e change
2. To detect if you are mining the rock or not, use the animation stuff ( pixel shift )
3. You could also check around the rock ( very hard to implement ) if there is any other pixel shifts going on ( like maybe someone else mining the rock )
4. Be nice if you had like an Addy pick and you wanted to check if someone around the rock has a Rune pick. Then you could move to a different rock.
5. Autocolor aid might help out

Nemesis3X
03-12-2012, 10:54 PM
2. To detect if you are mining the rock or not, use the animation stuff ( pixel shift )
3. You could also check around the rock ( very hard to implement ) if there is any other pixel shifts going on ( like maybe someone else mining the rock )


mmm, Pixel animation is by far the best way to know if We are mining and for this reason. You are a lucky person because I will do a all in one tutorial for you Right here in my post just for you. I could simply tell you to go look into a mining script, but I feel like helping someone today.

If you don't understand after This, I don't know what to do! Hope you will rep me for this nice time I am taking to help you :P


Alright awesome, I'm not that advanced into scripting so that kind of threw me off, what I don't get is

while Mining do // Count the pixel shift to determinate if we are still mining or if We did mine the rock

because I don't see where it commands it to count the pixels.

Also I'm doing this to mine a rock like addy that takes a long time, thats why I need a command and wait won't work, because you can't really predict how long it'll take to mine a rock like that.

K, lets get back to point 1. First, you need to introduce in your script this Function I showed you in my last post which is this one below.

The role of this function is to Counts the pixel animation of your character on the screen.

Function Mining: boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 350);
end;

Ok, to help you out, I will explain you each part of this function, so you will be able to understand what is going on and be able to play with the values!

Lets get started with the first part of the code which is the Box.
PBox := IntToBox(245, 130, 285, 195);
Pbox is the name we gave to the box we will make. We are going to give cords to make the dimension of our box in the () that match the position of our player on the Screen. Since we know our character is always in the middle, these value showed here are good for everyone, so you shouldn't touch them.

245 = X1, 130 = Y1, 285 = X2 and 195 = Y2.
So, to help you even more, here a small picture to show you what happen with these value in the game.
http://img809.imageshack.us/img809/5962/coorbox.png (http://imageshack.us/photo/my-images/809/coorbox.png/)
As you see, the Coordinates X1,Y1 and X2,Y2 Make a Box around our Character.

Basically, this will result into a Box that will surround only your Character.
Now, lets move to the pixels counts. The part where it calculs the Pixel animation is showed right here.

Result := (AveragePixelShift(PBox, 250, 500) > 350);
That's the part where it counts the pixels. Now, I am going to explain Each value just for you.

Result. The Result will tell us if we are mining or not depending on the number of pixel shift counted during a lapse of time.

Pbox. This is the Box we made sooner. The script will get the box on the Client and Counts the Pixel Shifts in this box!

250. This value mean our Script will recount pixels Every 250 ms to see if this function is still true. You could change this value to 1000ms. In this case, it would means the script would recount pixels Every 1 second.

500. This value is used to tell the script for How long we want to recorder the Pixel shifts animation. In this case, it is 500ms. This means the script will count the number of pixel shift during 0,5 sec. You can change this value to 3 sec if you want to!

> 350. That's where everything come into play. The number 350 is the number of Pixels Shifts. In this case, we set 350 pixel shift. So, this mean that when our script execute this function, if the number of Pixels counted during 500ms is higher than 350, Our function will return true. If the function return true, it means we are mining. On the other hand, if the number of pixels counted during 500ms is lower than 350, Our function will return false. If the function return false, it means we aren't mining anymore.

So, this function calculated the number of pixels shifts for a specific amount of time every 250ms until it returns false!

Now that we know that! We can move to the part where we are going to use this function at our advantage in our script, so we can make a effective mining script!

Lets take a look at this piece of code right here.

while Mining do
Antiban;
First, I will explain you what 'While' means since you didn't understand it. While means that if our function return true, We will do a specific action until the function is false. Basically, that's here we add Anti ban!

I will show you what kind of Anti ban you can add. This is my Anti ban used in my script.
procedure AntiBan;
begin
case random(500) of
1: PickUpMouse;
2: CheckRandomTab;
3:HoverSkills(skill_Prayer, False);
4:CheckGloryOrEmerald;
5:RandomMouvMouse;
6:RandomMouvMouse;
7:RandomMouvMouse;
8:RandomMouvMouse;
9:RandomMouvMouse;
10:RandomMouvMouse;
11:RandomMouvMouse;
12:RandomMouvMouse;
end;
end;
So, while our function return true and our script is waiting for it to return false, The script will execute the procedure Antiban. In this case, I made a case of random going up to 500, because I didn't want to do Anti ban feature each time and this also give some randomness on when they happen.

If you don't have antiban feature in your script. You can change this piece of code for this instead

While mining do
wait(50 + random(100));

This will do nothing and it will just wait for your function to return false.

Now, Did I do all this to leave you Right there and try to finish this off by yourself?
Well, no. I even took the time to show you how it would look like in your Script. Here is the total code of the mining part that your script should have!

procedure AntiBan;
begin
case random(500) of
1: PickUpMouse;
2: CheckRandomTab;
3:HoverSkills(skill_Prayer, False);
4:CheckGloryOrEmerald;
5:RandomMouvMouse;
6:RandomMouvMouse;
7:RandomMouvMouse;
8:RandomMouvMouse;
9:RandomMouvMouse;
10:RandomMouvMouse;
11:RandomMouvMouse;
12:RandomMouvMouse;
end;
end;

Function Mining: boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 350);
end;

function AddyFinder(x, y : Integer): Boolean; // Credit to I am Legend
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(0.09,0.12);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 7044458, MSX1, MSY1, MSX2, MSY2, 12); //For tolerance, put in your own tolerance. MSCX and MSCY are the starting points in the center of the mainscreen. MSX1, MSY1, etc. are the outside of the Main Screen.
ColorToleranceSpeed(CTS); //Make sure you do this after you're done color finding, so text finding will work again.
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y); //Returns the middle coords of the current TPA in the ATPA
MMouse(x, y, 2, 2); //Moves mouse over the object
if WaitUptext('Mine',500) then
begin
Result := True;
GetMousePos(x, y); //Sets the x and y values for future use (Like clicking)

Break; //Exits the For To Do statement so it doesn't keep moving around looking for the object
end;
end;
end;

Function CountOre: integer;
var TPA : TPointArray;
Begin
FindColorsTolerance(TPA, 1813784, MIX1, MIY1, MIX2, MIY2, 15);
RAaSTPAEx(TPA, 42, 36);
Result := Length(TPA);
End;

Procedure GoingToMine; // This is purely made with my imagination :P
Addyfinder;
wait(1000 + random(500));
While Mining do
Antiban;
CountOre;
if(CountOre = 27) then
begin
Writeln('We are full');
end else
begin
repeat
GoingToMine
until (CountOre = 27);
end;
end;


So, this is a full procedure to mining a Addamantite ore. I used the addy finder from I am legend mining script for this demonstration, since I didn't have any mining script to show you a piece of code.

Now, You should be able to get this working!

LordJashin
03-13-2012, 12:24 AM
Will definitely be reading the bottom part, and script later. Nice job +1 to you. Never seen a post so long and awesome in a while! :D
Also forgot to add u can use TPA's