checkExtraCondition
Moderator: Moderators
-
- Been there done that!
- Posts: 143
- Joined: 25 Oct 2008, 08:14
- Noob?: No
- Location: Spain, Madrid
- Contact:
Re: checkExtraCondition
EDITSo, I've finished my macro thingy and I'd love to put my hands on this, but sadly my knowledge is not really good to do it. I can do it by macro but it wouldn't fix the real problem, so, I can try to make the condition if I get some advice on it... ._.
-
- Super Moderators
- Posts: 801
- Joined: 06 May 2008, 12:47
- Noob?: No
Re: checkExtraCondition
You could start from the checkExtraCondition plugin
Look in the dev doc's for Misc::checkLineWalkable
We will be using the checkLineWalkable sub that is exported by the Misc package so we add in the checkExtraCondtion plugin: use Misc qw(checkLineWalkable);
checkLineWalkable(from, to, [min_obstacle_size = 5])
from: is our current location: $char->{pos}
to: is the location we will be walking to when we are facing to the current direction with a defined range. (range ex. line_walkable 5) current position +/- range x y
min_obstacle_size: in our case is 0 afaik. (this is only a check for non walkable blocks, thus not monsters, we do monsters/players in a different check)
Look in the dev doc's for Misc::checkLineWalkable
We will be using the checkLineWalkable sub that is exported by the Misc package so we add in the checkExtraCondtion plugin: use Misc qw(checkLineWalkable);
checkLineWalkable(from, to, [min_obstacle_size = 5])
from: is our current location: $char->{pos}
to: is the location we will be walking to when we are facing to the current direction with a defined range. (range ex. line_walkable 5) current position +/- range x y
min_obstacle_size: in our case is 0 afaik. (this is only a check for non walkable blocks, thus not monsters, we do monsters/players in a different check)
in other words, min_obstacle_size must be 0 (its 5 when we do not define this parameter)kore src comments wrote:# The current spot is not walkable. Check whether
# this the obstacle is small enough.
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...
Mount Doom awaits us, fellowship of OpenKore!
One ST_kRO to bring them all and in the darkness bind them...
Mount Doom awaits us, fellowship of OpenKore!
-
- Been there done that!
- Posts: 143
- Joined: 25 Oct 2008, 08:14
- Noob?: No
- Location: Spain, Madrid
- Contact:
Re: checkExtraCondition
I'd gladly do it with the checkExtraCondition because really all it's needed is a condition that checks obstacles. I've done a "provisional" fix and I posted it here -> Configuring Taekwon/Star Gladiator, but, of course a condition block would be faster and would take less time to work, it also wouldn't be interrupted by other macros and shit...
The real problem is that I feel the macro I did would work better "now" than the block, because I've been having problems with the attackComboSlot block. It NEVER does my Taekwon combos or stop running in time, and I had to rely in macros to make it do the damn Tumbling & Flying Kick combo correctly, or to redo Sprint to get the spurt status in time.
That's why, I wanna do this condition because then I can learn a lot, but I think it wouldn't be useful at all till there's a fix on the attackComboSlot thing.
That said, I'll try o start doing it, but if not I'll do on next week, holidays ftw. xD
The real problem is that I feel the macro I did would work better "now" than the block, because I've been having problems with the attackComboSlot block. It NEVER does my Taekwon combos or stop running in time, and I had to rely in macros to make it do the damn Tumbling & Flying Kick combo correctly, or to redo Sprint to get the spurt status in time.
That's why, I wanna do this condition because then I can learn a lot, but I think it wouldn't be useful at all till there's a fix on the attackComboSlot thing.
That said, I'll try o start doing it, but if not I'll do on next week, holidays ftw. xD
Re: checkExtraCondition
tested with eval condition
credits to Technologyor maybe this eval check is already included somewhere...
copied this from ezza's eval Automacro condition.
you can now incorporate Misc::checkLineWalkable with this eval now.
not tested for further errors
but test with eval $char->{name} eq "iamanoob"
credits to Technology
Code: Select all
# checkExtraCondition by Technology
#
# $Id: checkExtraCondition.pl 6603 2008-11-21 16:48:56Z Technology $
#
# This source code is licensed under the
# GNU General Public License, Version 2.
# See http://www.gnu.org/licenses/gpl.html
package checkExtraCondition;
use strict;
use Plugins;
use Globals qw(%config $char);
use Utils qw(inRange);
use Utils::DataStructures qw(existsInList);
use Log qw(message error warning debug);
Plugins::register('checkExtraCondition', 'check extra conditions', \&onUnload);
my $hooks = Plugins::addHooks(
['checkSelfCondition', \&checkSelfCondition, undef],
['checkPlayerCondition', \&checkPlayerCondition, undef],
['checkMonsterCondition', \&checkMonsterCondition, undef],
);
sub onUnload {
Plugins::delHooks($hooks);
}
sub checkSelfCondition {
my ($self, $args) = @_;
my $prefix = $args->{prefix};
# conditions
($args->{return} = 0) unless (
checkActorLevel($prefix, $char) &&
checkActorGuildTitle($prefix, $char) &&
checkEval($prefix)
);
debug ("self: $args->{return}\n"), "checkExtraCondition";
}
sub checkPlayerCondition {
my ($self, $args) = @_;
my $prefix = $args->{prefix};
my $player = $args->{player};
# conditions
($args->{return} = 0) unless (
checkActorLevel($prefix, $player) &&
checkActorGuildTitle($prefix, $player) &&
checkEval($prefix)
);
debug ("player: $args->{return}\n"), "checkExtraCondition";
}
sub checkMonsterCondition {
my ($self, $args) = @_;
my $prefix = $args->{prefix};
my $player = $args->{monster};
# conditions
debug ("monster: $args->{return}\n"), "checkExtraCondition";
}
#######################################
#######################################
### CONDITION FUNCTIONS
#######################################
#######################################
sub checkActorLevel {
my ($prefix, $actor) = @_;
if ($config{$prefix . "_blvl"}) { return 0 unless inRange($actor->{lv}, $config{$prefix."_blvl"}); }
else { return 1 }
}
sub checkActorGuildTitle {
my ($prefix, $actor) = @_;
if ($config{$prefix."_isGuildTitle"}) { return 0 unless ($actor->{guild} && existsInList($config{$prefix . "_isGuildTitle"}, $actor->{guild}{title})); }
else { return 1 }
}
sub checkEval {
my ($prefix, $actor) = @_;
if ($config{$prefix . "_eval"}) {
return eval $config{$prefix . "_eval"};}
}
return 1;
copied this from ezza's eval Automacro condition.
you can now incorporate Misc::checkLineWalkable with this eval now.
not tested for further errors
but test with eval $char->{name} eq "iamanoob"
DARKest Ninja
Re: checkExtraCondition
Is using this plugin the same thing as adding base level and guildTitle conditions to checkSelfCondition from Misc.pm?
Quit.