The "time" functin in AI.pm

This place is for Closed bug reports only. NOT for asking help!

Moderators: Moderators, Developers

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

The "time" functin in AI.pm

#1 Post by sofax222 »

The codes that calling the "time" functin, such as :
statement in sub ai_SkillUse

Code: Select all

sub ai_skillUse {
	return if ($char->{muted});
	my %args = (
		skillHandle => shift,
		lv => shift,
		maxCastTime => { time => time, timeout => shift },
		minCastTime => { time => time, timeout => shift },
		target => shift,
		y => shift,
		tag => shift,
		ret => shift,
		waitBeforeUse => { time => time, timeout => shift },
		prefix => shift
	);
	$args{giveup}{time} = time;
	$args{giveup}{timeout} = $timeout{ai_skill_use_giveup}{timeout};

	if ($args{y} ne "") {
		$args{x} = $args{target};
		delete $args{target};
	}
	AI::queue("skill_use", \%args);
}
The lines:
maxCastTime => { time => time, timeout => shift },
minCastTime => { time => time, timeout => shift },
waitBeforeUse => { time => time, timeout => shift },
$args{giveup}{time} = time;

They will get incorrect time value, the decimal is truncated.
And then, the "timeOut" will get wrong result from these time values.

So, the AI.pm should add a line "use Time::HiRes qw(time);" after "use strict;", such as :

Code: Select all

......
# moved into this package.

package AI;

use strict;
use Time::HiRes qw(time);
use Globals;
use Utils qw(binFind);
........
After adding the "use Time::HiRes qw(time);" line.
I make my Monk bot has most 90% ComboSkill, even more high !
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: The "time" functin in AI.pm

#2 Post by kLabMouse »

Nice!
Approved.
somebody Commit it please.

P.S.:
Would you like to Join our Dev Team?
EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: The "time" functin in AI.pm

#3 Post by EternalHarvest »

In r7674.
We need to check other modules for this issue too.
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: The "time" functin in AI.pm

#4 Post by kLabMouse »

BTW. I think that 'time' should be used only once per block.
Everything else, is copies of the first one.
sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "time" functin in AI.pm

#5 Post by sofax222 »

kLabMouse wrote:Nice!
Approved.
somebody Commit it please.

P.S.:
Would you like to Join our Dev Team?
I would like to join OpenKore Dev Team.....
But, I have no much time.
I play and modify openkore off work.

What is the duty, to be a Dev Team member ?
The "Join our Team" seems to be locked up !!
I already reply to Love Openkore? Join the team!.