Jump to content

Recommended Posts

Posted

Can someone help me on why this code is throwing nil?

 

(command "_area")
 
 (while (> (getvar "cmdactive") 0) (command pause))
 
 (setq e (getvar "_area"))

 

e has nil value...

Posted

Try:

(command "_.area")
(while (> (getvar "cmdactive") 0) (command pause))
(setq e (getvar "area"))

Posted

I don't believe that getvar honors the "_"

Try :

 

(getvar "AREA")

 

-David

Posted

(Nop Nop)

 

Neither has worked !

Posted

(getvar "AREA") has worked.

 

Since when area should be written in capitals ???? :?

Posted

ok, now why this is giving a "bad function"?

 

 (if (= fuel "a") ((setq kw (getreal)) 
		(setq p (* 6 kw))
		(setq a (* 0.25 k)))
  		      ((setq p (* 0.5 e))
	        (setq a (* 0.25 k)))
 
 )

Posted
Neither has worked !

 

You have certainly done something wrong.

 

 

 

ok, now why this is giving a "bad function"?

 

(if (= fuel "a")
   (progn
       (setq kw (getreal)) 
       (setq p (* 6 kw))
       (setq a (* 0.25 k))  
   )
   (progn
       (setq p (* 0.5 e))
       (setq a (* 0.25 k)) 
   )
)

Posted
(if (= fuel "a")
  (setq kw (getreal "\nHow many Km?")
 p  (* 6 kw)
 a  (* 0.25 k)
  );; setq
  (setq kw (getreal "\nHow many Km?")
 p  (* 0.5 e)
 a  (* 0.25 k)
  );; setq
  );; if
;;or

(if (= fuel "a")
(progn
 (setq kw (getreal "\nHow many Km?"))
 (setq p (* 6 kw))
 (setq a (* 0.25 k))
);; progn
 (progn
   (setq kw (getreal "\nHow many Km?"))
   (setq p (* 0.5 e))
   (setq a (* 0.25 k))
 );; progn
);; if

Posted
ok, now why this is giving a "bad function"?

 

 (if (= fuel "a") ((setq kw (getreal)) 
           (setq p (* 6 kw))
           (setq a (* 0.25 k)))
                ((setq p (* 0.5 e))
               (setq a (* 0.25 k)))
 
 )

 

Use progn

(if (= fuel "a")
 (progn
   (setq kw (getreal))
   (setq p (* 6 kw))
   (setq a (* 0.25 k))
 )
 (progn
   (setq p (* 0.5 e))
   (setq a (* 0.25 k))
 )
)

Or combine the grouped setqs

 

(if (= fuel "a")
 (setq kw (getreal)          p (* 6 kw)          a (* 0.25 k)  )
 (setq p (* 0.5 e)          a (* 0.25 k) )
)

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