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.
package doCommand;
# This plugin is licensed under the GNU GPL
# Copyright 2005 by kaliwanagan
# --------------------------------------------------
use strict;
use Plugins;
use Globals;
use Log qw(message warning error);
use Misc;
use Utils;
use Commands;
use Time::HiRes qw(time);
Plugins::register('doCommand', 'do a command on certain conditions', \&Unload);
my $hook = Plugins::addHook('AI_post', \&doCommand);
sub Unload {
Plugins::delHook('AI_post', $hook);
}
my $time;
sub doCommand {
my $prefix = "doCommand_";
for (my $i =0; (exists $config{$prefix.$i}); $i++) {
if ((main::checkSelfCondition($prefix.$i)) && main::timeOut($time, $config{$prefix.$i."_timeout"})) {
Commands::run($config{$prefix.$i});
$time = time;
}
}
}
return 1;
Usage
doCommand ai clear {
timeout 3500
}
doCommand e thx {
whenStatusActive Blessing
timeout 120
}
doCommand e heh {
whenStatusActive Increase AGI
timeout 120
}
doCommand e no1 {
whenStatusActive Kyrie Eleison
timeout 120
}
doCommand e thx; e ok; c thanks; c xD {
whenStatusActive Blessing
timeout 120
}
This kind of code already exist, we just need to implement. If you want, I can change the plugin and test it!
I think this kind of reaction, should be much more real...
Or maybe the code implemented to the next version already do that!?
doCommand e thx; e ok; c thanks; c xD {
whenStatusActive Blessing
timeout 120
}
This kind of code already exist, we just need to implement. If you want, I can change the plugin and test it!
I think this kind of reaction, should be much more real...
Or maybe the code implemented to the next version already do that!?
i agree
randomizations on human reactions such as this doCommand should be implemented
and should be included
I was thinking in something more automatic... Like if there are more then one it will be randomized. If not, it will execute the only one command.
I mean, how should it work like this:
Guys,
I changed the plugin, now it will randomize the commands. You just need to separete them with ; I didn't test it yet, so use it at your own risc. As soon as I get at home (about 6 hours from now), I'll test it!
package doCommand;
# This plugin is licensed under the GNU GPL
# Copyright 2005 by kaliwanagan
# Version 0.1 - 22/04/2008
# --------------------------------------------------
use strict;
use Plugins;
use Globals;
use Log qw(message warning error);
use Misc;
use Utils;
use Commands;
use Time::HiRes qw(time);
Plugins::register('doCommand', 'do a command on certain conditions', \&Unload);
my $hook = Plugins::addHook('AI_post', \&doCommand);
sub Unload {
Plugins::delHook('AI_post', $hook);
}
my $time;
sub doCommand {
my $prefix = "doCommand_";
for (my $i =0; (exists $config{$prefix.$i}); $i++) {
if ((main::checkSelfCondition($prefix.$i)) && main::timeOut($time, $config{$prefix.$i."_timeout"})) {
my $cmdlist = $config{$prefix.$i};
my @cmds = split(/\s*;+\s*/, $cmdlist);
if (scalar(@cmds) > 1) {
my $cmd = $cmds[int(rand(@cmds))];
Commands::run($cmd);
} else {
Commands::run($config{$prefix.$i});
}
$time = time;
}
}
}
return 1;
I made another change, now I included the seed option to randomize some time to execute the commands...
I didn't test it yet, the server I normally bot is off line now.
Ex.:
This code can be executed in 1 to 6 seconds randomically.