Random numbers in flex

360 Views Asked by At

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.

1

There are 1 best solutions below

1
Clive Spenser On

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