Created: around 09-07-2001
Last update: around 09-07-2001
Back Previous Next

2) randomized stuff

so, let's say you want a doll who had multiple facial features, or says different things, or anything that involves multiple possible reactions.

randomizing is tricky! here's how I do it.

let's say you want your doll to smile, frown, and yawn randomly, in addition to her normal expression.

make three .cels, "smile.cel," "frown.cel," and "yawn.cel"

in your FkiSS:

after the @initialize(), put this:

;@unmap("smile.cel")
;@unmap("frown.cel")
;@unmap("yawn.cel")
;@ timer(1,100)

after the @begin(), put this:

;@ alarm(1)
;@ unmap("smile.cel")
;@ unmap("frown.cel")
;@ unmap("yawn.cel")
;@ randomtimer(2,100,5000)
;@ randomtimer(3,100,5000)
;@ randomtimer(4,100,5000)

;@ alarm(2)
;@ timer(3,0)
;@ timer(4,0)
;@ map("smile.cel")
;@ randomtimer(1,100,5000)

;@ alarm(3)
;@ timer(2,0)
;@ timer(4,0)
;@ map("frown.cel")
;@ randomtimer(1,100,5000)

;@ alarm(4)
;@ timer(3,0)
;@ timer(2,0)
;@ map("yawn.cel")
;@ randomtimer(1,100,5000)

you can add as many other .cels to this as you want, but remember that the first @randomtimer() will start first and so if you add a lot, the later ones will hardly ever go off. you can solve this a couple ways.

some people make the lower number for the earlier timers a little higher, like @randomtimer( 2,150,5000) and then @randomtimer(5,200,5000).

I like to make new timers that are called after a .cel is mapped that only start timers for the other .cels & not the one that just mapped, like this

;@alarm(4)
;@timer(2,0)
;@timer(3,0)
;@ timer(5,0)
;@map ("yawn.cel")
;@ randomtimer(2,100,5000)
;@ randomtimer(3,100,5000)
;@ randomtimer(5,100,5000)

;@alarm(5)
;@timer(2,0)
;@timer(3,0)
;@ timer(4,0)
;@map ("grimace.cel")
;@ randomtimer(2,100,5000)
;@ randomtimer(3,100,5000)
;@ randomtimer(4,100,5000)

notice how in the one for @alarm(4), there is no @randomtimer(4,100,5000) and in the one for @alarm(5), there is no @randomtimer(5,100,5000). this keeps the same facial expression from happening twice in a row!





Back Previous Next