Jump to content

LISP & DCL giving "Bad Function" error


rwsice9

Recommended Posts

I'm hoping someone can help out with this one. I have a LISP that opens a DCL and prompts for user input, then sets the USERI2 variable. If I comment out the "if" function, the DCL works, and the USERI2 is set correctly. As soon as I put the IF back in, I get a "Bad Function" error that I cant seem to locate. Can any one help?

 

DCL Code:

notiftype : dialog {
label = "Notification Type";

:column	{
  : boxed_radio_column {
  	     label = "Notification Label Selection";
  	     : radio_button {
   		label = "Conventional Notification \"V\"";
   		key = "nconv";
  	     	}
  	     : radio_button {
   		label = "Addressable Notification \"A\"";
   		key = "naddr";
  	     	}
  	     
  }
  
       }

   	ok_cancel;


}

 

LISP Code:

(defun c:INDCPLINE (/ r3 nconv naddr )
(setq r3 (getvar "USERI2"))
(if
 (= r3 0)
  (
(setq dcl_id (load_dialog "notiftype.dcl"))
 (if (not (new_dialog "notiftype" dcl_id))(exit))
 
 	(action_tile "nconv" "(setq nconv $value)(setq nconv (atoi nconv))(setq naddr 0)")
(action_tile "naddr" "(setq naddr $value)(setq naddr (atoi naddr))(setq nconv 0)")
	(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(start_dialog)
;  (unload_dialog dcl_id)

  )
 )
 (if (= nconv 1)(COMMAND "userI2" 1))
 (if (= naddr 1)(COMMAND "userI2" 2))
 ;(command "._pline")
 )

Link to comment
Share on other sites

I didn't get your idea very well , but can you please try this at the moment ?

 

(defun c:INDCPLINE (/ r3 nconv naddr)
 (setq r3 (getvar "USERI2"))
 (if
   (= r3 0)
    (progn
      (setq dcl_id (load_dialog "notiftype.dcl"))
      (if (not (new_dialog "notiftype" dcl_id))
        (exit)
      )

      (action_tile
        "nconv"
        "(setq nconv $value)(setq nconv (atoi nconv))(setq naddr 0)"
      )
      (action_tile
        "naddr"
        "(setq naddr $value)(setq naddr (atoi naddr))(setq nconv 0)"
      )
      (action_tile "accept" "(done_dialog 1)")
      (action_tile "cancel" "(done_dialog 0)")
      (start_dialog)
      (if (= nconv 1)
        (COMMAND "userI2" 1)
      )
      (if (= naddr 1)
        (COMMAND "userI2" 2)
      )                                ;  (unload_dialog dcl_id)
    )
 )                                      ;(command "._pline")
)

Link to comment
Share on other sites

Well, for not "getting my idea", you still made it work :D Thank you VERY VERY MUCH! :notworthy:

:D You're welcome .

 

It is good to replace the last two functions IF with cond function as the following :

 

(cond ((= nconv 1)(COMMAND "userI2" 1))
            ((= naddr 1)(COMMAND "userI2" 2))
      )

 

Good luck .

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...