I am content just being pointed in the right direction if it’s what you can offer. Thanks!
Ok, so I have several scripting questions that would be much easier to solve by asking than by googling. To start, I will post the questions with as little need for context as possible along with a basic idea of what I’m coding, then I’ll post my code for anyone who might want to go the extra mile in helping me.
The Script Description (optional reading)
My script allows me to set up a timed practice sculpt which can be repeated as many times as I specify so that I might get through a dozen 5 minute sculpts or six ten minute sculpts, for example. In addition, it prompts for and quickly saves to a directory you’ve chosen before you’ve begun (an outbox for quick sketches). It allows you to include tags and it includes the time spent on each sculpt in the filename so that, if I want to go back, I can look through my filename tags (ratings, for example) and find sculpts I’m interested in continuing.
After accomplishing this basic helper, I intend to add a reference system so that, for each quick sculpt, a set of words or a picture is shown as inspiration. This will help me be more decisive about designing on the fly, rather than blanking and staring at the screen trying to figure out what to do. Ideally I would go so far as to make themed folders so that I might choose to do a set of anatomy themed cycles or a set of animal themed or alien themed or mechanical themed cycles. These would be organized in personal folders set up and maintained by the user. I don’t know if zbrush can handle it but eventually that might include putting ‘used’ files in a separate bin to keep things fresh.
The goal is to make this process impersonal, so that I don’t have to be the one to decide that time’s up (because I can’t!). I have trouble starting quick sculpts because I know I will take forever and I have trouble stopping them because I enjoy them so much once I begin. This way I can amass many smaller studies and improve myself in much more meaningful ways.
I describe each timed sculpt as a cycle and each set of cycles a session.
The Questions! (in order of importance to me right now)
*“The number of inputs exceeds the number of inputs defined by the target routine”: I seem to have made some fundamental mistake in my coding because I get this whenever I attempt to call any of my routines for a second time. If I exit the entire script, then hit a resume button, the script begin to function again without problem but if I get to the end of a cycle and try to jump back to the top and reset my variables, the routineCall fails. I don’t know if it’s a recursion problem from somehow being unable to call a function until it has ended entirely (A finishes and calls B. B finishes and attempts to call A. A is still waiting for B to finish before it can start over) or if I’m just doing something wrong with the code. Google thinks this is a really old problem that no one has had since the turn of the century so I don’t know where to go with this.
*Timers: Right now my script needs to have a timer to count down the minutes. Something that can use a variable that I can update, reset, and increment as I want. I’m using a delay to create that tick, so that it runs code, delays, runs code, delays, and repeats until the variable reaches zero. Unfortunately, delay seems to lock up all of zbrush so that I can’t anything while it’s running. I also see that, even running at a very visible rate it is having trouble smoothly updating three sliders which display the time (time left, time elapsed, and time total). I’d like to know a better way to do this and perhaps a more efficient way to go about it.
*Saving files: I’ve built my saving code randomly as I discovered what was available. I want it to be as minimal as possible so you don’t have to jump to the mouse, keyboard, and tablet any more than necessary. The user chooses the directory for saving files before they can start anything (the default otherwise is to save to the macro folder). Though the load file dialogue seems a better place to start since it isn’t expecting input for a filename, the save dialogue is the only one that can select a folder and give you back its path information.
After a cycle completes, the user is prompted to “name your creation”, and then again to include a tag (rating, description, theme, etc.) which precedes the file name. I’ve set it up to increment the filename in that location and to include elapsed time in a prefix. All of the strings are then put together, set as the FileNameSetNext, and the Save As button is clicked.
Aside from whether this is the appropriate way to do all this, I’m also wondering how I can get zbrush to properly display the directory with backslashes and special characters. I have a prompt tell the user where the file is saved and what it was saved as, to be clear to them what’s going on.
*Loading a random mesh: I want to include an option to randomly select a starter mesh to mix things up further. These would be things like male/female busts, body types, quick symmetry setups, base anatomical features, etc… They would be placed in a folder alongside the macro and updated by the user if they choose. I haven’t looked into how to sift through files and choose one at random yet but it would help.
*My strAsk prompts don’t appear until I move the mouse a lot of the time. It looks like it lags as a result. There isn’t anything in the function that says that should happen. How can I fix it, or do I have things running that shouldn’t be?
*Reference: I haven’t gotten to this but I know I’ll need to be more informed about saving and loading files to zbrush before I even try. Here’s a quick list of basic actions I want to know about.
*Displaying a picture within an interface cleanly, without prior resizing, and with minimal lag.
*Removing a picture without destroying the interface or hiding it away for the memory to chew on for awhile.
*Reading through a text file, parsing it at the commas, and displaying a list in a meaningful way (ie. clean and evenly spaced buttons?) for the user to refer to.
*Choosing a random file within a directory.
*Alternate interfaces: A floating window maybe. I found the progress bar toggle for the notebar but I don’t know how to display the actual progress on it (it’s always 100%). Right now I’m working from a macro, but I had put it in as a plugin or in the zscript windows. It doesn’t really matter as far as I know.
*Zscripting environment: I don’t have one. I’m terrible at setting them up so if you’ve got a good suggestion, I would be glad for the simple how-to-set-it-up link as well.
*Literally anything else I should know
Thanks in advance!