Hi, Vincent,
No, it's actually a List<String> events that is a property of that
GameStateController, not Event objects.
Ok I will workaround it, but I guess it may be a bug, because I think that
varArgs feature was not supported in 5.2.1, and is something new...
Best regards,
Martin
2012/1/17 Vincent Legendre <vincent.legendre(a)eurodecision.com>
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"
when
Event(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 logic
end
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 logic
end
which ends up with:
Caused by: org.drools.RuntimeDroolsException: Exception executing
predicate hasA
nyEventOccurred("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
listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users