Hi Sergio,
My recommendation - based on my own experience - is to have a DETAILED look at all of the sample scripts that came with your installation of PixInsight.
Print them out, or load them into a word processor. Break them down into manageable chunks. Try to understand all of the main 'program blocks'. Then break these 'bolcks' down into smaller and smaller sections until you can follow the entire program flow.
If you are working 'on-screen', then the method I used was to load a sample script, and then to immediately save it again with a different name. This meant that I could freely 'edit' the copy of the original, adding line breaks and comments as I saw fit.
If you also look at all the many examples, you will hopefully find one that has a 'framework' that might serve as the foundation for your script. Start with that one, and break it down so that you have the 'skeleton' of the code, onto which you will hand all of your specific routines. Obviously, you may need to take sections of code from other scripts - both in the sample directory, AND from those you find here on the Forum. And, most obviously, you are going to have to ask for help, here on the Forum, when nothing else works
Finally, on the right-hand-side (usually) of the script editing window you should have a list of objects available to you, in two categories : "Core Java Script Objects" and "External Objects". The first category ('Core') has a full list of all the processes that you may need to get your program running. The second ('External') categore is a list of all the PixInsight 'clever stuff' - which can be immensely useful, because - if you can see a way to use one of these INSTEAD of a process that you have to code in JavaScript, then you get an execution speed that is orders of magnitude faster than the same process coded in JS.
And, finally, finally, if you DO get a script going, remember to share it here - but, MOST IMPORTANTLY, take the time to add LOTS OF COMMENTS, so that others (and I specifically include MYSELF in that group
) can understand YOUR code and maybe, as a result, can figure out how to resolve their own coding problems.
And, finally, finally, finally, remember that 'Juan is your friend' - he is the brains behind the JSR engine (and his 24/7 telephone contact number is available for a 6-digit fee, payable to an offshore bank account
)
Best of luck,