First time here? Check out the FAQ!
x

How can I save an EventVariable in the presets?

+1 vote
370 views

Hi there,

I'm using this code in a constant:

| index |

index := EventVariable new initialValue: 0.5.

20 ms tick evaluate: (
(index <+ (((!ForwardsBackwards sign) eq: 1) true: (index + (!ForwardsBackwards squared * 0.005)) false: index)),
(index <+ (((!ForwardsBackwards sign) eq: -1) true: (index - (!ForwardsBackwards squared * 0.005)) false: index))),
(index mod: 1) * 2 - 1

It works exactly like I want but the value of index is not saved in the presets... Any ideas how I can work around that?

Thanks! 

asked May 11, 2016 in Capytalk & Smalltalk by kymaguy (Virtuoso) (10,580 points)
Since index is not an EventValue, it's not going to be captured in any presets.  There are two things you would have to do: first, you have to generate an EventValue, say !Index (with one of the STGC flavors).  Then you have to modify the Capytalk code to inject the value of !Index into your variable called index.

1 Answer

0 votes
 
Best answer
Not sure if this is what you meant but I solved it by placing the capyTalk code into a MultiplexableSTGC and checking SaveInPresets. Working fine :) Thanks!
answered May 12, 2016 by kymaguy (Virtuoso) (10,580 points)
...