responseOnNPCImage "response base on NPC Image" by abt123

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
Pseudocode
Noob
Noob
Posts: 7
Joined: 02 Aug 2008, 23:43
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#41 Post by Pseudocode »

Hehe!! I also have a working one.....anyways what did I do is trimming ???? down the plugins....then use a macro hooks to get the image (e.g bkd0,bkd9,bkd2) the macro do the talk num 092...

n3o
Noob
Noob
Posts: 3
Joined: 18 Jul 2009, 06:30
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#42 Post by n3o »

are there any new updates regarding the anti bot for myRO? all the 3 images are recognized but only the last image was used by the plugin. is there any solution for this problem? thanks in advance.
Image

rpichay
Human
Human
Posts: 20
Joined: 02 Sep 2009, 02:49
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#43 Post by rpichay »

can anyone please help us with using this for myRO?? because the plugin only answers the third image.. not the all three..

dooms
Noob
Noob
Posts: 2
Joined: 10 Jun 2008, 15:30
Noob?: No

Re: responseOnNPCImage "response base on NPC Image" by abt123

#44 Post by dooms »

can anyone reupload the plugin files please.. i cant download it..

kayuputih
Noob
Noob
Posts: 13
Joined: 17 Sep 2008, 18:15
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#45 Post by kayuputih »

@kakai

I wonder if u give clues about adding twice "next" in the plugins, sir.. :)
Because my OK just answers
the last number only, instead of 3..

This is my console log, really need your help guys..
Attachments
console.txt
(60.97 KiB) Downloaded 483 times

atemaster
Noob
Noob
Posts: 2
Joined: 26 Sep 2009, 07:14
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#46 Post by atemaster »

i'm not download this plugin

kayuputih
Noob
Noob
Posts: 13
Joined: 17 Sep 2008, 18:15
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#47 Post by kayuputih »

*bump*

Mucilon we really need ur help here.. :(

Mortimal
Developers
Developers
Posts: 389
Joined: 01 Nov 2008, 15:31
Noob?: No

Re: responseOnNPCImage "response base on NPC Image" by abt123

#48 Post by Mortimal »

Smb can give me that plugin) just want to read)

and respImageTable.txt pls...
Please use pin function for uploading your file contents!

kayuputih
Noob
Noob
Posts: 13
Joined: 17 Sep 2008, 18:15
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#49 Post by kayuputih »

This is it..

Credit to: abt123

Code: Select all

#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################

###########################
# responseOnNPCImage v1.0.1
#
# (C)2007 abt123
# For OpenKore 1.9.x
#
# NOTE: This plugin meant to be use with hakore's reactOnNPC
#

package responseOnNPCImage;

use strict;
use Plugins;
use Globals qw(%talk);
use Commands; #qw(run register unregister)
use Settings; # qw(addConfigFile delConfigFile);
use FileParsers qw(parseDataFile);
use Log qw(message error);
use I18N qw(bytesToString);

my %imageTable;
my $imageName;
my @NPCresponses;

Plugins::register('responseOnNPCImage', 'respose base on NPC Image', \&onUnload);
my $cmd = Commands::register(['talkImage', 'talk response by image', \&cmdTalkImage]);
my $hooks = Plugins::addHooks(
        ['packet/npc_image', \&onNPCImage],
        ['packet_pre/npc_talk_number', \&onNPCTalkInput],
        ['packet_pre/npc_talk_text', \&onNPCTalkInput],
        ['packet/npc_talk_responses', \&onNPCResponses]
);
my $imgf = Settings::addControlFile('respImageTable.txt', loader => [\&parseDataFile, \%imageTable]);

sub onUnload {
        Plugins::delHooks($hooks);
        Commands::unregister($cmd);
        Settings::removeFile($imgf);
        undef %imageTable;
        undef $imageName;
        undef @NPCresponses;
}

sub onNPCImage {
        my (undef, $args) = @_;
        $imageName = bytesToString($args->{npc_image});
        return unless $imageName;
        message "[responseOnNPCImage] Image name >> \"$imageName\"\n", "info";
}

sub onNPCTalkInput {
        my (undef, $args) = @_;
        $talk{ID} = $args->{ID};
}

sub onNPCResponses {
        my (undef, $args) = @_;
        my $msg = I18N::bytesToString(unpack("Z*", substr($args->{RAW_MSG}, 8)));
        @NPCresponses = ();
        my @preTalkResponses = split /:/, $msg;
        foreach my $response (@preTalkResponses) {
                $response =~ s/\^[a-fA-F0-9]{6}//g;
                push @NPCresponses, $response if ($response ne '');
        }
}

sub cmdTalkImage {
        my (undef, $args) = @_;
        my $cmd = '';

        if ($args !~ /resp|num|text/) {
                error "Syntax Error in function 'talkImage' (Talk to NPC base on NPC image)\n" .
                        "Usage: talkImage <resp | num | text>\n";
                return;
        }
        if ($imageName eq '') {
                error "[responseOnNPCImage] Doesn't seen any image yet!\n";
                return;
        }
        if (defined $imageTable{$imageName} && $imageTable{$imageName} ne '') {
                if ($args eq 'num') {
                        $cmd = "talk num $imageTable{$imageName}";
                } elsif ($args eq 'text') {
                        $cmd = "talk text $imageTable{$imageName}";
                } elsif ($args eq 'resp') {
                        message "[responseOnNPCImage] Match \"$imageTable{$imageName}\" to response list.\n", "info";
                        my $i = 0;
                        foreach (@NPCresponses) {
                                last if ($_ =~ /$imageTable{$imageName}/i);
                                $i++;
                        }
                        if ($i < (scalar @NPCresponses)) {
                                $cmd = "talk resp $i";
                        } else {
                                error "[responseOnNPCImage] Can not match \"$imageTable{$imageName}\" to response list.\n";
                                message "[responseOnNPCImage] You must response by yourself now!\n", "info";
                        }
                }
        } else {
                if ($args eq 'num') {
                        if ($imageTable{'imageNameEqual'} eq 'num') {
                                $cmd = "talk num $imageName";
                        } else {
                                error "[responseOnNPCImage] Image name not equal to number.\n";
                                message "[responseOnNPCImage] You must response by yourself now!\n", "info";
                        }
                } elsif ($args eq 'text') {
                        if ($imageTable{'imageNameEqual'} eq 'text') {
                                $cmd = "talk text $imageName";
                        } else {
                                error "[responseOnNPCImage] Image name not equal to text.\n";
                                message "[responseOnNPCImage] You must response by yourself now!\n", "info";
                        }
                } elsif ($args eq 'resp') {
                        if ($imageTable{'imageNameEqual'} eq 'resp') {
                                message "[responseOnNPCImage] Match \"$imageName\" to response list.\n", "info";
                                my $i = 0;
                                foreach (@NPCresponses) {
                                        next unless $_;
                                        last if ($_ =~ /$imageName/i);
                                        $i++;
                                }
                                if ($i < (scalar @NPCresponses)) {
                                        $cmd = "talk resp $i";
                                } else {
                                        error "[responseOnNPCImage] Can not match \"$imageName\" to response list.\n";
                                        message "[responseOnNPCImage] You must response by yourself now!\n", "info";
                                }
                        } else {
                                error "[responseOnNPCImage] Image name not equal to response choice.\n";
                                message "[responseOnNPCImage] You must response by yourself now!\n", "info";
                        }
                }
        }

        if ($cmd ne '') {
                message "[responseOnNPCImage] Executing command \"$cmd\".\n", "success";
                Commands::run($cmd);
                $imageName = '';
        }
}

return 1;
Still, facing the same problem, hope someone here could help..

Edit: Attached the plugin.

oOmYuOo
Noob
Noob
Posts: 1
Joined: 27 Nov 2009, 01:38
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#50 Post by oOmYuOo »

^
^
^
that file is must be in .pl format how to make a .pl format for it to work on plugins can anyone help?

Post Reply