I would suggest that you turn ON / OFF the reactor in the command function
Code:
(defun C:AlertSysVars ( / ) ; Command that start/stop the reactor
(vl-load-com)
(if *VTFRXN*
(progn
(vlr-remove *VTFRXN* ) ; Turn OFF
(setq *VTFRXN* nil )
)
(setq *VTFRXN* (vlr-editor-reactor nil '((:VLR-sysVarChanged . *VTF* ))) ) ; Turn ON
)
(princ)
)
and replace the if statement with a cond statement in the function that treat your sysvar callbak
Code:
(defun *VTF* (CALL CALLBACK ) ; Function that is triggered by the reactor
; (alert (strcat (car CALLBACK ) " has been changed " ) ) ;; Uncommented shows all sysvars that changes
(cond
((= (car CALLBACK ) "SAVETIME" ) (alert (strcat (car CALLBACK ) " has been changed " )) )
((= (car CALLBACK ) "OSMODE" ) (alert (strcat (car CALLBACK ) " has been changed " )) )
((= (car CALLBACK ) "BLIPMODE" ) (alert (strcat (car CALLBACK ) " has been changed " )) )
((= (car CALLBACK ) "LTSCALE " ) (alert (strcat (car CALLBACK ) " has been changed " )) )
; ((= (car CALLBACK ) "MySysVar" ) (alert (strcat (car CALLBACK ) " has been changed " )) ) ; Add what you want
(T nil )
)
(princ)
)
You can read more about reactors and how to load functions in the Sticky: Anatomy of an AUTOLISP file thread
: ) Happy Computing !
kennet