MtAverest Posted December 6, 2019 Posted December 6, 2019 I am new to lisp and programming in general. I get the basic gist and i'm not very proficient at reading it yet. I have 2 major issues. I have a hard time understanding samples given when researching issues i'm having, and no matter how hard I try I just cant seem to understand Arguments. I am also working on a very basic function: (defun c:Burnbot ( / ) (GetN) (Insult) ) (defun GetN ( / ) (princ "\nHello there.") (princ) (setq ans (read (getstring "\nHey what's your name big guy?"))) ) (defun Insult ( / que an mrk ) (setq ans an) (setq que "\nWhat kind of a name is") (setq mrk "?\n") (princ (list que an mrk)) (princ) ) (princ "\nInsult Loading...") (princ) Output: ( What kind of a name is nil ? ) This is the closest I have gotten to success. But I just cannot get this variable to load. I've tried adding some of these to my different argument areas but have had only errors. I would appreciate it if anyone can tell me whats going on or/and if anyone can tell me where i can find a comprehensive guide to arguments. Quote
BIGAL Posted December 6, 2019 Posted December 6, 2019 Something like (defun c:Burnbot ( / ) (defun GetN ( / ) (princ "\nHello there.") (princ) (setq ans (getstring "\nHey what's your name big guy?")) ) (defun Insult (ans / que an mrk ) (setq que "\nWhat kind of a name is ") (princ "\nInsult Loading...") (princ (Strcat que " " ans " ?")) (princ "\n") (princ "\nInsult Loading...") ) (GetN) (If (/= ans nil ) (Insult ans) (Alert "\nWhat kind of a name is nil ?") ) (princ) ) 1 Quote
SLW210 Posted December 9, 2019 Posted December 9, 2019 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post your questions in the most appropriate forum in the future. Please post all code in "Code Tags". 1 Quote
Roy_043 Posted December 10, 2019 Posted December 10, 2019 (edited) Maybe this helps: (defun GetNumber (str) (getreal str) ) (defun AddTwoNumbers (num1 num2) (+ num1 num2) ) (defun c:Test ( / num1 num2 res) (if (and (setq num1 (GetNumber "\nFirst number: ")) (setq num2 (GetNumber "\nSecond number: ")) ) (progn (setq res (AddTwoNumbers num1 num2)) (princ (strcat "\nThe total is: " (rtos res))) ) ) (princ) ) Edited December 11, 2019 by Roy_043 Edit: Forgot to localize res. 1 Quote
MtAverest Posted December 18, 2019 Author Posted December 18, 2019 On 12/6/2019 at 3:57 PM, BIGAL said: Something like (defun c:Burnbot ( / ) (defun GetN ( / ) (princ "\nHello there.") (princ) (setq ans (getstring "\nHey what's your name big guy?")) ) (defun Insult (ans / que an mrk ) (setq que "\nWhat kind of a name is ") (princ "\nInsult Loading...") (princ (Strcat que " " ans " ?")) (princ "\n") (princ "\nInsult Loading...") ) (GetN) (If (/= ans nil ) (Insult ans) (Alert "\nWhat kind of a name is nil ?") ) (princ) ) Thank you that worked! Quote
Recommended Posts
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.