LsBox and mzscript's !pause? Thread last updated on 2004-04-15 23:31:23

Posted by member 12025 on 2004-04-11 01:33:50

*script bang !setSize_prepare
*script exec !LsBoxUndock %{cur}Grip %{cur}
*script exec !pause 50
*script exec !LsBoxUndock %{cur}Grip %{cur}Shade
*script exec !pause 50
*script exec !LsBoxUndock %{cur}Grip %{cur}UnShade
*script exec !pause 50
*script exec !varSet curGrip_size %{P}{%{cur}Grip_size}
*script exec !varSet curBox_h %{P}{%{cur}Box_h}
*script exec !varSet curBox_w %{P}{%{cur}Box_w}
*script exec !varSet curShade_w %{P}{%{cur}Shade_w}
*script exec !varSet curShade_h %{P}{%{cur}Shade_h}
*script ~bang

When this bang goes off, I get three error dialogs for !pause, parameters 50. If !pause is used elsewhere, it's fine, but not in this !bang or the one after it. However, without the pauses, it moves the boxes, while docked, from further !bangs, and then they are redocked before anything gets done, aside from moving the boxes to the last position the master box is moved--so the !pause is necessary just before they start getting resized and moved. Also, without a pause after each undocking, there's a single !pause error and the boxes undocked are nonresponsive (they display, but any clicking goes to the windows below).

Any suggestions for getting this to work w/o errors?

Posted by member 37809 on 2004-04-11 09:36:45 link

Try timer-based stepping, a method that helps in animations, polling, and the like. This is untested but should definitely use less CPU than !pause, which often seems to cause problems in time-critical scripts.

You'll need timer-0.5.

Here's a condensed version with everything put in a single bang--I'd usually break this up, but it's messy either way :)
*script bang !setSize_prepare
*script gotoif ("%{args}x" = "stepx") step ; continue looping at the right time
; initialization
*script exec !TimerAdd setsize_prepare 50 '!setSize_prepare step' ; needed for looping
*script exec !varset setsize_preparetodo :shade:unshade:empty ; the queue of tasks
; the part that loops
*script label step
*script gotoif ("%{setsize_preparetodo}" = "empty") done
*script exec !LsBoxUndock %{cur}Grip "%{cur}%{setsize_preparetodo:}"
*script exec !varset setsize_preparetodo %{setsize_preparetodo:_}
*script exec !TimerStart setsize_prepare ;loop
*script exit
; the part after looping
*script label done
*script exec !varSet curGrip_size %{P}{%{cur}Grip_size}
*script exec !varSet curBox_h %{P}{%{cur}Box_h}
*script exec !varSet curBox_w %{P}{%{cur}Box_w}
*script exec !varSet curShade_w %{P}{%{cur}Shade_w}
*script exec !varSet curShade_h %{P}{%{cur}Shade_h}
*script exec !TimerRemove setsize_prepare
*script ~bang

I wonder if mzscript will like the empty first item in the setsize_preparetodo list, but it should.

Posted by member 12025 on 2004-04-11 18:04:25 link

Not bad, and I'll try it ASAP (got company over for Easter right now).

Posted by member 12025 on 2004-04-15 23:31:23 link

College and allergies made quite a delay here...just popping back to this thread to say it worked. Your script there doesn't :), but Timer 0.5 did the trick.