Jump to content

Why getvar is not working?


Perifanos
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

(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

Link to comment
Share on other sites

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

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

 Share

×
×
  • Create New...