0

so im just getting to grips with flex and fuzzy logic. I wanted to create a simple chat system where based on what your choice of dialogue is the NPC would change what they say, but i want to make it a bit more unique and it currently gets the same output all the time.

rule mood_dialogue2
    if the_mood is hello
    then the_mood becomes 30 .

rule mood_dialogue3
    if the_mood is  'you`re an ogre?!'
    then the_mood becomes 50 .

As you can see the same numbers are input so i wanted to randomise this part within a range for example dialogue2 between 30 and 49 and dialogue3 between 50 and 100. i attempted this within something i saw in some documentation

then the_mood becomes irand(25) + 1 .

but i know that doesnt work as it actually stores`"irand(25) + 1" in the_mood

Thanks for any help.

Mike Tarrant
  • 291
  • 2
  • 7
  • 19

1 Answers1

0

Try rand NOT irand

| ?- X is irand(25) + 1 .

! ----------------------------------------
! Error 50 : Function Not Defined
! Goal     : _36394 is irand(25) + 1

Aborted
| ?- X is rand(25) + 1 .
X = 13.1864792832639
jnovack
  • 7,629
  • 2
  • 26
  • 40
  • Im afraid it did not work. i got this error after it ran, and let me select my options etc. it closed with this error. `Rule : determine_dialogue_crisp_value has misfired ! Context stack: ! ---------------------------------------- ! Error 1998 : Unknown Error ! Goal : flex_runtime_error ` – Mike Tarrant Apr 10 '13 at 20:04