Difference between revisions of "Script:Persist.js"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20100621061805/http://www.spheredev.org/wiki/Persist.js)
 
(Download: fix link)
Line 8: Line 8:
  
 
==Download==
 
==Download==
 +
* [https://gist.github.com/apollolux/5702052 persist.js] (17.9 KB JavaScript file)
 +
* <del>persist.js demo game</del> (15.6 KB ZIP archive, requires Sphere) <!-- TODO: get this back -->
 +
 +
===The code (embedded Gist)===
 +
<gist>5702052</gist>
 +
 
==Quick start==
 
==Quick start==
 
==Reference==
 
==Reference==

Revision as of 22:41, 3 June 2013

persist.js lets you store variables in persons and maps, and use them in event scripts.

At its simplest, you can store simple quest information, e.g. if you've talked to an NPC, or collected an item. Power users can take full advantage of JavaScript, and write templates for common person patterns, e.g. one-line townsfolk, store keepers, inn keepers, save points, chests, items, door switches, bosses blocking passages, and warps.

It helps you to organise your game data. If you ever got sick of making global variables and confusing data structures to hold your game info, this is your answer.

Download

  • persist.js (17.9 KB JavaScript file)
  • persist.js demo game (15.6 KB ZIP archive, requires Sphere)

The code (embedded Gist)

<gist>5702052</gist>

Quick start

Reference

How to…