Lua Scripting: Can you move a selection (SOLVED)

Hi :slight_smile:

I’ve started toying with Aseprite scripts (this feature is amazing, I love it ^^), and while I’m really keen to try and script some useful things, I found myself stuckt in a problem.

When I try to move a selection that I previously made, I cannot get it to move where I want :frowning:
As far as I understand by looking at aseprite/data/gui.xml at main · aseprite/aseprite · GitHub , the command I must use should be something like:

app.command.MoveMask(target, direction, unity, quantity)

where:
target = sprite.selection (a selection that I previously told the script to create)
direction = “up”/“down”/“left”/“right” (one of these)
unity = “pixel”
quantity = 10 (10 pixels for example)

But no matter the values I give the function, the selection always moves just 1 pixel down. Not left nor up nor right, only down ^_^U

Could somebody please guide me a bit on this? Thanks in advance! :smiley:

Well, it seems that I am not the only one stuck at this problem. I think I’m a bit glad that I’m not alone XD

Please, o wise and almighty @Dacap , grant us the knowledge :bowing_man:

P.S: Should I have posted this on the “Scripts section” instead?

Problem solved! :smiley:

David tested the MoveMask command and created some documentation about it here:

Here is the example code:

local spr = app.activeSprite
spr.selection = Selection(Rectangle(0,0,spr.width,spr.height))

app.command.MoveMask{
  target='content',
  direction='right',
  units='pixel',
  quantity=2,
  wrap=true
}

app.command.MoveMask{
  target='content',
  direction='up',
  units='pixel',
  quantity=2,
  wrap=true
}

app.command.DeselectMask()

Edit: Updated code. If you read the comment I wrote here yesterday about quotation marks, please forget it, because I was wrong (I’ve deleted it from this post to avoid confussions).