Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Last Switch(Ruby)

For general discussion related FlowStone

Re: Last Switch(Ruby)

Postby billv » Tue Aug 06, 2013 8:53 pm

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... :?
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Last Switch(Ruby)

Postby chackl » Wed Aug 07, 2013 9:26 pm

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 :D

I created an example

Regards
Attachments
DATA_Switch_ruby.fsm
Ruby DATA last Switch example
(499 Bytes) Downloaded 888 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
User avatar
chackl
 
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Last Switch(Ruby)

Postby RJHollins » Thu Aug 08, 2013 6:07 am

Thanks for the RUBY example chackl.

Just being made aware of different possibilities helps
:D
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Last Switch(Ruby)

Postby billv » Thu Aug 08, 2013 7:19 am

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 :oops: :lol:
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Last Switch(Ruby)

Postby chackl » Thu Aug 08, 2013 8:26 am

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 :oops: :lol:


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
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
User avatar
chackl
 
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Last Switch(Ruby)

Postby RJHollins » Thu Aug 08, 2013 6:26 pm

Hi Chackl,

Please, I think you totally miss read Billv response :o

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.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Last Switch(Ruby)

Postby chackl » Thu Aug 08, 2013 6:49 pm

Sorry i read it a Little like "What do you want here..." :D
Sorry again :D - But since that there are thoes facebookkiddies are all over the Internet, you get also more "trash"-Help or comments on goog sites :D

Never mind :D - As an excusement i have another example here :D

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

Here we are :D
Code: Select all
output @ins

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

Sorry again :D

Regards
Attachments
switch_data_text.fsm
(8.17 KiB) Downloaded 855 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
User avatar
chackl
 
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Last Switch(Ruby)

Postby billv » Thu Aug 08, 2013 8:56 pm

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...
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Last Switch(Ruby)

Postby RJHollins » Thu Aug 08, 2013 9:18 pm

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 !
8-)
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 53 guests