diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index 5e68b2d..7f8c269 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,11 +35,6 @@ item "Lantern" ; night-vision -; define-function "light" -; docstring "Gives the player night vision" -; player night-vision -; print "You now have night vision!" - load-file "places.atl" load-file "items.atl" load-file "npcs.atl" \ No newline at end of file diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index 5e68b2d..7f8c269 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,11 +35,6 @@ item "Lantern" ; night-vision -; define-function "light" -; docstring "Gives the player night vision" -; player night-vision -; print "You now have night vision!" - load-file "places.atl" load-file "items.atl" load-file "npcs.atl" \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index 8ac9ae9..1851ead 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -14,7 +14,7 @@ '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" "define-class" "define-player" "define-quest" - "define-function" "name-world" "load-file" "load") + "name-world" "load-file") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call - doesn't work for some reason diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index 5e68b2d..7f8c269 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,11 +35,6 @@ item "Lantern" ; night-vision -; define-function "light" -; docstring "Gives the player night vision" -; player night-vision -; print "You now have night vision!" - load-file "places.atl" load-file "items.atl" load-file "npcs.atl" \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index 8ac9ae9..1851ead 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -14,7 +14,7 @@ '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" "define-class" "define-player" "define-quest" - "define-function" "name-world" "load-file" "load") + "name-world" "load-file") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call - doesn't work for some reason diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index 81c1d7c..c27ec79 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -47,21 +47,6 @@ item "Anaklusmos" npc "Charon" -; define-function "Light" -; docstring "Gives a player night-vision" -; player night-vision T -; print "You can now see in the dark!" - -define-function "Spawn Fury" - docstring "Spawn a Fury in this place" - place monster "Fury" - print "Watch out! A Kindly One!" - -define-function "Heal" - docstring "Heal the player by 1HP" - player health +1 - print "+1 HP" - load-file lisp-test.atl ;Testing whether recursive loading is prevented load-file races-classes.atl load-file game-objects.atl diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index 5e68b2d..7f8c269 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,11 +35,6 @@ item "Lantern" ; night-vision -; define-function "light" -; docstring "Gives the player night vision" -; player night-vision -; print "You now have night vision!" - load-file "places.atl" load-file "items.atl" load-file "npcs.atl" \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index 8ac9ae9..1851ead 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -14,7 +14,7 @@ '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" "define-class" "define-player" "define-quest" - "define-function" "name-world" "load-file" "load") + "name-world" "load-file") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call - doesn't work for some reason diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index 81c1d7c..c27ec79 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -47,21 +47,6 @@ item "Anaklusmos" npc "Charon" -; define-function "Light" -; docstring "Gives a player night-vision" -; player night-vision T -; print "You can now see in the dark!" - -define-function "Spawn Fury" - docstring "Spawn a Fury in this place" - place monster "Fury" - print "Watch out! A Kindly One!" - -define-function "Heal" - docstring "Heal the player by 1HP" - player health +1 - print "+1 HP" - load-file lisp-test.atl ;Testing whether recursive loading is prevented load-file races-classes.atl load-file game-objects.atl diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index ab7a257..617dd66 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -66,13 +66,6 @@ (money 0) (experience 0)) -;; TODO Needs a complete overhaul -(defstruct game-function - (name "") - (docstring "") - (place NIL) - (player NIL) - (print "")) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" @@ -141,29 +134,3 @@ ((member object-name (list-place-objects 'npc p) :test #'equalp) (npc-description (get-game-object 'npc object-name))) (t NIL)))) - -(defun run-game-function (function player) - "Execute this game function" - (let* ((fn (if (game-function-p function) function - (get-game-object 'game-function function))) - (player (if (player-p player) player - (get-game-object 'player player))) - (place (get-game-object 'place (player-place player)))) - (dolist (game-obj (list player place)) - ;; Iterate through each element in the function that modifies - ;; this game object - (dolist (element (funcall (build-symbol "game-function-" - (type-of game-obj)) fn)) - (let* ((element (if (listp element) element (list element))) - (attr (first element)) (value (second element)) - ;; FIXME +1 gets transformed to "1"... - (mod (aref (to-string value) 0)) - (orig-value (funcall (build-symbol (type-of game-obj) - #\- attr) game-obj))) - ;; Update the value of the specified attribute - (if (= (length element) 1) - (set-object-attribute game-obj attr T) - (if (or (eq mod #\+) (eq mod #\-)) - (set-object-attribute game-obj attr - (+ orig-value value)) - (set-object-attribute game-obj attr value)))))))) diff --git a/ATL/Lugwey/lugwey.atl b/ATL/Lugwey/lugwey.atl index 5e68b2d..7f8c269 100644 --- a/ATL/Lugwey/lugwey.atl +++ b/ATL/Lugwey/lugwey.atl @@ -35,11 +35,6 @@ item "Lantern" ; night-vision -; define-function "light" -; docstring "Gives the player night vision" -; player night-vision -; print "You now have night vision!" - load-file "places.atl" load-file "items.atl" load-file "npcs.atl" \ No newline at end of file diff --git a/ATL/atl-mode.el b/ATL/atl-mode.el index 8ac9ae9..1851ead 100644 --- a/ATL/atl-mode.el +++ b/ATL/atl-mode.el @@ -14,7 +14,7 @@ '("define-place" "define-item" "define-monster" "define-npc" "define-race" "define-place" "define-weapon" "define-class" "define-player" "define-quest" - "define-function" "name-world" "load-file" "load") + "name-world" "load-file") '() ;; other commands (adjust this?) '("\\.atl$") ;; files for which to activate this mode '(linum-mode) ;; other functions to call - doesn't work for some reason diff --git a/ATL/test/lisp-test.atl b/ATL/test/lisp-test.atl index 81c1d7c..c27ec79 100644 --- a/ATL/test/lisp-test.atl +++ b/ATL/test/lisp-test.atl @@ -47,21 +47,6 @@ item "Anaklusmos" npc "Charon" -; define-function "Light" -; docstring "Gives a player night-vision" -; player night-vision T -; print "You can now see in the dark!" - -define-function "Spawn Fury" - docstring "Spawn a Fury in this place" - place monster "Fury" - print "Watch out! A Kindly One!" - -define-function "Heal" - docstring "Heal the player by 1HP" - player health +1 - print "+1 HP" - load-file lisp-test.atl ;Testing whether recursive loading is prevented load-file races-classes.atl load-file game-objects.atl diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index ab7a257..617dd66 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -66,13 +66,6 @@ (money 0) (experience 0)) -;; TODO Needs a complete overhaul -(defstruct game-function - (name "") - (docstring "") - (place NIL) - (player NIL) - (print "")) (defun set-object-attribute (game-object property value) "Set the attribute 'property' of 'game-object' to 'value'" @@ -141,29 +134,3 @@ ((member object-name (list-place-objects 'npc p) :test #'equalp) (npc-description (get-game-object 'npc object-name))) (t NIL)))) - -(defun run-game-function (function player) - "Execute this game function" - (let* ((fn (if (game-function-p function) function - (get-game-object 'game-function function))) - (player (if (player-p player) player - (get-game-object 'player player))) - (place (get-game-object 'place (player-place player)))) - (dolist (game-obj (list player place)) - ;; Iterate through each element in the function that modifies - ;; this game object - (dolist (element (funcall (build-symbol "game-function-" - (type-of game-obj)) fn)) - (let* ((element (if (listp element) element (list element))) - (attr (first element)) (value (second element)) - ;; FIXME +1 gets transformed to "1"... - (mod (aref (to-string value) 0)) - (orig-value (funcall (build-symbol (type-of game-obj) - #\- attr) game-obj))) - ;; Update the value of the specified attribute - (if (= (length element) 1) - (set-object-attribute game-obj attr T) - (if (or (eq mod #\+) (eq mod #\-)) - (set-object-attribute game-obj attr - (+ orig-value value)) - (set-object-attribute game-obj attr value)))))))) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index d2edd72..2f00f55 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -38,7 +38,6 @@ (defcommand define-item item) (defcommand define-npc npc) (defcommand define-quest quest) -(defcommand define-function game-function) (let ((world-directory NIL) @@ -99,11 +98,6 @@ (first options) T)) (2 (set-object-attribute current-object (first options) (second options))) - (3 (if (game-function-p current-object) - (set-object-attribute current-object - (first options) (cdr options)) - (error "~&ERROR: too many arguments: '~A'" - line))) ;; FIXME gives problems with lines like this: ;; " ;commented" (t (error "~&ERROR: too many arguments: '~A'"