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
RUBY - XY Surface
23 posts
• Page 2 of 3 • 1, 2, 3
Re: RUBY - XY Surface
Appreciated...
I had changed the variables to lower case... But still doesn't work.
I noticed that this works:
@sx=getViewSize;
But this doesn't:
@sx=getViewSize[0];
Why can;t I assign @sx to be a single variable out of an array ?
I had changed the variables to lower case... But still doesn't work.
I noticed that this works:
@sx=getViewSize;
But this doesn't:
@sx=getViewSize[0];
Why can;t I assign @sx to be a single variable out of an array ?
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: RUBY - XY Surface
You can assign a single variable from an array, and it is done just as you tried it. If it doesn't work it could mean you previously used the same variable for an array. However, wild guessing won't help you. Prepare a schematic that shows your issue, so that we can have a look. I wouldn't know how else to help.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: RUBY - XY Surface
In your fsm Rocko, there's a redraw in the draw section.
I think it also helps to define the @vw and @vh in the draw section.
For eg: This works fine...
I think it also helps to define the @vw and @vh in the draw section.
For eg: This works fine...
- Code: Select all
def isInMousePoint x,y
true
end
def mouseLDown x,y
captureMouse
end
def mouseMoveCaptured x,y
if x > @vw then output 0, x = @vw end
if x < 0 then output 0, x = 0 end
if y > @vh then output 1, y = @vh end
if y < 0 then output 1, y = 0 end
output 0, @x=x
output 1, @y=y
redraw
end
def mouseLUp x,y
releaseMouse
end
def draw v
@vh = v.height-1
@vw = v.width-1
pen = Brush.new @c1,0.2
v. drawEllipse pen,[@x,@y,1,1]
end
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: RUBY - XY Surface
Hi,
Your help to offer is really appreciated. Here is my code for your reference.
Your help to offer is really appreciated. Here is my code for your reference.
- Attachments
-
- XY_Test_v4.fsm
- (1.44 KiB) Downloaded 1098 times
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: RUBY - XY Surface
hmm ... Now I've lost track ... Is there still a problem ???
Seems to work as expected here.
The only thing I suggest ... if the window is re-sized, everything recalculates and places the 'select ball' in field.
Seems to work as expected here.
The only thing I suggest ... if the window is re-sized, everything recalculates and places the 'select ball' in field.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: RUBY - XY Surface
Hi,
Notice this line with the '#' mark:
#@sx=getViewSize[0]; //This is the problematic line
If you remove the # to make it active. Then restart the FSM, it doesn't start and reports an error.
Notice this line with the '#' mark:
#@sx=getViewSize[0]; //This is the problematic line
If you remove the # to make it active. Then restart the FSM, it doesn't start and reports an error.
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: RUBY - XY Surface
Hey Rocko,
this fix should work. It was like I said, you try to access the view before it is initialized. Another tip: always use methods, don't just declare variables somewhere in the RubyEdit. The right place for this is a method called init. In this case a variation is used: Instead of initializing the vars at init of the RubyEdit, I use an afterload trigger to run another method (you can name this method as you see fit). This way I make sure that the view already exists before you access it via getViewSize.
this fix should work. It was like I said, you try to access the view before it is initialized. Another tip: always use methods, don't just declare variables somewhere in the RubyEdit. The right place for this is a method called init. In this case a variation is used: Instead of initializing the vars at init of the RubyEdit, I use an afterload trigger to run another method (you can name this method as you see fit). This way I make sure that the view already exists before you access it via getViewSize.
- Attachments
-
- XY_Test_v4 [tula].fsm
- (1.45 KiB) Downloaded 1071 times
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: RUBY - XY Surface
Hi,
This is working great and now better understood. Appreciated
Currently @cx and @cy are initialized after load. This might contradict saving it in 'flowstones preset' (which I usually use to save VST data like knob and slider values).
Any hints on how to save @cx and @cy from last read - on DAW (like preset auto save mode)?
This is working great and now better understood. Appreciated
Currently @cx and @cy are initialized after load. This might contradict saving it in 'flowstones preset' (which I usually use to save VST data like knob and slider values).
Any hints on how to save @cx and @cy from last read - on DAW (like preset auto save mode)?
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: RUBY - XY Surface
If you use this method:
the variables will be initialized when the RubyEdit is initialized. They can then be easily overwritten by an input from the preset manager (presets update after load). You do that by extending the already existing event method:
- Code: Select all
def init
#initialize @cx/@cy here
end
the variables will be initialized when the RubyEdit is initialized. They can then be easily overwritten by an input from the preset manager (presets update after load). You do that by extending the already existing event method:
- Code: Select all
#assuming there are two inputs named px and py that are sent from the preset
def event i, v
if i == 'px'
@cx = v
redraw
elsif i == 'py'
@cy = v
redraw
end
end
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: RUBY - XY Surface
Does somebody know how to make a loop in ruby for multiple objects?
- clemensweinhold
- Posts: 2
- Joined: Wed Apr 08, 2015 7:06 pm
23 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 95 guests