If you want to avoid the intermediate knob, you can use tcl's "expression"
command directly in the Text's message knob:

  [expression {180 + (random(frame-(frame%5)) * (181.1-180))}]


On Tue, Dec 13, 2011 at 6:11 PM, Ben Dickson <[email protected]> wrote:

> Least convoluted way I can see to do this is make a user-knob and put
> the random expression in there
>
> set cut_paste_input [stack 0]
> version 6.3 v5
> push $cut_paste_input
> Text {
>  message "\[value randval]"
>  font /usr/share/fonts/bitstream-vera/Vera.ttf
>  yjustify center
>  box {512 389 1536 1167}
>  center {1024 778}
>  name Text1
>  selected true
>  xpos 162
>  ypos -298
>  addUserKnob {20 User}
>  addUserKnob {7 randval R 180 181.1}
>  randval {{"180 + (random(frame) * (181.1-180))"}}
> }
>
> ..otherwise doing it only [ ] in the Text value seems strangely difficult
>
> On 12/12/11 20:20, stoutch wrote:
> > Hi All,
> > I'm trying to use the random function inside the message of a text node,
> > but I always receive an error message (function not defined). I've just
> > started using expressions and python, and maybe I'm doing something
> > wrong that should be really simple.
> > What I need is to have the text node to write a random number between
> > 180.0 and 181.1 changing every 5 frames.
> > Thank you
> > Alan Stucchi
> >
> >
> > _______________________________________________
> > Nuke-python mailing list
> > [email protected], http://forums.thefoundry.co.uk/
> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
> --
> ben dickson
> 2D TD | [email protected]
> rising sun pictures | www.rsp.com.au
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to