Page 1 of 1

drag drop, location, not sure about syntax

Posted: Fri Jan 29, 2010 11:06 pm
by Just4Fun
Hello Again:

I've been spending another frustration filled day with Rev. I'm trying to fight through the fact that this program has no decent documentation for beginners. At the moment, I'm pretty sorry that I ever purchased the software. It cost a lot of money on my budget. I assumed that it would have excellent documentation. What I've found is that the documentation is scattered around in so many places, that I spend hours searching. The dictionary is fine for someone who already somewhat understands the syntax, but there are no code snips included therein so it doesn't help me much. :(

At any rate, my problem today is that I am trying to figure out how to apply a drag and drop feature in a small "Match" quiz. Here is what I'd like to be able to do:

Drag my image onto another image. If they match then the dragged image is allowed to drop. If they don't match, the image snaps back to its original location.

I've searched the forum and found a couple of examples that I couldn't apply successfully. They used the location command. I couldn't get them to work properly for my need. I tried using the resources code example of dropping the colors from a pallet onto an object. That didn't work. I've tried searching the GMANE list for help. Found nothing.

If anyone could post some simple code snips that would put me in the right direction, I'd really appreciate it.

grab
loc
drag
drop

TIA
Rachel

Re: drag drop, location, not sure about syntax

Posted: Fri Jan 29, 2010 11:58 pm
by bn
Rachel,
I did a simple stack a while ago which is a starting point for a puzzle.
I append it here.
Re frustration: I remember having these times even with better documented environments then Rev, it's part of the game. The more you will enjoy when it finaly works... :)
regards
Bernd

Re: drag drop, location, not sure about syntax

Posted: Sat Jan 30, 2010 2:00 am
by Just4Fun
Bless you Bernard. I will dig into the sample stack right away.

-Rachel

Re: drag drop, location, not sure about syntax

Posted: Sat Jan 30, 2010 3:02 pm
by bn
Rachel,
I modified the stack a little so it behaves more like I think you will want it. The original request was for "automatic" pic-up of the puzzle piece.
In this version you have to click at a puzzle piece then it follows the mouse until it either hits the right destination image or if it hits a wrong destination image it slides back to the original position.
Dont be confused with the private properties that are set. A private property is a way to store information in any Rev object.
Try this. It might be easier. Now it brings the puzzle piece that is moved around so it is not covered by any other image.
You still have to initialize the puzzle once you arranged the location of the puzzle pieces and their destination. It all expects a certain naming convention, the pieces to move around must have the name "puzzlepiec" with an unique number at the end as in "puzzlepiece1" and a corresponding image with the name "finalposition1".
I hope this gets you further. The first version was just too sketchy.
regards
Bernd

Re: drag drop, location, not sure about syntax

Posted: Sun Jan 31, 2010 6:39 pm
by mwieder
Also, I posted a primer on drag and drop a while back. You might want to check it out:

http://lessons.runrev.com/spaces/lesson ... t-a-primer

Re: drag drop, location, not sure about syntax

Posted: Sun Jan 31, 2010 9:58 pm
by bn
Hi Rachel,
I start to worry about you ... :) Still frustration?
The only thing I can offer is yet another version of the puzzle starter kit.
Now with 20% more fancyness...
And with a 50% reduction in price, before it was free, now it is a spectacular 50% more free. (Though you will not ever get a bonus for downloading it :( , that is not our buisiness model)

regards
Bernd

Re: drag drop, location, not sure about syntax

Posted: Fri Feb 05, 2010 4:25 pm
by bn
I posted colorpuzzle to RevOnline that arose from this thread.
I posted it also as a revlet
http://berndniggemann.on-rev.com/colorpuzzle/
Rachel, if you are still following this thread: I commented the scripts of the stack extensively. If you have questions, just ask.
regards
Bernd