Page 1 of 1
targetting NPC
Posted: Wed Aug 19, 2009 1:25 pm
by j_schlott
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
Re: targetting NPC
Posted: Wed Aug 19, 2009 1:35 pm
by Administrator
Open player.lua and go to line 1618. You'll see this:
Try adding yrest(500); right above that then save it. See if that resolves your problem and let me know.
Re: targetting NPC
Posted: Wed Aug 19, 2009 1:38 pm
by j_schlott
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
did work
Re: targetting NPC
Posted: Wed Aug 19, 2009 1:42 pm
by Administrator
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.
Re: targetting NPC
Posted: Wed Aug 19, 2009 2:17 pm
by j_schlott
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)
Re: targetting NPC
Posted: Wed Aug 19, 2009 3:13 pm
by d003232
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
And be sure you stand in front of the NPC, not to close, facing it.
Re: targetting NPC
Posted: Wed Aug 19, 2009 5:04 pm
by Administrator
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.
Re: targetting NPC
Posted: Mon Aug 24, 2009 5:22 am
by d003232
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
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.
Re: targetting NPC
Posted: Mon Aug 24, 2009 10:42 am
by j_schlott
his title is "Resident Doctor"
and targetting "Highly" did work, so thats got to be part of his name
Re: targetting NPC
Posted: Mon Aug 24, 2009 10:44 am
by d003232
j_schlott wrote:his title is "Resident Doctor"
and targetting "Highly" did work, so thats got to be part of his name
Where is he standing?
Re: targetting NPC
Posted: Mon Aug 24, 2009 12:03 pm
by j_schlott
hes in the middle of Logar, about 20 feet from the Daily Board
right next to the general merchant npc