I wanna get some settings for the scene from Textfile. Is there any possibility to read Text-Files (*.txt) with VRML or JavaScript???
No. You can't read plain text file with javascript in VRML. But there is some kind a trick: you can save all settings in the VRML file and read it using Browser.createVrmlFromURL(). Just like this, for example,
PROTO Settings [
field MFString values []
]{
}
Settings {
values ["var1=value1", "var1=value2", "etc"]
}
Thanks for the fast answer! I've tried it this way, but it doesn't work. What is wrong??
---- PROTO ------
PROTE Settings[
field MFString values[]
]
{}
Settings {values ["full = TRUE", "color = blue", "do = null"]}
-----------------
---- Main -------
...
DEF Group Group{}
Script{
field SFNode g USE Group
field MFString file "settings.wrl"
url "javascript:
function initialize()
{
Browser.createVrmlFromURL(file, g, 'addChildren');
print(settings.children);
...
}
"
}
-----------------