Author Topic: Monitoring when a system variable changes via reactors  (Read 2644 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Monitoring when a system variable changes via reactors
« on: February 06, 2007, 03:08:42 PM »
It has been brought to my attention that one of our routines is removing hatch association and not resetting it and i am trying to trace which one. what i am looking for is perhaps a reactor that i can put in our acad.lsp would alert us when the hpassoc variable changes to 0. I did a search on here and found this topic but i just want to monitor this one variable and am not sure how to modify these to achieve that. Can somebody help me out?

http://www.theswamp.org/index.php?topic=8822.0

ELOQUINTET

  • Guest
Re: Monitoring when a system variable changes via reactors
« Reply #1 on: February 06, 2007, 03:29:51 PM »
i found this code kerry posted awhile ago that is supposed to alert when autosave is turned off and put it in my acad.lsp when i set savetime to 0 i get the error below, what am i doing wrong?


Enter new value for SAVETIME <5>: 0
; error: no function definition: KDUB:REACTORSYSVARCHANGEDREACTOR


Code: [Select]
;;; codehimbelonga kwb@theSwamp
;;
(if kdub:reactorSysvarReactor
  (vlr-remove kdub:reactorSysvarReactor)
)
(setq kdub:reactorSysvarReactor (vlr-sysvar-reactor
                                  nil
                                  '((:vlr-sysvarchanged
                                     .
                                     kdub:reactorSysVarChangedReactor
                                    )
                                   )
                                )
)
(defun kdub:reactorSysVarChangedReactor (data callbacks /)
  ;; (setq *g:reactorSysVarChangedReactor* (cons (car callbacks) *g:reactorSysVarChangedReactor*))
  (if (= (car callbacks) "SAVETIME")
    (alert "wheeeee")
  )
  (princ)
)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Monitoring when a system variable changes via reactors
« Reply #2 on: February 06, 2007, 03:36:39 PM »
It doesn't look like a system variable reactor will catch this variable.  I loaded one, and tried the hatch command, and it doesn't show 'hpassoc' in the list of variables changed, even though I changed it twice within the dialog box.  Incase you want to know, here is the code used.
Code: [Select]
(if (not GlbVarReactorSystemVariable)
 (setq GlbVarReactorSystemVariable (vlr-sysvar-reactor "HatchAssociation" '((:vlr-sysVarChanged . HatchAssocAlert))))
)
(defun HatchAssocAlert (React Results)
(print Results)
;|
(if
 (and
  (= (car Results) "HPASSOC")
  (cadr Results)
;  (equal (getvar "hpassoc") 0)
 )
 (alert "System variable \"HpAssoc\" has changed to 0.")
)
|;
(princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ELOQUINTET

  • Guest
Re: Monitoring when a system variable changes via reactors
« Reply #3 on: February 06, 2007, 03:44:55 PM »
hmmm i see anyone else know of another method. it seems strange that associativity is not a property that one can monitor via reactor but hey what do i know

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Monitoring when a system variable changes via reactors
« Reply #4 on: February 06, 2007, 06:31:17 PM »


Enter new value for SAVETIME <5>: 0
; error: no function definition: KDUB:REACTORSYSVARCHANGEDREACTOR

Sounds like you had the reactor set but the callback wasn't loaded.
I just retried that and it works fine for me ...
Have you reloaded it and retried ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ELOQUINTET

  • Guest
Re: Monitoring when a system variable changes via reactors
« Reply #5 on: February 07, 2007, 02:11:16 PM »
kerry i just found yours and was using it as an example but i was actually trying to monitor hatch associativity which tim just told me is not a variable that reactors will catch. read man read  :lmao:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Monitoring when a system variable changes via reactors
« Reply #6 on: February 07, 2007, 03:00:44 PM »
kerry i just found yours and was using it as an example but i was actually trying to monitor hatch associativity which tim just told me is not a variable that reactors will catch. read man read  :lmao:
Quote from: Eloquintet
found this code kerry posted awhile ago that is supposed to alert when autosave is turned off and put it in my acad.lsp when i set savetime to 0 i get the error below, what am i doing wrong?

I thought I did read it. I must be more senile than people say.   :|
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.