First, I don't know what "?s" is. If it's a variable defined at the prompt, don't do that. It won't work reliably in Jess 6, and isn't even possible in Jess 7 (the fact that it's possible in Jess 6 is unintentional.)

Otherwise, there's nothing wrong here, per se. Every time an update- scores fact is asserted, the count will be set to a new value. Of course, once an "update-scores 10" fact exists, you can't assert another one until the original is retracted, so you might want to do that in the update-scores rule.

On Jan 31, 2007, at 6:40 AM, M Ismail wrote:

hi,

im trying to add a number to another number which keeps increasing on every rule

that is what i have:

(defrule fight
(object knife)
  =>
(assert (Fight))
(assert (update-scores 10))
(printout t "Fight !" crlf)
)

(defrule update-scores
  (update-scores ?c)
  =>
 (call ?s setAgr (+ (call ?s getAgr) ?c)))

and i want it to be something like:
score starts with 0

and when rule fight is fire then it should add 10 so the final score is 10

and if another rule is fired it will add also 10 and then the final score is 20 etc...

how can i do that?  what i have  now is just replacing and not adding

best regards,

m.ismail

_________________________________________________________________
Veilig & gerust mailen met de verbeterde antivirusscan van Live Mail! http://imagine-windowslive.com/mail/launch/default.aspx? Locale=nl-nl

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify owner-jess- [EMAIL PROTECTED]
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550                 http://www.jessrules.com

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to