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.