This is the commented section from below
;
; Drawstar, Created by QuickStep
; Draws a star to a picture window
;
; Format:
; /drawstar -ihnr @ <color> <size> <x y> <inner radius> <outer radius> <points>
;
; Examples:
;
; /drawstar @ 1 1 100 100 20 80 5
; Draws a 5 point black star at (100,100) with an inner radius of 20 and an outer radius of 80
;
; /drawstar @ 7 1 100 100 80 85 60
; Draws an orange sun at (100,100)
;
; This alias can be quite usefull, and with some experimentation (loops)
; it is possible to create some beautifull looking figures.
;
;
; Drawstar, Created by QuickStep
; Draws a star to a picture window
;
; Format:
; /drawstar -ihnr @ <color> <size> <x y> <inner radius> <outer radius> <points>
;
; Examples:
;
; /drawstar @ 1 1 100 100 20 80 5
; Draws a 5 point black star at (100,100) with an inner radius of 20 and an outer radius of 80
;
; /drawstar @ 7 1 100 100 80 85 60
; Draws an orange sun at (100,100)
;
; This alias can be quite usefull, and with some experimentation (loops)
; it is possible to create some beautifull looking figures.
;
;
; Drawstar, Created by QuickStep
; Draws a star to a picture window
;
; Format:
; /drawstar -ihnr @ <color> <size> <x y> <inner radius> <outer radius> <points>
;
; Examples:
;
; /drawstar @ 1 1 100 100 20 80 5
; Draws a 5 point black star at (100,100) with an inner radius of 20 and an outer radius of 80
;
; /drawstar @ 7 1 100 100 80 85 60
; Draws an orange sun at (100,100)
;
; This alias can be quite usefull, and with some experimentation (loops)
; it is possible to create some beautifull looking figures.
;
alias drawstar {
; Check if first parameter is a switch
var %switch
if (-* iswm $1) {
%switch = $1
tokenize 32 $2-
}
; Basic error checking, the label will catch the rest
if (!$8) drawstar_error insufficient parameters
if (($8 !isnum) || ($8 < 2)) drawstar_error invalid points
; Main Code
var %step = $calc($pi / $8), %rad = 0, %p = $calc($8 * 2), %prev, %next = $4 $calc($5 - $7)
while (%p) {
inc %rad %step | dec %p
%prev = %next
%next = $calc($4 + ($sin(%rad) * $iif($calc(%p % 2),$6,$7))) $calc($5 - ($cos(%rad) * $iif($calc(%p % 2),$6,$7)))
drawline %switch $1-3 %prev %next
}
return
; Error Handling
:error | drawstar_error $error
}
; Error output
alias -l drawstar_error {
echo $color(info) -eq * /drawstar: $iif($1 = *,$3-,$1-)
halt
}