A tool for creating dynamic stories relative to a reader's place, time, location, weather and perhaps more**This first launch is focused on places (using the Foursquare API), times/dates, and weather (using the OpenWeatherMap API) but adding related music (via the Last.fm API), names of a reader's friends (via Facebook) and more could certainly be possible in the future. Any suggestions would be very welcome. Tap the request button in the top right to suggest ideas.
Throughout this page you can tap the Localise buttons to see what a translation of the text would look like where you are. Then hit Reset to go back to the raw text.
How it works
A writer writes a story and at certain points, replaces static words like days of the week and place names with special placeholders or variables.
Alongside variables, writers can put in logic to show text if some statements are true and some other text if they are not.
Say you are writing a piece of science fiction and you get frustrated by the thought of the year you chose arriving too quickly, thereby making your choice of date laughabily ancient.
You hope they'll have jetpack factories in 2035 but don't know for sure, so you write a conditional statement that sets the story 30 years in the future, unless there's already a jetpack factory around the corner from where the reader is.
Once a reader starts reading a story and agrees to share their location (longitude and latitude picked up through their web browser), all relevant data is collected and swapped out to make a story that is unique to that reader but still keeps the original essense of the story.
Data for places is pulled in from Foursquare, a wonderful place-based social network and directory. Data for weather and sunset and sunrise times is brought in from the kind people who run OpenWeatherMap.
Side note: As mentioned, the tool can be used for more than just fiction, it should work on HTML so you might even be able to use it in your application to show pictures, video or other data relevant to a viewer/reader.
Types of variable
To put a place in your story, a zoo or japanese restaurant for example, first look up the name of the category of place on this list of place categories from Foursquare to make sure it's available. The list used to match place categories in text is updated live from this Foursquare list so if squirrel cafes (or jetpack factories) suddenly become a huge thing they might be a useable variable in the future. Parent categories contain everything below them so you can use them to get less specific variables.
Next, enclose the name of the category in square brackets followed by a | (pipe) character and a unique number for that place. The number is there in case you want to re-use the same place in multiple parts of the story or have multiple places of the same category.
Other information about places
You might want to use other information about a place, like the street it's on or how far away it is from the reader.
If you've got how places work this bit should be easy as it's just another pipe character after the ID.
It's not just places you can swap into text, here are some other variables you can use.
More variables will come in the future but that should hopefully give you a nice start. Please feel free to suggest some if you feel anything is missing.
Conditionals are the most complex part of the system but hopefully not so complex that you don't try them out as they're probably the best part of it.
They're enclosed in curly brackets with the word if followed by a space after the opening bracket.
After this space and before the second bracket, you can put in statements that should either be true or false. First decide if a statement should be true or false and put in a + or a - sign. Then put in the name of the value you wish to compare to something (this can be static such as the number 5 or dynamic such as [sunsethour]). Then put in an operator from either == (equals (two == signs)), > (greater than) or < (less than).
Then put the name of the value you want to use this operator to compare the first value to. This can be static text or a dynamic variable.
Put in as many of these rules as you want seperated by commas.
Then put in a pipe character | followed by what you want to write if this set of rules passes.
Then put in another pipe character | followed by what to write if the rule does not pass.
Finally, close the curly bracket.
Here's an example that checks if the reader has missed Wednesday's sunset.