PDA

View Full Version : Tutorial - How to find Moving NPC/Monster



Nemesis3X
02-23-2012, 10:22 PM
Hello Everyone! I don't know if any of you ever had problems with moving NPC's or Monster, but I've had Problems with them and I am willing to simplify Your life with a Tutorial on How to Find a Moving NPC or Monster without any more Headache. If you are Tired to see Your bot Trying to find Your NPC, but can't because someone is near you and He has the Same color as your Script, so Your bot keeps Hovering the mouse on this guy because he is the closest to you until he get's further away and Finally allow to script to find the Real NPC you Wanted to find! than you are in the Right place.

Why Would you Want to Use This Method?
Well, I am not here to Force you to use My method, but It is very effective. You can continue to use Simple Method like
if (findobjcustom(x,y,['Wilderness'],[2172972],5)) then
But like I said, If I come Near You with the Same Color as your Script, You will have a lot of Fun Watching your Bot hovering the Mouse on me Trying to find the Target as You can see on this Picture! That I don't have :O

How to do it:
Basically, At the end of this Tutorial, Your Function for Finding the NPC will look like the Function Below. In this case, I was searching a NPC and I had to Click and Choose an Option on him.
Function TalkingToMages: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, Width, Heigh); //Put the Width and Heigh here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set How Much Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], X, Y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['age', 'amorak'])) then // Enter The name of Your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 2);
Break;
end;
end;
This May look Scary for Now, but It will become A lot Easier After I explain to You Step by Step of What to do!

Lets Get started!
Step 1 : Get Your Color!
Since NPC's or Monsters Move, You want to get Pick your color on His head, It will be a lot Easier for Your Script to Find out the NPC like that, because If you Pick a color that is only visible on the Chest (Chest of the Monster or NPC you want to find)This can Lead to Your Function Returning False because You cannot find the NPC since the color You Picked is not in the Angle of Your screen.

For this Reason, I decided to Pick goblins as an Exemple for This Script.
http://img32.imageshack.us/img32/3542/goblinhead.png (http://imageshack.us/photo/my-images/32/goblinhead.png/)
As You see, The Color of The Head of This goblin is 5940087. For tolerance, It is pretty much testing what works best, I would always recommend Starting with a Tolerance of 7 and If you don't like the Result, You can adjust it to your liking/which ever works for you. If you are Wondering What happens when You reduce your tolerance, It will search for Colors that are near to the one your Picked. If you rise it, It will search for Colors that are more likely the Same as Your color.

With Your color and Tolerance, You have to to put them into the function. Here is a Picture on Where to Put them :
http://img836.imageshack.us/img836/3162/colorandtolerance.png (http://imageshack.us/photo/my-images/836/colorandtolerance.png/)

Step 2 : Get the Width and Heigh
This is by far, The most important Part of This function. The End Result will Depend on how good you do it. So, let me explain how we get this. Did you always wonder How People Were getting their Distance in the Game, since there is no option that Tells us the Exact distance between points? Well, there is a way to know how Far Each points is from Each Other and It is with Picking the Color. Before I explain How do it, Take a look at this Picture I posted Below This Text!
http://img811.imageshack.us/img811/3618/mouseclick1.png (http://imageshack.us/photo/my-images/811/mouseclick1.png/)
http://img191.imageshack.us/img191/5078/mouseclick2.png (http://imageshack.us/photo/my-images/191/mouseclick2.png/)
Why are we doing this? We want to Make a Box, so When our Script Does the Function, our function will find Dots of our Color and If there is Enough Dots To make the Same box as Us, the function will return True and Check if it is the Right NPC, if it is, it will click in the middle of the Box and if it is now, it will move to another to see if it is our NPC. Now, lets get into the Topic, how to get theses values. As you can see, We don't see my Mouse on the Screen, So I made a Red Dot to Indicate Where My mouse was!

What you want to do: First, Get beside your NPC (like I did) then Click on Pick Color on Simba. The screen will freeze and that's exactly what we want. What We want to do is Get the Dimension of the Head. As your see, I moved my Mouse to What Would be my bottom Right corner and I took note of the Coordinates that were in the Red Box(638,624). After, I did the Same, but on the opposite side, So I moved my Mouse to What would be my Top Left Corner and Took note of the coordinates (635,771). So, Now do you see the Box I was Talking About?

The Next Step is to get Width and Height. First, Put the value of the same Type Together, so 638 with 635 and 624 with 771 = (638,635) and (624,771). If you are wondering why My second Value is so High, it is Because I took a Picture and get the coordinates from the picture, but I didn't place paint in the same arena as I took the Coordinates with the first picture and it wasn't on the same place on my Main screen, so I got coordinates that are wrong, but it won't happen if you do it on your Playing Screen. For this Reason, We will change our 771 for 625. Now, it should be (638,635) and (624,625).

Why do we need These Values. If you do 638 - 635 = 3 and this is our Width. 624 - 625 = -1, but we can't have a negative Value, so we turn it into apositive value by which I mean 1 and this is our Height. Wow! We are almost done! Enter The Width and Height to their Respective Place shown on the Picture below and When you Script use this function, It will seach for array that will allow him to make a Box like this on this Picture.
http://img641.imageshack.us/img641/354/boxgoblin.png (http://imageshack.us/photo/my-images/641/boxgoblin.png/)
http://img269.imageshack.us/img269/4356/width.png (http://imageshack.us/photo/my-images/269/width.png/)

Step3 - Get the Up Text
http://img23.imageshack.us/img23/693/uptext.png (http://imageshack.us/photo/my-images/23/uptext.png/)
As you see on the picture, When you move your Mouse Over the Goblin, There is an Up Text. My indication. Never Use the First letter, because it will make it longer for your Bot to Detect if it is the Right Npc. So, Here is what our Uptext would be : oblin that we would add on here on this picture below.
http://img15.imageshack.us/img15/2900/nameez.png (http://imageshack.us/photo/my-images/15/nameez.png/)

So, Our Script Should look like this now
Function TalkingToMages: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5940048, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Heigh here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set How Much Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['oblin'])) then // Enter The name of Your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 15);
Break;
end;
end;

In this Case, My function was Click on A NPC that I had to Talk and Choose an option to Teleport. Here, We want to Attack a goblin, so We are going to change the End of this Function to attack instead of Trying to Find the Option Teleport on Goblin.

Function TalkingToMages: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5940048, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Heigh here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set How Much Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['oblin'])) then // Enter The name of Your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,true);
wait(5000 + random(1000));
Writeln('We have found our Goblin, Yeh!');
Break;
End;
until (Retry = 2);
Break;
end;
end;

Now, We are Good. Also, I added what we Call a FailSafe, so If the Script Doesn't find the goblin after 2 attempts, it will end. That's where You can enter in Your script a procedure to Walk To a New place to Try to find Another NPC or change the Angle of the compass.This method Can also be used to find Object in Runescape like Door or stairs. So, I hope I helped you out to Make a better Script with the Ability to find NPC's Way easier without any more Trouble.

Le Jingle
02-23-2012, 10:30 PM
I was actually toying around with this for a script I want to make; will look over this guide after class, but it looks like it will definitely help me!

Looks like an excellent guide, thanks! ! ! :D

[XoL]
02-23-2012, 11:11 PM
Nice job, repped

Camaro'
02-23-2012, 11:14 PM
Excellent tutorial, repped!

P1nky
02-23-2012, 11:16 PM
Love it, good job Mate.

Le Jingle
02-24-2012, 02:30 AM
Here's (perhaps) a more fluent revision of your guide, I'm not as great with programming as most, so that may counter my ability to help in the revision. (In before my ability to revise sucks too -.-) :P

"_" underlines = remove the capitalization/capital letter
bold + italics = suggested spelling/phrasing
There is no CRTL+S for striking words out, so I simply deleted some characters/words/phrases.



Hello Everyone! I don't know if any of you ever had problems with moving NPC's or Monster's, but I've had Problems with them and I am willing to simplify your life with a tutorial on How to Find a Moving NPC or Monster without any more headache. If you are tired to see your bot trying to find your NPC, but can't because someone is near you and he has the same color as your Script, so your bot keeps moving the mouse on this guy's monsters because he is the closest to them until he get's further away, until finally you gain priority to kill the monsters since your in the better spot. (unsure if this is the idea you are trying to convey/talk about)

Why Would you want to use This Method?
Well, I am not here to force you to use my method, but It is very effective. You can continue to use Simple Method like this:
if (findobjcustom(x,y,['Wilderness'],[2172972],5)) then
But like I said, if I come near you with the same color as your script, you will have a lot of fun watching your bot hovering the mouse on me trying to find the target as you can see on this Picture! --That I don't have :O-- (lol :P)

How to do it:
Basically, At the end of this tutorial, your function for finding the NPC will look like the function below. In this case, I was searching a NPC and I had to click and choose an option on him.
Function TalkingToMages: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, Width, Heigh); //Put the Width and Heigh here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA) > 5 Then // Set How Much Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA, X, Y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['age', 'amorak'])) then // Enter The name of Your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 15);
Break;
end;
end;
This may look scary for now, but it will become a lot easier after I explain [I]to you step by step, (of) hat to do!

Lets get started!
Step 1 : Get Your Color!
Since NPC's or Monsters move, you want to pick the color on his head; it will be a lot easier for your script to find out the NPC like that, because if you pick a color that is only visible on (the) chest (chest of the monster?) and your NPC cannot be found from the angle on the screen, then your function will return false as if there was no NPC.

For this reason, I decided to pick goblins as an example for this script.
http://img32.imageshack.us/img32/3542/goblinhead.png (http://imageshack.us/photo/my-images/32/goblinhead.png/)
As you see, the color of the head of this goblin is 5940087. For tolerance, it is pretty much testing what works best, I would always recommend starting with a tolerance of 7 and if you don't like the result, you can adjust it to your liking/which ever works for you. If you are wondering what happens when you reduce your tolerance, it will search for colors that are near to the one you picked. If you rise it, it will search for colors that are more likely the same as your color.

With your color and tolerance, you have to to put them into the function. Here is a picture on where to put them :
http://img836.imageshack.us/img836/3162/colorandtolerance.png (http://imageshack.us/photo/my-images/836/colorandtolerance.png/)

Step 2 : Get the Width and [I]Height
This is by far the most important part of this function. The end result will depend on how good you do it. So, let me explain how we get this. Did you always wonder how people were getting their distance in-game, since there is no option that tells us the exact distance between points? Well, there is a way to know how far each point is from each other and it is with picking the color. Before I explain how to do it, take a look at this picture I posted below:
http://img811.imageshack.us/img811/3618/mouseclick1.png (http://imageshack.us/photo/my-images/811/mouseclick1.png/)
http://img191.imageshack.us/img191/5078/mouseclick2.png (http://imageshack.us/photo/my-images/191/mouseclick2.png/)
Why are we doing this? We want to make a box, so when our script does the function, our character will find dots of our color and if there is enough dot to make the same box as us, the function will return true and he will click in the middle of the box. Now, lets get into the topic; how to get these values. As you can see, we don't see my mouse on the screen, so I made a red dot to indicate where my mouse was!

__________________________________________________ _____________

What you want to do: First, get beside your NPC (like I did) then click on Pick Color on Simba. The screen will freeze and that's exactly what we want. What we want to do is get the dimension of the head. As your see, I moved my mouse to what would be my bottom right corner and I took note of the coordinates that were in the red box(638,624). After, I did the same, but on the opposite side, so I moved my mouse to what would be my top left corner and took note of the coordinates (635,771). So, now do you see the box I was talking about?

The next step is to get the width and height. First, put the value of the same type together, so 638 with 635 and 624 with 771 = (638,635) and (624,771). If you are wondering why my second value is so high, it's because I took a picture and the coordinates from it (the picture), but I didn't place paint in the same arena as I took the coordinates with the first picture and it wasn't on the same place on my main screen, so I got coordinates that are wrong, but it won't happen if you do it on your playing screen. For this reason, we will change our 771 for 625. Now, it should be (638,635) and (624,625).

Why do we need these values? If you do 638 - 635 = 3 and this is our width. 624 - 625 = -1, but we can't have a negative value, so we turn it into a positive (value) by which I mean 1 and this is our height. Wow! We are almost done! Enter the width and height to their respective place shown on the picture below and when you script, use this function; (It will search for array that will allow him to make a box like this on this picture.)
http://img641.imageshack.us/img641/354/boxgoblin.png (http://imageshack.us/photo/my-images/641/boxgoblin.png/)
http://img269.imageshack.us/img269/4356/width.png (http://imageshack.us/photo/my-images/269/width.png/)

Step 3 - Get the Up Text
http://img23.imageshack.us/img23/693/uptext.png (http://imageshack.us/photo/my-images/23/uptext.png/)
As you see on the picture, when you move your mouse over the Goblin, there is an Up Text. Never use the first letter, because it will make it longer for your bot to detect, if it is the right NPC. So here is what our Up Text would be : "oblin" that we would add on here on this picture below.
http://img15.imageshack.us/img15/2900/nameez.png (http://imageshack.us/photo/my-images/15/nameez.png/)

So, Our Script Should look like this now
Function TalkingToMages: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5940048, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Height here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set how many points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['oblin'])) then // Enter the name of your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 15);
Break;
end;
end;

In this case, my function was click on a NPC that I had to talk and choose an option to teleport. Here, we want to attack a goblin so we are going to change the end of this function to attack instead of trying to find the option teleport on Goblin.

Function TalkingToMages: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5940048, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance here at the right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Height here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA) > 5 Then // Set how many Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['oblin'])) then // Enter the name of your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,true);
wait(5000 + random(1000));
Writeln('We have found our Goblin, Yeh!');
Break;
End;
until (Retry = 15);
Break;
end;
end;

Now, we are good. Also, I added what we call a FailSafe, so if the Script doesn't find the goblin after 15 [I]attempts, it will end. That's where you can enter in your script a procedure to walk to a new place to try to find another NPC or change the angle of the compass. This method can also be used to find Object in the(use "a" instead?) World; so I hope I helped you out to make a better Script with the ability to find NPC's way easier without any more trouble.

*I suppose some of the subjects/noun's could be left capitalized to illustrate your meaning in simba... However I edited to normal reading standards
*This is only meant to help, I think your work is excellent, and this revision is only if you think it will help flow more effectively to the readers :>
*Knowing me, I probably missed a couple things in here myself >.<

Nemesis3X
02-24-2012, 06:16 PM
Thanks Le Jingle, I did the modifications and it was appreciate :-).

I hope it helped you out for your Script. There is also Another one that I know, but I dislike it, since it works like FindObj, but You can play with The speed of Your Mouse and it failed sometime to Detect the NPC when Your mouse is actually on him! It always turn to the point where I come back to This method :-)

rice
02-25-2012, 06:27 AM
Good job man nice tutorial

cool13bro
02-26-2012, 10:54 PM
say we have a ranging script, and your looking for an npc, how would go about detecting the npc, while staying in your safe spot?

smurg
02-27-2012, 12:13 AM
Reading over the tut, it's a nice try, but there are some problems with the resulting procedure that are very wrong.

In no way does it find moving NPCs because it only fills the TPA once. Then it will step through the ATPA over and over even after an NPC has moved.

Nemesis3X
02-27-2012, 10:57 PM
Reading over the tut, it's a nice try, but there are some problems with the resulting procedure that are very wrong.

In no way does it find moving NPCs because it only fills the TPA once. Then it will step through the ATPA over and over even after an NPC has moved.

Yes, It will find the NPC on the First place, but if you are unlucky and He was moving when this function took place, It might Miss it! but after using the function, that why we always add a FailSafe to See if We did Click on the NPC on the first place.

That's why I wrote a little text at the end to Notify people when it miss, You need to add Something to be sure it has clicked on the NPC.



Now, we are good. Also, I added what we call a FailSafe, so if the Script doesn't find the goblin after 15 attempts, it will end. That's where you can enter in your script a procedure to walk to a new place to try to find another NPC or change the angle of the compass and try again.


My Ectoworship use this Same method and it works amazingly Good compare to the other I have tried if You want to Take a loop at how I did to make the Function Try again if it does ever Fail! The hard part is to get the Right Color and The Right Dimension of the box


say we have a ranging script, and your looking for an npc, how would go about detecting the npc, while staying in your safe spot?

That's a good question. As I see this, I would do a Procedure To check if We are still in the same zone using DTM that can only by visible on the Safepot after using the function.

Example :

Procedure AttackGoblin;
repeat
AttackGoblins; // That is my function
until (Animation = true); // This is my FailSafe, so the Function will be repeated until we are in combat!

if FindDTMrotated(...SafePot) then // Look if we are in the Right spot
begin
Writeln('We Are Good');
end else
begin
Writeln('We are in the wrong Place');
If FindDTMRotated(...GetToSagePot) then // Get to the Appropriate Spot
begin
Getmouse(x,y);
Mouse(x,y,3,3,true);
Flag(4);
AttackGoblin;
end;

smurg
03-07-2012, 12:27 AM
Yes, It will find the NPC on the First place, but if you are unlucky and He was moving when this function took place, It might Miss it! but after using the function, that why we always add a FailSafe to See if We did Click on the NPC on the first place.



Ya, but i'm saying that you are moving your mouse up to 15 times on a spot where a monster is not there anymore. That could take up multiple seconds after the monster has moved.

Nemesis3X
03-07-2012, 12:34 AM
Ya, but i'm saying that you are moving your mouse up to 15 times on a spot where a monster is not there anymore. That could take up multiple seconds after the monster has moved.

You're right. Didn't realize it, but this value is set to 2 in one case and 3 in the other one in my scripts. Thanks for the info, I will change it here too...

Mr Stoj
03-15-2012, 01:16 AM
thank you you this helped me figure out how to use the tzhaar bankers

Nemesis3X
03-15-2012, 01:20 AM
thank you you this helped me figure out how to use the tzhaar bankers

Np, happy to know it helped you out :-). But I will update this guide in 1 or 2 weeks. I changed a few things in this function and it is working way better and it does it faster!

Abu
03-24-2012, 07:28 PM
Hi, this is a very hand tutorial but....

It doesn't seem to be Retrying the procedure.

After Inc(Retry) I added a Writeln so I would know if it was actually repeating the procedure, but its wan't :s


P.S- I didn't change around the position of Inc(Retry)

Nemesis3X
03-27-2012, 07:10 PM
Hi, this is a very hand tutorial but....

It doesn't seem to be Retrying the procedure.

After Inc(Retry) I added a Writeln so I would know if it was actually repeating the procedure, but its wan't :s


P.S- I didn't change around the position of Inc(Retry)

mmm, Send me your function via pm and I will take a look and answer you back in 2-3 days as I am busy right now.

If you want my guess, There is only one box on the Screen, so the function can't loop since there isn't any other box present on the screen to try a new one.

ssshhhaaa
04-30-2012, 12:50 PM
Nice tutorial, but is there a way where you can detect a moving npc AND then follow the npc with the mouse then click it Instead of detecting a NPC then clicking it straight away (missing alot because it doesnt know its moving).

mike-gee420
06-05-2012, 04:38 AM
Thank you! finally, that much closer to finishing my animated armor script.
great tut!

randy marsh
04-28-2013, 05:25 PM
I get this problem?


//---------------------Talking to npc---------------------------------------------\\
Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;

Begin



CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5074312, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Heigh here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set How Much Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);// here is the problem :(
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['ring'])) then // Enter The name of Your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('rade'); //choose option 'trade'
wait(5000 + random(1000));
Break;
End;
until (Retry = 15);
Break;
end;
end;





[Error] (50:28): Unknown identifier 'x' at line 49
Compiling failed.


Line 49 is
MiddleTPAEx(TPAA[i], x, y);

Element17
04-28-2013, 07:34 PM
Do you have x and y defined anywhere in your script?

randy marsh
04-28-2013, 07:34 PM
cheeky bump this is holding me up

Sjoe
04-28-2013, 07:36 PM
cheeky bump this is holding me up

Do what Element17 said :) U didn't define your x and y

randy marsh
04-28-2013, 07:55 PM
Do what Element17 said :) U didn't define your x and y



As in put x, y, in variables?



//---------------------Talking to npc---------------------------------------------\\
Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
x, y,// here?

Begin

Sjoe
04-28-2013, 07:56 PM
As in put x, y, in variables?


Simba Code:
//---------------------Talking to npc---------------------------------------------\\
Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
x, y,// here?
Begin

yeah as integer;

randy marsh
04-28-2013, 08:03 PM
yeah as integer;

Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
x, y.
Begin




like
x, y.
or x, y:?

Sjoe
04-28-2013, 08:05 PM
Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
x, y.
Begin




like
x, y.
or x, y:?

Read this tutorial before u start scripting http://villavu.com/forum/showthread.php?t=58935

Explains the basic of pascal very well! (and what ya need to know to script)

randy marsh
04-28-2013, 08:06 PM
I have done like twice..

The Mayor
04-28-2013, 08:11 PM
I have done like twice..

Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry, x, y: Integer;

Begin


There you go :)

Sjoe
04-28-2013, 08:14 PM
Function TalkingToNpc: Boolean;

Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry, x, y: Integer;

Begin


There you go :)

U can't always feed the answers to the young'uns :(
Let them think!

randy marsh
04-28-2013, 08:14 PM
[Error] C:\Simba\Includes\SRL-OSR/SRL/core/text.simba(805:13): Unknown identifier 'UpChars07' at line 804
Compiling failed.

I did that now i get this error grrrrrrr

Sjoe
04-28-2013, 08:19 PM
[Error] C:\Simba\Includes\SRL-OSR/SRL/core/text.simba(805:13): Unknown identifier 'UpChars07' at line 804
Compiling failed.

I did that now i get this error grrrrrrr

Could u makie a thread, instead of posting this on a tutorial.

randy marsh
04-28-2013, 08:20 PM
ok sorry my bad

Sk1nyNerd
04-29-2013, 03:48 AM
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance);

how "safe" would you say it is clicking on an NPC's head every time? im trying to find a reliable solution to replace my

if FindObjCustom(jx, jy, ['omp', 'tition'], [judgecolor1, judgecolor2, judgecolor3], 5) then
begin
MMouse(jx,jy,0,0);
if IsUpTextMultiCustom(['omp', 'tition']) then
begin
ClickMouse2(mouse_left); //talk-to
judgefindtimer := 0;
writeln('');
DrawCustomPaint('Starting Competition', IntToStr(competitionsplayedcount), FloatToStr(expgained), IntToStr(ticketsgained), IntToStr(ctw), TimeRunning, FloatToStr(expperhour));
end;
end;

*jx,jy is MSCX,MSCY*

so it stops missclicking and attacking the nearby NPC's with the same colors- which i dont get why it does because the uptext doesnt match, only the color

randy marsh
04-29-2013, 05:34 PM
adjust tolerance?

Sk1nyNerd
05-01-2013, 01:40 AM
adjust tolerance?

what do you mean, the judge and guards are all the same color so adjusting tolerance wouldnt do anything?

Hoodz
05-18-2013, 11:42 PM
Is it possible to use more colours?
Edit: nice tutorial + repped

Janilabo
05-22-2013, 08:22 PM
Nice tutorial, Nemesis3X!

However, I noticed that SetToleranceSpeed2Modifiers() was missing from the code's - only ColorToleranceSpeed() (which is SetColorToleranceSpeed() in Simba) was set.
Looks like Nemesis3X has been inactive for months though, so it might take a while to get this tutorial updated/fixd. :\

Won
05-26-2013, 08:16 PM
Anyone know what my problem is here? When I run the script trying to teleport for rune mysteries, the mouse moves very slow and when it touches the head of Aubury, it just stops the script and doesn't right click.

program TestTeleport;
{$DEFINE SMART8}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}

Function FindAuburyAndTele: Boolean;
Var
TPAA: T2DPointArray;
TPA: TPointArray;
CTS, I, Retry: Integer;
X, Y: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 11908799, 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]) > 5 Then
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['ubury'])) then
Begin
Result := True;
GetMousePos(X, Y);
mouse(x, y, 3, 3, false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 7);
Break;
end;
end;

begin

FindAuburyAndTele

end.

Won
05-26-2013, 08:20 PM
Also how do I insert a simba code so the text is better?
21449

Won
05-28-2013, 06:17 AM
[Error] C:\Simba\Includes\SRL-OSR/SRL/core/text.simba(805:13): Unknown identifier 'UpChars07' at line 804
Compiling failed.

I did that now i get this error grrrrrrr

I got this same thing when trying to run a script that wasn't mine but I found a thread that fixes this.
http://villavu.com/forum/showthread.php?t=99577

rj
05-28-2013, 01:43 PM
Anyone know what my problem is here? When I run the script trying to teleport for rune mysteries, the mouse moves very slow and when it touches the head of Aubury, it just stops the script and doesn't right click.

program TestTeleport;
{$DEFINE SMART8}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}

Function FindAuburyAndTele: Boolean;
Var
TPAA: T2DPointArray;
TPA: TPointArray;
CTS, I, Retry: Integer;
X, Y: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 11908799, 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]) > 5 Then
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['ubury'])) then
Begin
Result := True;
GetMousePos(X, Y);
mouse(x, y, 3, 3, false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 7);
Break;
end;
end;

begin

FindAuburyAndTele

end.

You have to call setupSRL;

So your main loop would look like:

begin

setupSRL;
FindAuburyAndTele;

end.

Won
05-28-2013, 07:57 PM
You have to call setupSRL;

So your main loop would look like:

begin



setupSRL;
FindAuburyAndTele;

end.

Thanks that was a stupid mistake but the problem is now that it finds the NPC's head and quits. How can I test this without the script always opening a new client when I click "play"?

rj
05-28-2013, 08:14 PM
Thanks that was a stupid mistake but the problem is now that it finds the NPC's head and quits. How can I test this without the script always opening a new client when I click "play"?

You mean ActivateClient;

Or using SMART?

Won
05-29-2013, 03:32 AM
You mean ActivateClient;

Or using SMART?

Umm... I don't use the "ActivateClient;" but it opens up a new client each time. It's probably from the smart8. Here's what I use:
21483

rj
05-29-2013, 03:33 AM
Umm... I don't use the "ActivateClient;" but it opens up a new client each time. It's probably from the smart8. Here's what I use:
21483

Have you tried updating to SRL osr? And make sure SMART is enabled when you hit run