ID:154627
 
Problem:
Created links in an HTML document to call other HTML documents. When running in IE5 I don't have a problem. When running in BYOND, I click on the links and nothing happens.

If this is what it's supposed to do, then I'm guessing I'll need to use the Topic() process to make pull up the other documents, but I'm still having problems understanding how to do this (which is why I tried to do it without the Topic() function).

Here's the code:
mob/verb/help() var/C var/P P=prompt("What Category?") in list("race","cancel") switch(P) if("race") C="race" if(C == "race") P=prompt("What Topic?") in list("overview","dwarf","elf","goblin","halfling","human","t roll","cancel") switch(P) if("overview") usr << browse(file("helpRace.html")) if("dwarf") usr << browse(file("helpRaceDwarf.html")) if("elf") usr << browse(file("helpRaceElf.html")) if("goblin") usr << browse(file("helpRaceGoblin.html")) if("halfling") usr << browse(file("helpRaceHalfling.html")) if("human") usr << browse(file("helpRaceHuman.html")) if("troll") usr << browse(file("helpRaceTroll.html")) return SAMPLE FROM ONE HTML DOCUMENT THAT LINKS OUT: <A HREF="helpRaceGoblin.html">Gargun</A> | Halflings | Humans | Khuzul | Sindarin | Trolls </<></<></<></<></< ></<></<>
Now it's doing something other than nothing... page could not be displayed.

Path:

res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#file:// F:\BYOND\key\cache\helpRaceDwarf.html


The actual file is located here:

F:\dev\world\helpRaceDwarf.html


I copied the file into F:\BYOND\key\cache and it worked fine. Any way to get the desired effect without having to copy the pages into the cache?

Desired Effect:
Link to help pages from the browser window in byond

- -
In response to Gabriel
On 7/16/00 12:18 pm Gabriel wrote:

Desired Effect:
Link to help pages from the browser window in byond

- -

BYOND handles normal files by sending them from the server to the client cache dir, which is then used as a repository for http:// links. So if you want to make a help system, you would put the files somewhere accessible by your server and then do:

usr << browse('path_to_helpfile.html')

where path_to_helpfile the name of a helpfile. The single quote is used to compile the helpfile into your .rsc and access it from there. If you want to add files at runtime you can do something like:

usr << browse(file("path_to_helpfile.html"))

From your post in the Bug Report, though, it sounds like you are doing this already. Does this help at all?
In response to Tom H.
From your post in the Bug Report, though, it sounds like
you are doing this already. Does this help at all?

Not quite, it's two seperate issues. With this one, I have a pure HTML document that contains hyperlinks to other help files, sort of like a table of contents. The files being referenced only exist in the rsc file and do not contain path or URL address'.

(Hypothosis) The browser checks to see if there is an address (there's not), then checks the user's key/cache directory to see if the documents exist there. So far as I can tell, the only way the files will exist in the user's key/cache directory is if they are pushed out using the usr << browse(file()) function which is not available in the pure HTML browser document (so far as I know at least).

I was hoping that the hyperlinks would first look in the rsc file for the documents, but it treats it like a standard web address and fails to load if it's not in the key/cache directory.

I think I can get around this by not using the browser at all, and using the Topic(Href) function. I've just been dreading it. It looked so inviting to try and click a normal hyperlink in the browser to do the same thing -g-

It also had the benifit of being able to access the help files uninterrupted while game content went into the standard viewer.

I guess this ends up being a feature request if it's supposed to work this way :). I was hoping there was a work around, but I can't seem to find one.


==================================
On 7/16/00 10:16 pm Tom H. wrote:
On 7/16/00 12:18 pm Gabriel wrote:
Desired Effect:
Link to help pages from the browser window in byond

BYOND handles normal files by sending them from the
server to the client cache dir, which is then used as a
repository for http:// links. So if you want to make a
help system, you would put the files somewhere accessible
by your server and then do:

usr << browse('path_to_helpfile.html')

where path_to_helpfile the name of a helpfile. The single
quote is used to compile the helpfile into your .rsc and
access it from there. If you want to add files at
runtime you can do something like:

usr << browse(file("path_to_helpfile.html"))

From your post in the Bug Report, though, it sounds like
you are doing this already. Does this help at all?
In response to Gabriel
On 7/17/00 12:10 am Gabriel wrote:

(Hypothosis) The browser checks to see if there is an address (there's not), then checks the user's key/cache directory to see if the documents exist there. So far as I can tell, the only way the files will exist in the user's key/cache directory is if they are pushed out using the usr << browse(file()) function which is not available in the pure HTML browser document (so far as I know at least).

I was hoping that the hyperlinks would first look in the rsc file for the documents, but it treats it like a standard web address and fails to load if it's not in the key/cache directory.

This is a pretty good idea. I'll have to think about it a bit to see how tricky it is. Essentially, you are requesting that the client send a message to the server on a "local" http:// link that cannot be resolved. Currently the browser manages all of these links, but I suppose we could make this a sort of shortcut to a hard-coded byond:// handler that would just do a browse() on the requested path.

Currently you can get the same functionality by using said byond:// links, but this isn't quite as robust because these links won't work outside of BYOND. Nonetheless, an example might be helpful:

file.html
// blah blah blah
// here's your link ([ for < because of forum parsing)
[a href="byond://#file2.html"]click here[/a]
// when clicked, the text "file2.html" will be sent to client/Topic())

code.dm
client/Topic(str)
browse(file(str)) // will browse 'file2.html' from root

obviously if you are going to use Topic() a lot you'll want to pass in more than just the filename (since not everything is going to be help file). I believe Deadron has a library/example for this in the Code & Demos forum.
In response to Tom H.
On 7/17/00 1:54 am Tom H. wrote:
Currently you can get the same functionality by using said byond:// links, but this isn't quite as robust because these links won't work outside of BYOND. Nonetheless, an example might be helpful:

file.html
// blah blah blah
// here's your link ([ for < because of forum parsing)
[a href="byond://#file2.html"]click here[/a]
// when clicked, the text "file2.html" will be sent to client/Topic())

code.dm
client/Topic(str)
browse(file(str)) // will browse 'file2.html' from root

obviously if you are going to use Topic() a lot you'll want to pass in more than just the filename (since not everything is going to be help file). I believe Deadron has a library/example for this in the Code & Demos forum.


I do, but that code was pre \ref. If I were now trying to solve Gabriel's problem, I would create a Browser object whose purpose is just to display files, and pass stuff to its Topic() command, like so (note this is untested code):

Browser
Topic(file_name)
usr << browse(file(file_name))

With the Browser being a global:

var/Browser/GlobalBrowser

Then links would look like:

click here

And would display whatever file was specified.

I don't know if this really helps Gabriel, but it's an approach.

In response to Deadron
On 7/17/00 9:48 am Deadron wrote:
On 7/17/00 1:54 am Tom H. wrote:
Currently you can get the same functionality by using said byond:// links, but this isn't quite as robust because these links won't work outside of BYOND. Nonetheless, an example might be helpful:

file.html
// blah blah blah
// here's your link ([ for < because of forum parsing)
[a href="byond://#file2.html"]click here[/a]
// when clicked, the text "file2.html" will be sent to client/Topic())

code.dm
client/Topic(str)
browse(file(str)) // will browse 'file2.html' from root

obviously if you are going to use Topic() a lot you'll want to pass in more than just the filename (since not everything is going to be help file). I believe Deadron has a library/example for this in the Code & Demos forum.


I do, but that code was pre \ref. If I were now trying to solve Gabriel's problem, I would create a Browser object whose purpose is just to display files, and pass stuff to its Topic() command, like so (note this is untested code):

Browser
Topic(file_name)
usr << browse(file(file_name))

With the Browser being a global:

var/Browser/GlobalBrowser

Then links would look like:

click here

And would display whatever file was specified.

I don't know if this really helps Gabriel, but it's an approach.

Argh! Preview screws up the angle brackets... Well here is what the link would look like:

<a href=\"byond://#\ref[GlobalBrowser]file2.html\">click here</a>
In response to Deadron
I've been playing with it for about thirty-five minutes or so without much success. I'll continue at it though - so long as I know it's possible to do :).

I'd still like to see the links passed directly to the rsc as it simplifies everything in addition of having standard HTML pages, but a Topic(Href) will work (if i can figure it out).

- -
In response to Tom H.
client/Topic(fileName)
usr << browse(file(fileName))

In HTML Document:
<A HREF="byond://#helpRaceDwarf.html">Dwarf</a>
In response to Gabriel
For files in subdirectories, this works:
(actual path is f:\dev\world\help\helpRaceDwarf.html)

<A HREF="byond://#help\helpRaceDwarf.html">Dwarf</a>
In response to Gabriel
On 7/17/00 10:37 am Gabriel wrote:
I've been playing with it for about thirty-five minutes or so without much success. I'll continue at it though - so long as I know it's possible to do :).

I'd still like to see the links passed directly to the rsc as it simplifies everything in addition of having standard HTML pages, but a Topic(Href) will work (if i can figure it out).

- -


Darn -- well, here is some code I threw together that works for me. This is a complete app. Try it out -- if it doesn't work, I'll package up the app and post it on my website. (It does require for you to have a file called welcome.html in the app directory.)




// Global variables.
var
HTMLBrowser/globalBrowser



world
name = "TestWorld"

New()
var/result = ..()
globalBrowser = new()
return result



HTMLBrowser
Topic(T)
usr << browse(file(T))


mob
Login()
usr << "Click for a <a href=\"byond://#\ref[globalBrowser]welcome.html\">Big Welcome</a>."
In response to Deadron
Wow, thanks! I'll try it out when I get home later. The thing that catches my attention right off is the



world/New() var/result = ..() globalBrowser = new() return result



which I didn't do.

On 7/17/00 6:30 pm Deadron wrote:
On 7/17/00 10:37 am Gabriel wrote:
I've been playing with it for about thirty-five minutes or so without much success. I'll continue at it though - so long as I know it's possible to do :).

I'd still like to see the links passed directly to the rsc as it simplifies everything in addition of having standard HTML pages, but a Topic(Href) will work (if i can figure it out).

- -


Darn -- well, here is some code I threw together that works for me. This is a complete app. Try it out -- if it doesn't work, I'll package up the app and post it on my website. (It does require for you to have a file called welcome.html in the app directory.)



// Global variables.
var
HTMLBrowser/globalBrowser



world
name = "TestWorld"

New()
var/result = ..()
globalBrowser = new()
return result



HTMLBrowser
Topic(T)
usr << browse(file(T))


mob
Login()
usr << "Click for a Big Welcome."
In response to Gabriel
On 7/17/00 8:26 pm Gabriel wrote:
Wow, thanks! I'll try it out when I get home later. The thing that catches my attention right off is the

>
> world/New()var/result = ..()globalBrowser = new()return result>


which I didn't do.


Oops sorry -- I left initializing that as an exercise for the reader, but didn't bother mentioning it to the reader...