I tried your solution, but there is no change when sprite undo is done. Basically go to frame does not update the sprite to its previous location. Is there any simpler method to achieve undo redo operations.
if you change the location of a sprite you'll have to store the actual and the original position/size/rotation ( all you can change) of all changable sprites.
on clicking your undo button you can restore the last changes by setting the sprite's last parameters
repeat with spritecount = firstsprite to lastsprite --( the changeables)
You have to save the sprites positions in a lists for that.
then you set the loch and locV of your sprites when you need them :
example if you return to frame 2 :
sprite(1).locH = my_sprite1_position_H
sprite(1).locV = my_sprite1_position_V
Thanks, finally i was able to create undo operation in lingo! Lists are very helpfull in lingo, i got to know these just after coding undo action, i was able to create with counters and two lists.
Here is just sample i did, not too great though!
global clicklist, counter, undolist, undocounter
on mouseUp me
-- store values in variables for undo operation
spriteName = undolist.getAt(undocounter - 2)
spriteX = undolist.getAt(undocounter - 1)
spriteY = undolist.getlast(undocounter)
sprite(spriteName).loc = point(spriteX, spriteY)
undocounter = undocounter - 3
There's nothing built-in so you'll need to develop your own logic to do it. How best to do this depends on the complexity of your program. I once used a system that logged all changes to a list of property lists, with each property list logging the details of the user's actions. So, if a user's actions changed the value of "name" property of a given parent script instance (let's call it theObject), I would store something like this in my undo list:
[#targetObj: theObject, #targetProp: #name, #oldVal: "This is what it used to say", #newVal: "This is the new text"]
It's then a simple task to step back and forth through the undo list and reverse / re-apply the changes.