Page 1 of 2

where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 7:30 pm
by tester
Question. Where/how in such thing add trigger blocking, so that the random generator does not produces output when input (values) is changed? And I don't mean clickable S&H on all inputs or on output; the question is - how to block generating itself, so that randomizer produces results only on request.

Re: where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 8:29 pm
by billv
blocker_fix.fsm
(684 Bytes) Downloaded 1048 times

Re: where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 8:39 pm
by tester
We misunderstood. The problem is, that whatever change on whatever value-based input (first 3 inputs) - produces trigger that generates output. I'd like to avoid that. But also I'd like to avoid multiple generations (if S&H is connected to each individual input - that sort of things will happen). So - individual silent changes on all 3 inputs, and trigger only on demand.

Re: where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 9:06 pm
by trogluddite
You need to do this inside the Ruby itself...
blocker V2.fsm
(703 Bytes) Downloaded 1117 times

The 'i' variable is the index of the input that has just caused an 'event'. Triggers on other inputs will still update the values of their variables, but by 'filtering' the 'i' value, won't cause any of the array output code to run.
You can't really do the same using 'external' trigger blockers, because the triggers are necessary in order for Ruby to know when to update the '@' variable values (there are no "backwards" triggers from Ruby prim's to request the current values).

You could also give the trigger input a name, and use its name for the 'i' comparison...
if i == "trigger_input" ...etc...
...this is safer, because the name won't change if you add/delete/re-order the inputs, whereas the numeric index might change if you decide to update the module. The 'i' parameter has a special data type that is both number and string, so you can mix numeric indexes and names any way you like.

Re: where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 9:34 pm
by tester
Okay, thanks. I suspected that it must be something within ruby code.

I need to gather my thoughts...

Re: where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 9:50 pm
by trogluddite
Yeah, the "no backwards trigger" thing is unlike almost all the other prim's. It's caught me out quite a few times!

Re: where/how to add trigger blocker here

Posted: Thu Oct 03, 2013 10:16 pm
by tester
Generally the whole "ruby thing" is a headache maker for me. I'm so used to simple visual modularity, that when I watch at ruby and it's syntax, I simply feel dumb... I don't know if I'm able to cross that borderline.

Re: where/how to add trigger blocker here

Posted: Fri Oct 04, 2013 12:12 am
by Nubeat7
tester wrote:Generally the whole "ruby thing" is a headache maker for me. I'm so used to simple visual modularity, that when I watch at ruby and it's syntax, I simply feel dumb... I don't know if I'm able to cross that borderline.

come on, its you TESTER, you will! just open your mind for it :) the good thing is, after you got some basics it really makes fun exploring it, and its an endless world to test out, and you will see that things become more and more easy with it also more easy than making it the "graphical" way, and after some time you want to program everything in ruby, and i`m still at the beginning, just writing my first own methods.. just give yourself a little time and do small and easy code, it starts to grow by itself then ;)

Re: where/how to add trigger blocker here

Posted: Fri Oct 04, 2013 12:28 am
by billv
mis-understood

Sorry tester...didnt read question properly.

Re: where/how to add trigger blocker here

Posted: Fri Oct 04, 2013 12:41 am
by tester
Nubeat7 wrote:come on, its you TESTER, you will! just open your mind for it :) the good thing is, after you got some basics it really makes fun exploring it, and its an endless world to test out, and you will see that things become more and more easy with it also more easy than making it the "graphical" way, and after some time you want to program everything in ruby, and i`m still at the beginning, just writing my first own methods.. just give yourself a little time and do small and easy code, it starts to grow by itself then ;)


It's just too much for me. Open mind is not a trash. :lol: I repeat over and over - I do these little things in order to use created stuff. My fun is there. Having yet another syntax to deal with - I'm overloaded. If you remember the story/paradox of Pinocchio I posted recently, then you know what kind of computations are on my everyday basis... It's just difficult to flip back to things like... ruby :mrgreen:

BTW - are in nature "divisions by zero" (in terms of programming solutions) present? ;-)