doCommand plugin

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
fco2783
Plain Yogurt
Plain Yogurt
Posts: 95
Joined: 05 Apr 2008, 05:15
Noob?: Yes
Location: in place where you cant go
Contact:

doCommand plugin

#1 Post by fco2783 »

tested can be use on Openkore v2.0.0 to 2.0.5.2

Code: Select all

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
}
Other sub-condition can be use...

Code: Select all

	maxUses
	target

	* (Target Monster Conditions)
	lvl
	maxCastTime
	minCastTime
	equip

	* (Target Monster Conditions)
	aggressives
	defendMonsters
	disabled
	hp
	inCart
	inInventory
	inLockOnly
	monsters
	notInTown
	notMonsters
	notOnAction
	notInMap
	notWhileSitting
	onAction
	inMap
	partyAggressives
	sp
	spirit
	stopWhenHit
	timeout
	whenFlag
	whenFollowing
	whenGround
	whenIdle
	whenNotFlag
	whenNotGround
	whenNotPermitSkill
	whenPermitSkill
	whenStatusActive
	whenStatusInactive
	whenWater

	* (Target Monster Conditions)
	target_deltaHp
	target_dist
	target_misses
	target_timeout
	target_totalMisses
	target_whenGround
	target_whenNotGround
	target_whenShieldEquipped
	target_whenStatusActive
	target_whenStatusInactive
	target_whenWeaponEquipped

h4rry84
Moderators
Moderators
Posts: 234
Joined: 04 Apr 2008, 09:30
Noob?: Yes
Location: My House
Contact:

Re: doCommand plugin

#2 Post by h4rry84 »

this plugin already obsolete in the next evrsion of openkore as it already implemented as openkore's maincode

fco2783
Plain Yogurt
Plain Yogurt
Posts: 95
Joined: 05 Apr 2008, 05:15
Noob?: Yes
Location: in place where you cant go
Contact:

Re: doCommand plugin

#3 Post by fco2783 »

h4rry84 wrote:this plugin already obsolete in the next evrsion of openkore as it already implemented as openkore's maincode
OHHH... i did not know that.. sorry.. please delete this post then... thanks...

h4rry84
Moderators
Moderators
Posts: 234
Joined: 04 Apr 2008, 09:30
Noob?: Yes
Location: My House
Contact:

Re: doCommand plugin

#4 Post by h4rry84 »

i said in the next version ( >_>) and it not been released yet

Mucilon
Cybernatic Entity
Cybernatic Entity
Posts: 249
Joined: 04 Apr 2008, 13:15
Noob?: Yes
Location: Brazil

Re: doCommand plugin

#5 Post by Mucilon »

h4rry84,
couldn't we increment this code, so it could execute randomically one command, among n commands...
Like this:

Code: Select all

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!?

iamanoob
Plain Yogurt
Plain Yogurt
Posts: 82
Joined: 04 Apr 2008, 09:49

Re: doCommand plugin

#6 Post by iamanoob »

Mucilon wrote:h4rry84,
couldn't we increment this code, so it could execute randomically one command, among n commands...
Like this:

Code: Select all

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

BTW,
when will be next version release?? XD
Image
DARKest Ninja

h4rry84
Moderators
Moderators
Posts: 234
Joined: 04 Apr 2008, 09:30
Noob?: Yes
Location: My House
Contact:

Re: doCommand plugin

#7 Post by h4rry84 »

it would be better if it comes with the toggles, like this maybe

Code: Select all

doCommand e thx; e ok; c thanks; c xD {
whenStatusActive Blessing
timeout 120
random 1
}

Mucilon
Cybernatic Entity
Cybernatic Entity
Posts: 249
Joined: 04 Apr 2008, 13:15
Noob?: Yes
Location: Brazil

Re: doCommand plugin

#8 Post by Mucilon »

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:

Code: Select all

doCommand e thx; e ok; c thanks; c xD {
whenStatusActive Blessing
timeout 120
random 0
}
Or should it execute them all? Then we should have a time delay among the commands. Something like:

Code: Select all

doCommand e thx; e ok; c thanks; c xD {
whenStatusActive Blessing
timeout 120
random 0
exeDelay 2
}

Mucilon
Cybernatic Entity
Cybernatic Entity
Posts: 249
Joined: 04 Apr 2008, 13:15
Noob?: Yes
Location: Brazil

Re: doCommand plugin

#9 Post by Mucilon »

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!

Code: Select all

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;
EDIT: This code is working, I already test it!!

Mucilon
Cybernatic Entity
Cybernatic Entity
Posts: 249
Joined: 04 Apr 2008, 13:15
Noob?: Yes
Location: Brazil

Re: doCommand plugin

#10 Post by Mucilon »

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.

Code: Select all

doCommand c nice; e common; c die...;c why don't you just die;c get out {
	timeout 1
	seed 5
}
EDIT: Forget about this last change, it doesn't work as i wanted...

Locked