Reset a numeric value to a default

Caelshadowhunter's picture

Can anybody think of a way to reset a numeric value to a definable default when a change node outputs a YES value?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

idlefon's picture
Re: Reset a numeric value to a default

There are two easy ways, I can think of:

1- Javascript patch: with a simple conditional phrase like

function (__number output) main (__boolean input, __number DefaultNumber) { var result = new Object(); if (input==true) {result.out=DefaultNumber;} return result; }

if you go with JS you'll not need any conditional patch.

2- You can make the desired number a Multiple of 1, so when the conditional patch outputs True(1) you'll have the desired number.

Caelshadowhunter's picture
Re: Reset a numeric value to a default

Perhaps I didn't phrase my question too well. What I mean is that I want to be able to input a numeric value to be put into a composition (if possible, via a publishable input). However on occasion a pulse node might bang out a 'true' value. If this were to occur, I would like QC to automatically overwrite the input numeric with a default, and then to continue to operate normally, allowing the user to change the numeric value. The difficulty orrises in the fact that I cant just switch between the user input and default values. The user should be able to amend the default value after a 'true' value has been banged out.... It's a little difficult to explain :(

Sorry to waste your time.

idlefon's picture
Re: Reset a numeric value to a default

ok. I think I get what you want. I attached a comp that does what you said except one thing: after you reset to a default value, you can not reset the user value to 0, this because you can not send a command To a splitter, you can only get data FROM the splitter ( I think). check the comp and see if this is what you want.

PreviewAttachmentSize
Reset to default vlue.qtz5.97 KB

goto10's picture
Re: Reset a numeric value to a default

Maybe I'm not understanding what you're trying to achieve exactly, but wouldn't a multiplexer suffice for this?

Caelshadowhunter's picture
Re: Reset a numeric value to a default

THANKS. The patch uploaded by Idlefon was exactly what I was after XD.