Page 2 of 2
Re: Last Switch(Ruby)
Posted: Tue Aug 06, 2013 8:53 pm
by billv
RJHollins wrote:Obviously, still struggling to get a handle on the basics of RUBY. I'm hitting those posted RUBY sites to get familiar. My only programming 'experience' was using GFABasic on the ATARI ST back in the 80's.
Ruby sites are great for info....but for me it seems to be better just experimenting in FS.
I only know a little VB..so i know how you feel..trying to get a grip on this ruby monster...not easy..
RJHollins wrote:... i, firstsignal, secondsignal
Sounds like you almost made a "selector" here, using that "i" input..
Try using a boolean signal for that "i" input....and you'll see that "def event" thing more clearly..
Small question mark on "Output 0,V" method....
What if different inputs arrive at exactly the same time...???
There's no instruction in the code for this...what will ruby do?
I'm guessing its so remote it's a non-issue...not sure...

Re: Last Switch(Ruby)
Posted: Wed Aug 07, 2013 9:26 pm
by chackl
Just what i found out with ruby:
If you "add" ruby signals by linking them to the same Point a ruby Signal will not be added - It will "last-Switch"
I think this is great because it is much easier if you have to handle a lot of Switches

I created an example
Regards
Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 6:07 am
by RJHollins
Thanks for the RUBY example chackl.
Just being made aware of different possibilities helps

Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 7:19 am
by billv
chackl wrote:I created an example
So now were down to "output @in"...cool...
I'm glad i never showed some of earlier attempts at it

Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 8:26 am
by chackl
billv wrote:chackl wrote:I created an example
So now were down to "output @in"...cool...
I'm glad i never showed some of earlier attempts at it

Just for your (personal) Note:
It is working and it is simple
If you do have any problems with it - DO NOT USE IT OR DO NOT MIND!
Or: CREATE SOMETHING BETTER
But please keep your useless advices for yourself or go to Facebook with that ^^
EDIT:
Sorry for those hard word - You are right it is NOT the developement of century ^^
This Example is should just to show how FlowStone calculates ruby-links.

Regards
Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 6:26 pm
by RJHollins
Hi Chackl,
Please, I think you totally miss read Billv response
The evolution of this 'Last Switch' code is now down to a single line ... that is some optimization !
Personally, I've had similar 'shock' as a piece of RUBY code that I've been working on ... and then see one of the GURU's reduce it down to a few statements ....
I've NOT wanted to post my version in comparison.
Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 6:49 pm
by chackl
Sorry i read it a Little like "What do you want here..."

Sorry again

- But since that there are thoes facebookkiddies are all over the Internet, you get also more "trash"-Help or comments on goog sites

Never mind

- As an excusement i have another example here

With ruby you are not eaven able to Switch data very easy - you are also able to find out where the data came from

Here we are

This code Outputs als conected data to an Array - just one more letter ^^
Sorry again

Regards
Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 8:56 pm
by billv
chackl wrote:Sorry i read it a Little like "What do you want here.
Forget it...you've just miss interpreted..apology accepted
billv wrote:So now were down to "output @in"...cool...
Thats just me saying "Great, the code has been simplified even more"
The "cool" statement can be defined in context as "happy,content or impressed"
billv wrote:I'm glad i never showed some of earlier attempts at it
This line pays respect to the creator(s) of these simplified codes, by indicating how bad
my earlier attempts were.
Thanks for latest example...
Re: Last Switch(Ruby)
Posted: Thu Aug 08, 2013 9:18 pm
by RJHollins
These are the type of CODE examples that I want to put into the 'Code Librarian' that one of the GURUs posted here for the 'ToolBox'.
Great stuff !
