##// END OF EJS Templates
Remove curact, implement selact
Remove curact, implement selact

File last commit:

r45:0669fc21 default
r45:0669fc21 default
Show More
main.ps
54 lines | 1.3 KiB | application/postscript | PostScriptLexer
(in-package sugar-qsp.main)
;;; Game session state (saved in savegames)
;; Variables
(var *globals (create))
;; Inventory (objects)
(var *objs (create))
(var *current-location nil)
;; Game time
(var *started-at (chain *date (now)))
;; Timers
(var *timer-interval 500)
(var *timer-obj nil)
;; Games
(var *loaded-games (list))
;;; Transient state
;; ACTions
(var *acts (create))
;; Savegame data
(var *state-stash (create))
;; List of audio files being played
(var *playing (create))
;; Local variables stack (starts with an empty frame)
(var *locals (list))
;; Promise to continue running the game after menu
(var *menu-resume nil)
;;; Game data
;; Games (filename -> [locations])
(var *games (list))
;; The main (non library) game. Updated by openqst
(var *main-game nil)
;; Active locations
(var *locs (create))
(setf (@ window onload)
(lambda ()
(#.(intern "INIT-DOM" "SUGAR-QSP.API"))
;; For MSECCOUNT
(setf *started-at (chain *date (now)))
;; For $COUNTER and SETTIMER
(#.(intern "SET-TIMER" "SUGAR-QSP.API")
*timer-interval)
;; Start the first game
(#.(intern "RUN-GAME" "SUGAR-QSP.API")
(chain *object (keys *games) 0))
(values)))
;;; Some very common utilities (for both api and lib)
(defun by-id (id)
(chain document (get-element-by-id id)))