工作(草稿)更多,代码更少。。。
我必须做点什么来激励自己在绘图上多做些工作,不要被编码分心。
那么我的解决方案是什么
我写了一个生成ranklist的例程,当我画更多的时候(使用命令调用或lisp调用),它会增加我的秩-多么讽刺。
编写(汇编)该代码很有趣,其目的是提高绘图效率。
然而,我没有经过测试,所以我不知道对于每一个困难,分数是太多还是太少,以及它会有多上瘾-只是想实现我的这个想法。
; --- [The Drafter's Game] -----------------------------------------------------------------------------; Drafter/Draughtsman score game; Its using a reactor to count how many commands-calls or lisp-calls you have invoked in that drawing,; hence increasing your score and position in the ranklist (and your drafting productivity - which is the whole purpose BTW); The Rank List is DWG dependent - which means individual rank per project; Included a final boss - "The Drafter" on the < Extreme > difficulty; Written by: Grrr; Credits to: Lee Mac;-------------------------------------------------------------------------------------------------------; --- [ Technically speaking (for the lisp heads) ] -------------------------------------------------------------------------------------------------------------; The routine uses: DCL, Reactors, Dictionaries'n'xRecords, Randomizing subfunctions; It stores the list statistics data inside the first and only (1 . <dataL>) group code,; located inside a xrecord in a dictionary with a name "DrafterGame", which is inside the (namedobjdict); So that means the Statistics/Rank List is DWG Dependent (which means individual ranklist for the different projects); The reactor's events and callback functions are:; (:VLR-lispWillStart . DG:BeginLsp) (:VLR-lispEnded . DG:EndLsp) (:VLR-lispCancelled . DG:EndLsp) (:VLR-commandWillStart . DG:BeginCmd); The callback functions are written as simple as possible (depending on their events) - in order to prevent any slow-down of the working(drafting) process; *DrafterGame* is a global counter variable, to not slow down the working proccess (for each event to dig into the xDictionary and subst the list.. bla-bla); *DGstopCounter* is a global boole variable, This boolean prevents counting command calls inside lisp routine, to prevent cases like this: ;|(defun C:test ( / ) (repeat 500 (command "_.point" "0,0,0")) (princ "\nCreated 500 points.") (princ))|;; ---------------------------------------------------------------------------------------------------------------------------------------------------------------(defun C:DraftersGame ( / *error* dcl des dch dcf ) (DG:Statistics nil) (defun *error* ( msg ) (and (< 0 dch) (unload_dialog dch)) (and (eq 'FILE (type des)) (close des)) (and (eq 'STR (type dcl)) (findfile dcl) (vl-file-delete dcl)) (and msg (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\nError: " msg)))) (princ) ); defun *error* (cond ( (not (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq des (open dcl "w")) (mapcar (function (lambda (x) (princ (strcat "\n" x) des))) '("DraftersGame : dialog " "{ label = "Drafter Statistics";" " spacer_1;" " : list_box { key = "LB"; width = 20; height = 20; tabs = "18"; tab_truncate = false; }" " : button { key = "res"; label = "Reset Statistics"; fixed_width = true; alignment = centered; }" " : button { key = "info"; label = "Info / About"; fixed_width = true; alignment = centered; }" " spacer_1; ok_only; : text { key = "txt"; alignment = centered; } " "}" ); list ); mapcar (not (setq des (close des))) (< 0 (setq dch (load_dialog dcl))) ); and ); not (prompt "\nUnable to write or load the DCL file.") ) ( (progn (defun ord ( n ) (cond ((< 10 (rem n 100) 14) "th") ((nth (rem n 10) '(nil "st" "nd" "rd"))) ("th"))) ; LM (while (not (member dcf '(0 1))) (cond ( (not (new_dialog "DraftersGame" dch)) (prompt "\nUnable to display the dialog") (setq dcf 0) ) (T (DG:Statistics nil) ; Looks for the score, or generates a new one | returns the score (DG:BeginSave nil nil) ; Just call the frekin' reactor's callback function to update the ranklist ( (lambda ( xRec / L nL nm sc i ) (and (setq L (GetDataFromMainDic xRec)) (setq nL (mapcar (function (lambda (x / a b ) (setq a (car x)) (setq b (cdr x)) (strcat a "\t" (itoa b)) ); lambda ); function L ); mapcar ); setq nL (progn (start_list "LB") (mapcar 'add_list nL) (end_list) (setq nm (strcat (getvar 'loginname) " [You]")) (setq sc (cdr (assoc nm L))) (setq i (1+ (vl-position (cons nm sc) L))) (set_tile "LB" (itoa (1- i))) (set_tile "txt" (if (= 1 i) "• You won 1st place! •" (strcat "Your rank is " (itoa i) (ord i)) ) ); set_tile "txt" ); progn ); and ); lambda "DraftersGame" ) (mapcar 'action_tile '("res" "info") '("(done_dialog 2)" "(DG:Info)")) (setq dcf (start_dialog)) ); T ); cond (cond ( (= 2 dcf) ( (lambda ( / tmp )