Hi, Vincent,
May be drool cannot support variable length arguments in methods. But, seeing your rules, I think you should change the way you match your events objects by exploiting drools syntax and RETE instead of calling predicates.
If I understand well, you are creating a game, and this rule should trigger when the player achives some goals to pass him to next level.
So I guess that your GameStateController contains a set of Event objects ?
If yes, I recommend inserting directly the event in the session, and write a rule like this :
rule "quest_reach_level_1_in_any_category_accomplished"whenEvent(id == "eventId")
not Event(id == "otherEventId")
exists Event(id == "param1" || "param2" || "param3" .... etc etc)
$gsc : GameStateController() // if you still need it, consider adding it as a global
$response : Response() // if you can, set it as global
then... some business logicend
Note that it is solving the problem of varaible length argument, using the fact that you can add easily new terms to a boolean expression.
Le 17/01/2012 19:23, Martin A a écrit :Hello, guys,
I've got a rule which states:
rule "quest_reach_level_1_in_any_category_accomplished"when$gsc : GameStateController(hasEventOccurred("eventId") && !hasEventOccurred("otherEventId") && hasAnyEventOccurred("param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8", "param9", "param10", "param11", "param12"))$response : Response()then... some business logicend
which ends up with:
Caused by: org.drools.RuntimeDroolsException: Exception executing predicate hasAnyEventOccurred("level1_love", "level1_friendship", "level1_prosperity", "level1_charisma", "level1_willpower", "level1_wisdom", "level1_entertainment", "level1_adventure", "level1_inspiration", "level1_harmony", "level1_lightheartedness","level1_confidence")at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
I'm using Drools 5.3.0.Final and it fails when it comes to evaluating the predicate hasAnyEventOccurred(String... varArgs).
Thanks,Martin
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users