targetting NPC

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

targetting NPC

#1 Post by j_schlott » Wed Aug 19, 2009 1:25 pm

posted i was having problems with target_NPC in my other post, and i thought i had fixed it, but it stills does the same thing, its cycles through several npcs and pcs including the one i want it to find, but it does not stop pressing nearest ally after it targets him or try to open his chat window

Code: Select all

<waypoints>
   <!-- # 1 --><waypoint x="-640" z="-5824" type="RUN">
      player:mouseclickL(420, 280, 825, 582);   <!-- open Blackboard -->  
      player:mouseclickL(420, 280, 825, 582);   <!-- open Blackboard -->     
      player:mouseclickL(150, 210, 825, 582);   <!-- spider quest -->
      player:mouseclickL(150, 380, 825, 582);   <!-- accept quest -->
   </waypoint>
   <!-- # 2 --><waypoint x="-740" z="-5857" type="RUN">
      player:target_NPC("Highly-skilled Doctor")
      player:rest(.5); 
      player:mouseclickL(150, 320, 825, 582);   <!-- complete quest -->
      player.free_counter1 = player.free_counter1 + 1;
      if(player.free_counter1 == 10) then
         player:sleep();
      end;
   </waypoint>
</waypoints>
this is a macro to hand in spider dailies in logar, i originally had it scan for the Highly-skilled Doctor which works well, but that adds quite a bit of time to the process

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: targetting NPC

#2 Post by Administrator » Wed Aug 19, 2009 1:35 pm

Open player.lua and go to line 1618. You'll see this:

Code: Select all

player:update();
Try adding yrest(500); right above that then save it. See if that resolves your problem and let me know.

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: targetting NPC

#3 Post by j_schlott » Wed Aug 19, 2009 1:38 pm

well i got it working, i think it had something to do with the hyphen in the npcs name

Code: Select all

 player:target_NPC("Highly-skilled Doctor")
did not work

but

Code: Select all

 player:target_NPC("Highly")
did work

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: targetting NPC

#4 Post by Administrator » Wed Aug 19, 2009 1:42 pm

Ok, I think I know what the problem is. On line 1626, there is this:

Code: Select all

			if( string.find(string.lower(target.Name), string.lower(_npcname) ) ) then
Change it to:

Code: Select all

			if( string.lower(target.Name == string.lower(_npcname) ) then
Let me know if this works.

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: targetting NPC

#5 Post by j_schlott » Wed Aug 19, 2009 2:17 pm

Change it to:

Code: Select all

         if( string.lower(target.Name == string.lower(_npcname) ) then
the bot will not start with that in the code,

error "...scripts/rom/classes/player.lua:1626: ')' expected near 'then'"

i added a ) at the end to make it:

Code: Select all

         if( string.lower(target.Name == string.lower(_npcname) ) ) then
which let me run the bot and seemed to work and DID target the correct npc but then gets an error without opening the npcs chat window:

scripts/rom/classes/player.lua:1626: bad argument #1 to 'lower' (string expected got, got boolean)

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: targetting NPC

#6 Post by d003232 » Wed Aug 19, 2009 3:13 pm

Administrator wrote:Ok, I think I know what the problem is. On line 1626, there is this:

Code: Select all

			if( string.find(string.lower(target.Name), string.lower(_npcname) ) ) then
Change it to:

Code: Select all

			if( string.lower(target.Name == string.lower(_npcname) ) then
Let me know if this works.
That would not find parts of NPC names. In the most cases it is just ok to give a part of the NPC name to the function. Like you did with

Code: Select all

player:target_NPC("Highly")
And be sure you stand in front of the NPC, not to close, facing it.
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: targetting NPC

#7 Post by Administrator » Wed Aug 19, 2009 5:04 pm

My mistake. Try this:

Code: Select all

if( string.lower(target.Name) == string.lower(_npcname) ) ) then
For an exact match.

Or, this:

Code: Select all

if( string.find(string.lower(target.Name), string.lower(_npcname), 1, true) ) then
To accept partial or full matches.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: targetting NPC

#8 Post by d003232 » Mon Aug 24, 2009 5:22 am

j_schlott wrote:well i got it working, i think it had something to do with the hyphen in the npcs name

Code: Select all

 player:target_NPC("Highly-skilled Doctor")
did not work

but

Code: Select all

 player:target_NPC("Highly")
did work
I just want to look after that problem. So I'm on the search for a npc with special chars in the name. By doing that, I detect, that you are looking for 'Highly-skilled Doctor'. I strongly suppose, that's not the name of a npc. I looks more like a title. The function 'target_NPC' will only search for the name.
The RoM Bot Online Wiki needs your help!

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: targetting NPC

#9 Post by j_schlott » Mon Aug 24, 2009 10:42 am

his title is "Resident Doctor"

Image

and targetting "Highly" did work, so thats got to be part of his name

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: targetting NPC

#10 Post by d003232 » Mon Aug 24, 2009 10:44 am

j_schlott wrote:his title is "Resident Doctor"

Image

and targetting "Highly" did work, so thats got to be part of his name
Where is he standing?
The RoM Bot Online Wiki needs your help!

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: targetting NPC

#11 Post by j_schlott » Mon Aug 24, 2009 12:03 pm

hes in the middle of Logar, about 20 feet from the Daily Board

right next to the general merchant npc

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests