Adding user information to a checked in game

Bluevoss

I'm going to assume this is impossible but who knows - here goes.

Is there a way (with a Squiffy adventure checked in to textadventures) to gain information from a pre-specified location on the user's computer? For example, if the user wanted to put in his name and picture (say on "C:SquiffyData") could this be recovered for use in the game?

I know that it could be done with the game in it's development mode (i.e. in a folder on the computer) but I don't know if a game in the textadventures library can accept user data.


thetruespin

Without building a bespoke browser extension, no you can't call images from a user's hard-drive. It would be a rather serious security vulnerability if it were possible for a web page to access a user's hard-drive so easily.

But why do you want to do this? Why not just store the name via a Squiffy attribute?

A custom picture would be harder, but in theory you could use a basic image upload script and integrate with Squiffy, although would require some knowledge of php and Javascript. You'd also have to self-host the game as this website doesn't give you access to server side scripting.


Bluevoss

I had an idea to "personalize" the adventure - allow the player to enter characters they know for allies and villains met along the way.

I didn't think there would be an easy way to do this. Thanks all the same.


thetruespin

Entering names for characters is fairly easy. Look at the documentation for attributes.

http://docs.textadventures.co.uk/squiffy/attributes.html

Regarding images, it's probably just about possible to use Javascript to convert (small) images into a Base 64 string and then use Squiffy to output them where needed. That would avoid the need for server side scripting, but would be a pain in the ass to code and it's a clunky solution at best.

If you want to go down that path:

http://stackoverflow.com/questions/32833797/convert-local-image-to-base64-string-in-javascript

But if I was you I'd stick with the names but drop the images.

That said, you could easily give users access to a pre-defined set of images, and they click the one they wish to use. Again, you'd need to be fairly comfortable with javascript and Squiffy attributes, but it would give at least some control.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums