I played with the idea of ββcreating a javascript version of the original Colossal Caves Adventure coming to teach myself the language. The original adventure data file can be found here -
http://jerz.setonhill.edu/if/crowther/
I hope an experienced javascripter can offer me a better way to save and access a text data file (only a few hundred lines long). At the moment, Iβm thinking about inserting text into a hidden element on an html page and accessing it this way, but I know that it lacks elegance. What are your thoughts?
AJAX, . - , AJAX. ( JS, AJAX)
, <input type="hidden" s. JavaScript , id, . .
<input type="hidden"
id
<input type="hidden" name="r121" value="You come upon a fissure" />
r 121: " "
r
javascript, , script. .
, , advdat.js, :
advdat = { 1: "YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK\ BUILDING . AROUND YOU IS A FOREST. A SMALL\ STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY.", 2: "YOU HAVE WALKED UP A HILL, STILL IN THE FOREST\ THE ROAD NOW SLOPES BACK DOWN THE OTHER SIDE OF THE HILL.\ THERE IS A BUILDING IN THE DISTANCE.", 3: "YOU ARE INSIDE A BUILDING, A WELL HOUSE FOR A LARGE SPRING.",... };
script . advdat.
Source: https://habr.com/ru/post/1795948/More articles:C # Call override method in superclass - c #Can I speed up callbacks from C ++ Dll to C #? - c ++how to kill ajax requests - ajaxPassing an Object to an Unallocated Pointer - pointersFilter the data loaded by the MySQL LOAD DATA command - filterLighttpd proxy names? - proxycomparing two URLs (iPhone) - iphoneHow to use Wordpress and Django together - djangoJava does not run provisioning instructions with parameter - javaException Handling in MVVMLight - viewsAll Articles