Page 1 of 1

AI 2008 Smart Event.

Posted: 03 Dec 2008, 07:11
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.

Re: AI 2008 Smart Event.

Posted: 04 Jan 2009, 09:18
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.

Re: AI 2008 Smart Event.

Posted: 02 Feb 2009, 07:00
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...

Re: AI 2008 Smart Event.

Posted: 02 Feb 2009, 07:03
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.

Re: AI 2008 Smart Event.

Posted: 23 Mar 2009, 08:12
by Technology
kLabMouse, could you read last paragraph of this post and answer my question?

Re: AI 2008 Smart Event.

Posted: 23 Mar 2009, 08:35
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?

Re: AI 2008 Smart Event.

Posted: 23 Mar 2009, 08:56
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.

Re: AI 2008 Smart Event.

Posted: 23 Mar 2009, 08:59
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.