AI 2008 Smart Event.

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

AI 2008 Smart Event.

#1 Post by kLabMouse »

I was planning to use this technology to make coding and performance better.
Technology itself is based on Utils::SmartCallbackList that is part of AI 2008 Project and used by AI::EnvironmentQueue

Technical Details:
System is based on Rules, callback function will run only when all the Rules will return 1;
Utils::SmartCallbackList->call function get a parameter: object
Object is a simple hash with no nested structures.

Example:
Adding new Callback with rules:

Code: Select all

my $rules = [(object => "obj_name1", type => "eq", against=> "something"),
                 (object => "obj_name2", type => "==", against=> 1)];
$SmartCallbackList->add($self, $rules, \&some_func, undef);

my $rules2 = [(object => "obj_name1", type => "eq", against=> "something new"),
                 (object => "obj_name2", type => "==", against=> 1)];
$SmartCallbackList->add($self, $rules2, \&some_func2, undef);
Calling by rule:

Code: Select all

my %check;
%check{obj_name1} = "something";
%check{obj_name2} = 1;
$SmartCallbackList->call($self, \%check);
The "call" function, will check whatever all rules match, and only then call our Callback.

All Questions and Suggestions are Welcome.

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: AI 2008 Smart Event.

#2 Post by kLabMouse »

Found some good Example and very good Implementation of such system inside CPAN.
System will update a bit, to handle more complex rules and structures.

Chontrad
Human
Human
Posts: 30
Joined: 23 Apr 2008, 10:11
Noob?: No
Location: Indonesia TANAH AIRKU
Contact:

Re: AI 2008 Smart Event.

#3 Post by Chontrad »

Well that's a GENIUS idea for me.(sorry if I'm a dumb)
I hope it gets implemented soon and i could learn sumthin new from it...

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: AI 2008 Smart Event.

#4 Post by kLabMouse »

Chontrad wrote:Well that's a GENIUS idea for me.(sorry if I'm a dumb)
I hope it gets implemented soon and i could learn sumthin new from it...
It's already Implemented in "AI 2008" Project.
But since it's not as perfect as it should be, it will be improved shortly.

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: AI 2008 Smart Event.

#5 Post by Technology »

kLabMouse, could you read last paragraph of this post and answer my question?
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!

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: AI 2008 Smart Event.

#6 Post by kLabMouse »

Technology wrote:kLabMouse, could you read last paragraph of this post and answer my question?
MM.... may-be I've had too much vodka yesterday, But where is that question anyway?

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: AI 2008 Smart Event.

#7 Post by Technology »

Na zdorovje :)
Technology wrote:Criticism on the condition system
if ($config{$prefix."_isGuildTitle"})
Kore should NOT have to check wether to use a condition or not every single time.
(wich it currently is, causing kore to hog extra resources)

It should be more like the macro plugin,
where hooks are only used when you actually want to use them in any of the automacro's.

An improvement on that would be: using a hook (or in skillblock, a condition) dependant on the skillblock options for each skillblock.
If i'm not mistaken, this is exactly what kLabMouse wants to do with smart events.
For example, we have a skill use block with some conditions.
We create a smart event for our bot to start a skill task,
in the smart event conditions checks we only put those condition checks that we want.
This way, kore simply knows wich condition checks to use,
compared to how it is now: kore needs to check wether to use a condition check first.
Less CPU overhead.
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!

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: AI 2008 Smart Event.

#8 Post by kLabMouse »

Technology wrote:
Technology wrote:Criticism on the condition system
if ($config{$prefix."_isGuildTitle"})
Kore should NOT have to check wether to use a condition or not every single time.
(wich it currently is, causing kore to hog extra resources)

It should be more like the macro plugin,
where hooks are only used when you actually want to use them in any of the automacro's.

An improvement on that would be: using a hook (or in skillblock, a condition) dependant on the skillblock options for each skillblock.
If i'm not mistaken, this is exactly what kLabMouse wants to do with smart events.
For example, we have a skill use block with some conditions.
We create a smart event for our bot to start a skill task,
in the smart event conditions checks we only put those condition checks that we want.
This way, kore simply knows wich condition checks to use,
compared to how it is now: kore needs to check wether to use a condition check first.
Less CPU overhead.
Yep. That's one of "Smart Events" use cases.

Edit:
Smart Events are more global thing. It's like Conditional hooks to Environment.

Post Reply