Jump to content

[Help] How can i decide which Vlr do in runtime ?


ketxu

Recommended Posts

Hi All :heart:

Please help me a problem.

I have some reactor function in one file.

The first time load lisp, i will decided which reactor to used follow a variable (call x) like :

(cond
   ((= x 1)(setq Reactor-Put1 (vlr-editor-reactor nil '((:vlr-commandended . Function1)))))
   ((= x 2)(setq Reactor-Put2 (vlr-editor-reactor nil '((:vlr-commandended . Function2)))))
   ((= x 3)(setq Reactor-Put3 (vlr-editor-reactor nil '((:vlr-commandended . Function3)))))
)

But value of x can be changed later when user choice other method (by a dialog). how can i watching x value to decided what to do next ?

Ex : default value of x is store in registry as 1. So the first time it will call function1 reactor. But then user change it value to 2. How can i run actor function2 and remove vlr funtion1:(

Have i make a temple function to call ?

 

Thanks all for reading :)

Link to comment
Share on other sites

Have a look at the vlr function list there are a few functions to deal with reactors

Vlr-remove & vlr-reactors.

When dealing with reactors it’s a good idea to check and see if a reactor is loaded before calling it again.

If you call it twice there will be 2 instances of the reactor running

So in your cond statement you can use (if (not reactor-put1 (setq reactor-put1…………..

So if the user selects another reactor you need to unload the current one using

(if reactor-put1(vlr-remove reactor-put1))

From my experience reactors are hard to debug so you only want to load then once and remove them when done unless you want them to be persistent.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...