Hi guys,
One quick question. Is there a way you can talk to an NPC using its ID numbers rather than using its coordinates?
We have an event quest in pRO wherein you can only complete by talking twice to an NPC located on a single spot everyday for fourteen consecutive days. The weird thing is, my bot can detect 14 NPCs having the same names but different ID numbers on a single spot; and, only one of them is visible and able to respond. I tried talking to the visible NPC using its coordinates like "do talknpc 229 310 c c n" but the NPC that my bot was talking to did not respond. I am certain that my bot talked to the invisible NPC instead of the visible one. Perhaps the only proficient way to do this is to use the NPC's ID numbers as a variable to talk to a specific NPC.
I surmise that this has something to do with Perl so I would like to seek advice from those who are expert and familiar with the variable needed to commence this. Thanks.
HELP: Talk to an NPC using its ID numbers
Moderators: Moderators, Documentation Writers
-
- Human
- Posts: 25
- Joined: 04 Jun 2011, 18:29
- Noob?: Yes
- Location: pRO Payon
HELP: Talk to an NPC using its ID numbers
What have you done so far?
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: HELP: Talk to an NPC using its ID numbers
If you know server's NPC ID (displayed in "nl"):
Also you would need to use "talk" as "talknpc" only accepts coordinates currently.
Code: Select all
nl
-----------NPC List-----------
# Name Coordinates ID
0 Mailbox (146, 86) 55561
1 Kafra Employee (146, 89) 55658
---------------------------------
eval Log::message(Actor::get(pack 'V', 55658)->{binID})
1
talk 1
Kafra Employee: [Kafra Employee]
Kafra Employee: Welcome to the
Kafra Employee: Kafra Corporartion.
-
- Human
- Posts: 25
- Joined: 04 Jun 2011, 18:29
- Noob?: Yes
- Location: pRO Payon
Re: HELP: Talk to an NPC using its ID numbers
Here it is:
I changed autoTalkCont from 0 to 1 since the NPC does not require you to respond.
I just can't understand this "pack 'V'" function as of this moment but I will learn it eventually.
Thanks a bunch Eternal. You helped me again =)
Code: Select all
automacro Listen to Daily Mass {
timeout 6
location prontera 218 320
call {
$id = 50635
$x = @eval (Actor::get(pack 'V', $id)->{binID})
do talk $x
}
}
I just can't understand this "pack 'V'" function as of this moment but I will learn it eventually.
Thanks a bunch Eternal. You helped me again =)
Last edited by Uzah on 19 Dec 2011, 23:45, edited 1 time in total.
What have you done so far?
-
- Moderators
- Posts: 1197
- Joined: 16 Dec 2011, 02:53
- Noob?: No
- Location: Brazil
Re: HELP: Talk to an NPC using its ID numbers
In your macro,is necessary a 'return' on @eval no ?automacro Listen to Daily Mass {
timeout 6
location prontera 218 320
call {
$id = 50635
$x = @eval (Actor::get(pack 'V', $id)->{binID})
do talk $x
}
}
So :
Code: Select all
$x = @eval (return Actor::get(pack 'V', $id)->{binID})
do talk $x
Learn rules
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: HELP: Talk to an NPC using its ID numbers
It's Perl's eval, so:SkylorD wrote:In your macro,is necessary a 'return' on @eval no ?
In both forms, the value returned is the value of the last expression evaluated inside the mini-program; a return statement may be also used, just as with subroutines.
-
- Moderators
- Posts: 1197
- Joined: 16 Dec 2011, 02:53
- Noob?: No
- Location: Brazil
Re: HELP: Talk to an NPC using its ID numbers
I'am confused.I understand that you say,but...
Why in the macros,like this :
Is because that a macro works with packet and others with bot information (hp of bot) ?
Thanks for answer
Why in the macros,like this :
I know create plugins,and macros.automacro ok {
weight > 50%
call {
$hp = @eval (return $::char->{hp})
Is because that a macro works with packet and others with bot information (hp of bot) ?
Thanks for answer

Learn rules
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: HELP: Talk to an NPC using its ID numbers
Eh?SkylorD wrote:Is because that a macro works with packet
Everything inside @eval is not macro plugin related (except that it does macro variable substitution first, which can screw it well too).
-
- Moderators
- Posts: 1197
- Joined: 16 Dec 2011, 02:53
- Noob?: No
- Location: Brazil
Re: HELP: Talk to an NPC using its ID numbers
Oh,finally.This logic has entered in my brain.Is because that a macro works with packet
Eh?
Everything inside @eval is not macro plugin related (except that it does macro variable substitution first, which can screw it well too).
Thanks,Thanks.
Learn rules