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
mouseMoveCaptured with right mouse button - bug?
14 posts
• Page 2 of 2 • 1, 2
Re: mouseMoveCaptured with right mouse button - bug?
billv wrote:
- Code: Select all
def mouseLDown x,y
@mouse=0
captureMouse if @mouse = 0
end
def mouseRDown x,y
@mouse=1
captureMouse if @mouse = 1
end
def mouseMoveCaptured x,y
if @mouse==0 then
output 0,x
elsif @mouse==1 then
output 1,y
end
end
def mouseLUp x,y
releaseMouse if @mouse = 0
end
def mouseRUp x,y
releaseMouse if @mouse = 1
end
Don't quite get this. The 'if' statement doesn't check for a value but assigns either 0 or 1 (e.g. @mouse = 1, instead of @mouse == 1). But then you don't need an 'if'. The code line before would be sufficient.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: mouseMoveCaptured with right mouse button - bug?
billv wrote:(e.g. @mouse = 1, instead of @mouse == 1)
yeh...that' parts not needed it seems...and wrong anyway...
Still works fine without it. Thanks..
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: mouseMoveCaptured with right mouse button - bug?
billv wrote:yeh...I'm not sure why @mouse = 1 works here...still has me thinking a bit.....
That's because "if var = value" isn't an error of any kind. In ruby, var will be assigned the value and then checked if it's true, which is is of course ("var = value" will always be true). It doesn't harm in this case, since you intended to set the var to the value, but
- Code: Select all
@mouse = 0
captureMouse
is sufficient. And the last two should work with a double equal. Unless there's a severe issue with Ruby in Flowstone...
EDIT: Just saw your edited answer. Wrote this before, so I'll leave it, for others to read^^
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: mouseMoveCaptured with right mouse button - bug?
Thanks tulamide
I"m finding the release part is no good as well.....
So I've ended up with this...
I"m finding the release part is no good as well.....
So I've ended up with this...
- Code: Select all
def mouseLDown x,y
@mouse=0
captureMouse
end
def mouseRDown x,y
@mouse=1
captureMouse
end
def mouseMoveCaptured x,y
if @mouse==0 then
output 0,x
elsif @mouse==1 then
output 1,y
end
end
def mouseLUp x,y
releaseMouse
@mouse = 0
end
def mouseRUp x,y
releaseMouse
@mouse = 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
14 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 71 guests