ID:272783
 
Instead of using a statpanel to show detailed information, I'm using html. The information is split up onto three different files (one showing basic information and a picture, another showing stats, and another showing skills) and a fourth containing links to navigate from one to the other. Then, the player is shown the information in a window split into two frames, the top one containing the links which stays there, and the bottom one that changes every time a link is pressed on the top frame. Now, all of this works fine.
The problem is that I don't know how to delete the html files. I cannot fdel them while the player is still viewing them, but since I used browse(), I have no way of knowing when the player closes the window. What is the best way of dealing with this, so that I don't have several html files cluttering up the server.
HTML files viewed by the player don't clutter up the server, which would just have the original version of the file (or the HTML code in memory). It actually clutters the players cache folder when sent to them for display. :P
In short, provided I get you correctly, you need express no concern about this. Did you ever even notice "several html files cluttering up the server"?
In response to Kaioken
Kaioken wrote:
HTML files viewed by the player don't clutter up the server, which would just have the original version of the file (or the HTML code in memory). It actually clutters the players cache folder when sent to them for display. :P
In short, provided I get you correctly, you need express no concern about this. Did you ever even notice "several html files cluttering up the server"?

Yes, I did, but perhaps it's because I'm doing this inefficiently. What I did, was created files in a folder on the host computer, then used browse_rsc() to send them to the player. I was assuming that browse_rsc() needed files, not text. Would it have been possible to do this without creating files?
In response to Chessmaster_19
Chessmaster_19 wrote:
Yes, I did, but perhaps it's because I'm doing this inefficiently. What I did, was created files in a folder on the host computer,

As of know for you knowledge only, fdel() could have dealt with the deletion of those files you've created on the host's comp fine. There's also no need to keep the files after they've been sent to a player because he's "viewing it"; he's not, the file is copied onto his end - and even if he deletes that file on his end while viewing it, it won't actually cause any immediate problem, since the file is loaded in memory, but that's kind of off the point.

then used browse_rsc() to send them to the player. I was assuming that browse_rsc() needed files, not text. Would it have been possible to do this without creating files?

browse_rsc() is a proc used to copy a resource file (any file to be used by subsequent HTML pages you're going to send to the player; this could be an image file, flash movie, HTM file or pretty much anything that a browser could load) to the player's cache folder so it can be used by the player's browser*. It doesn't actually display anything on its own, and browse() is needed to actually display any web page. browse() mainly actually takes direct HTML code (in a text string of course) as its first argument, to display, and using an HTML file (which like other files needs to be already present at the player end so the browser can find and use it) is an extra (optional) option you can use. You should look up the browse() proc (and might as well the browse_rsc()) one and read up some on it.

*: Note a call to browse() can actually be done to do the same work as browse_rsc() by using a certain argument.
In response to Kaioken
Kaioken wrote:
Chessmaster_19 wrote:
Yes, I did, but perhaps it's because I'm doing this inefficiently. What I did, was created files in a folder on the host computer,

As of know for you knowledge only, fdel() could have dealt with the deletion of those files you've created on the host's comp fine. There's also no need to keep the files after they've been sent to a player because he's "viewing it"; he's not, the file is copied onto his end - and even if he deletes that file on his end while viewing it, it won't actually cause any immediate problem, since the file is loaded in memory, but that's kind of off the point.

then used browse_rsc() to send them to the player. I was assuming that browse_rsc() needed files, not text. Would it have been possible to do this without creating files?

browse_rsc() is a proc used to copy a resource file (any file to be used by subsequent HTML pages you're going to send to the player; this could be an image file, flash movie, HTM file or pretty much anything that a browser could load) to the player's cache folder so it can be used by the player's browser*. It doesn't actually display anything on its own, and browse() is needed to actually display any web page. browse() mainly actually takes direct HTML code (in a text string of course) as its first argument, to display, and using an HTML file (which like other files needs to be already present at the player end so the browser can find and use it) is an extra (optional) option you can use. You should look up the browse() proc (and might as well the browse_rsc()) one and read up some on it.

*: Note a call to browse() can actually be done to do the same work as browse_rsc() by using a certain argument.

I really do understand browse() and browse_rsc(). That's not the problem. Here's basically what I've got:
var/File1 = file("temp/file1.htm")
usr << browse_rsc(File1,"File1")
var/html = "<html><frameset><frame src="File1" /></frameset></html>"
File1 << "Example HTML here"
usr << browse(html,"window=[name]")
fdel(File1)

Obviously, the real thing is a bit more, I have more than one frame and such and a <head> and CSS section, but you get the general idea.

The problem is that fdel simply isn't working. The file isn't deleted. I'm pretty sure the issue is that the file is still in use when its called, but I'm not sure, I guess.

In response to Chessmaster_19
fdel("temp/file1.htm")
In response to Chessmaster_19
fdel() isn't working because you've been supplying it wrong arguments; as you can see in the reference, it takes a file name (as a text string), not a file object.

And as I said, you don't need this temporary file at all, if you keep deleting it all the time, just put the same HTML text in the browse() call itself. This could also be read from a certain local file, or whereever.