; ; Analogue_Anim.shell ; ; A DEMO to show how to create a simple 6 bit depth analogue bargraph generator. ; An ARexx script is created on the fly and saved to the C: volume as a psuedo-command. ; This can be used in any shell script and uses standard ARexx error detection. ; The script is saved in the C: volume as "RANDOM.rexx" and the usage is...... ; ; SYS:Rexxc/RX C:RANDOM.rexx min max > NIL: ; ; ......where min=0 to 999, and, max=min to 1000. ; ; The $RC is used to store this value until the _next_ command terminates. ; ; ; ; To run this shell script, type from an AMIGA Shell prompt:- ; ; Some-Prompt> Execute FULL:Path/To/Analogue_Anim.shell ; ; And away you go... ; Where "FULL:Path/To/" is the absolute location of the script... ; ; ; ; Set FAILAT limit to 64 for this DEMO... FAILAT 64 ; ; ; ; Remove the comment ';' on the line below to autorun RexxMast, or, manually start it up... ;SYS:System/RexxMast ; ; ; ; Initialise any _variables_ required. SETENV blankline "*e[0;31;42m *e[0m" SETENV activeline "" SETENV randomnumber 0 SETENV count 0 SETENV repeats 0 ; ; ; ; Create a pseudo-random number generator as an ARexx script and save to the C: volume. ; Start with an empty file... ECHO > C:RANDOM.rexx ; Now build it up... ECHO "/** $VER: RANDOM.rexx_Version_0.00.10_Public_Domain_B.Walker_G0LCU. **/" >> C:RANDOM.rexx ECHO "/** Usage: SYS:Rexxc/RX C:RANDOM.rexx min max > NIL: **/" >> C:RANDOM.rexx ECHO "PARSE ARG min max ." >> C:RANDOM.rexx ECHO "num=RANDOM(min,max,TIME(s))" >> C:RANDOM.rexx ECHO "EXIT num" >> C:RANDOM.rexx ; ; ; ; Generate a simple analogue bargraph display... ECHO "*ec*n A simple 6 bit analogue bargraph generator using the standard AMIGA(D)OS..." ECHO "*n $VER: Analogue_Anim.shell_Version_0.00.10_(C)2013_B.Walker_G0LCU." ECHO "*n*n 0 10 20 30 40 50 60" ECHO " +---------+---------+---------+---------+---------+---------+---+" ECHO " (| |)" ECHO " +---------+---------+---------+---------+---------+---------+---+*n" ECHO "*e[9;8f$blankline*n*n*n" ECHO "Random number generated = " ; ; ; LAB mainloop SETENV count 0 SETENV activeline "" ; Call the new ARexx RANDOM.rexx script and save as a return code inside $RC. SYS:Rexxc/RX C:RANDOM.rexx 0 63 > NIL: ; IMMEDIATELY grab and store this value inside another _variable_... EVAL $RC LFORMAT %N > ENV:randomnumber ; ; ; LAB bargraphloop ; This counts the number of SPACES for the active, BLACK?, part of the display. ; When both are equal exit the loop to print the active section. IF $count EQ $randomnumber SKIP exitbargraphloop ENDIF EVAL 32 LFORMAT %C >> ENV:activeline EVAL $count + 1 TO ENV:count SKIP BACK bargraphloop ; ; ; ; Now print the inactive section and immediately the active section over the top. LAB exitbargraphloop ECHO "*e[9;8f$blankline*n*n*n" ECHO "*e[9;8f*e[0;32;41m$activeline*e[0m*n*n*n" ECHO "*e[13;27f$randomnumber... " ; ; ; ; Repeat this a few times then completely exit the script. EVAL $repeats + 1 TO ENV:repeats IF $repeats EQ 10 SKIP getout ENDIF WAIT 1 SKIP BACK mainloop ; ; ; ; Exit the main program loop. LAB getout ; Remove all the _variables from the ENV: volume and set FAILAT again... UNSETENV repeats UNSETENV count UNSETENV randomnumber UNSETENV activeline UNSETENV blankline FAILAT 11 ; ; ; ; Clear the screen and finish... ECHO "*nAnalogue animation DEMO end!*n" ; ; ; ; Analogue_Anim.shell DEMO end... ; Enjoy finding simple solutions to often very difficult problems...