ID:150480
 
I've never been great with directory names or HTML links, so here's a bit of a thorny problem for me.

As I have mentioned elsewhere, I implement all sorts of logging protocols in my games so as to increase my general level of omniscience as architect/administratrix/goddess. I recently decided to channel this healthy level of paranoia into a useful game feature by allowing players to read back through their character's histories. In order to keep the information organized in an easily browseable format (as well as give a handy way of providing cut off or erase-after dates), I have it generate a new HTML file for every game week. You can call up a specific week with the history command, or look at a page that has links to all weeks still one file.

The problem is the browsing part. The history verb will call up the page requested, but the links on that page are effectively "broken"... as far as I can tell, it is because I set up each player's history file inside its directory, so I could just generate links to the file names. When you view a page in the DS browser window, though, it downloads it and caches it... and so the links are now pointing to files in the cache, which of course, do not exist.

Is there an easy way (specifying the entire directory? or would that just make it look for the directory in the cache?) to get around this? Or am I going to have to make players download their whole history directory at once to browse it?
LexyBitch wrote:

The problem is the browsing part. The history verb will call up the page requested, but the links on that page are effectively "broken"... as far as I can tell, it is because I set up each player's history file inside its directory, so I could just generate links to the file names. When you view a page in the DS browser window, though, it downloads it and caches it... and so the links are now pointing to files in the cache, which of course, do not exist.

Is there an easy way (specifying the entire directory? or would that just make it look for the directory in the cache?) to get around this? Or am I going to have to make players download their whole history directory at once to browse it?

Interesting dilemma. I can think of two immediate solutions that might do the trick.

The first idea is to use browse_rsc() to send all of the files over first. Of course, I'm not even sure if that will work properly, since I don't think it preserves the directory structure (if you have subfolders). I'll look into that.

The second idea would work better from the user's perspective and should suffice if you are only viewing these files from BYOND (and not from a web browser outside of BYOND). Instead of making http:// links to your other files, use byond:// links. These links would call a topic that browses the respective file, eg:
client/Topic(topic)
..()
// filter out the files however you want here
mob << browse(topic)

And you could embed the links in your files like so:
<a href=byond://?file.htm>

where file.htm would be a file path relative to the .dmb on the server.

In fact, we could possibly just have it so that the client automatically contacts the server to download missing cache files of this sort. The only problem is that it is a security hole, since anyone could then make cache files that would download files from your game. It would probably require us having a special cache/ directory relative to your .dmb file where you could put files that you wanted to make freely available, and _that_ would be the default directory for browse files.

For the time being, see if one of the approaches above works, and I'll keep thinking about how we can do this on our end.
My first thought was this: don't have the browser cache the files! There is a way to do this:

Go to www.w3schools.com and look up the >meta< tags...
In response to Tom
<a href=byond://?file.htm>

where file.htm would be a file path relative to the .dmb on the server.

This sounds ideal, it is in fact exactly what I want... the ability to specify the directory the same way as I do when I generate the files, which is relative to the .dmb