I’m having troubles with carrying over the dlg.bounds when reloading my script.
My hope is for the window not to snap in the middle of the screen every time I push a button. I don’t really care about its dimensions, but the position.
I’ve been tinkering with this problem on and off for the past few days, saving dlg.bounds to another variable, loading the variable upon reloading the script. And while it DID set dlg.bounds to the right value upon reloading, it doesn’t actually change the position or size of the window.
So I’ve ended up copying what another script was doing. As far as I can tell, I’m doing the exact same thing, down to the variable names.
Here is my script:
And here’s the one I’d like to plagiarize the bounds method from:
My function reloadColors(windowBounds) function acts basically the same way as domjohn’s function showColors(shadingColor, fg, bg, windowBounds) function, nesting the dialog so it can be reloaded.
Searching for bounds in both mine an his script, I have copied everything that looks relevant. But my script doesn’t work.
Pressing the reload button (close to the very end of my script) triggers the reload.
Similar to what most clickable things in domjohn’s script do.
Edit#1 - end
I should probably explain what my script is supposed to do when it’s finished if I’m already posting the whole thing.
I want to create a tool to generate gradients of colors. But I don’t simply want to do a linear interpolation of them. I want for instance to be able to do a standard linear RGB interpolation, followed by an interpolation of the saturation, value and alpha seperately and stitch it all together…
With it, you should for instance be able to distribute the distance between tones to effectively bake curvature into the used colors. Probably not that easy to see the point just from my explanation, but yeah.
Above is a screen cap of Visual Studio Code. There are many alternatives. In the column on the left is a list of extensions available for download that help with Lua scripting. On the right you can see yellow underlines where the function bar is called, indicating there’s a problem.
The helpfulness of these extensions can vary quite a bit. For example, Aseprite userdata like Color creates false positives which are highlighted in yellow. For scripts I plan to use in the longer term, I’ve found that if I take extra time to help the extension, my time is repaid in less debugging:
Oh hey! I’m sorry I’m only reading this now, since I’ve taken a bit of a break and haven’t been on here in a couple of days!
What I’ve been using to write everything is Notepad++. I know that an IDE is better suited for my needs at this point and tried switching to my already installed IntelliJ. That switch didn’t last long, because I repeatedly ran into issues with formatting and introduced errors I wouldn’t have otherwise.
Maybe I won’t have these issues with Visual Studio Code! So thank you for the suggestion!!
Oh, I don’t know how I missed the debugger until now. That looks useful! Especially since I seem to keep running into nil values for various reasons and only notice them fairly late.
Also, thank you so much for your tutorials on making scripts for Aseprite. I thought of messaging you directly because of them, but didn’t know how to say thank you without being awkward!