isolate number from format string with quote ""
Hi all :)
They are the last details of my script (Environment Lighting HDR Studio (MR) ) but now I've a problem that I can not solve...
I want to enter parameters in rollut taking them from a txt file, but the info in file txt are written as Reflections (Subactive Color): (color 255 255 255) or Glossines: 8.0 ecc.. Now I know this form to isolate number from string array:
test = "Max Distance FallOff: 2.0" strArr = filterString test " " valuespinner = strArr[4] as float print valuespinner
but I can not transfer ONLY values in rollout, because I always error of various kinds (!)
If I try with "openFile" and "readValue", (for read the file txt) I've always the result, for example, "scale()", but never specific value. I had no trouble writing values to and from .txt, but now I can not do this..
The question is very simple: How isolate a number from a string with quote "" and restore the values of spinner etc. the rollout reading a file .txt?
Any help is very important to me :D
Thanks
Michele71

Comments
...
*.Ini is good solution to store this kind of params. But XML is much fester,
especially when you use XPath method for reading XML doc.
Maybe you already know for this site.
XML examples
http://www.w3schools.com/xml/
XPath examples
http://www.w3schools.com/xpath/
bga
...
You can find also example
http://www.scriptspot.com/forums/3ds-max/general-scripting/manipulate-xm...
bga
`
wow, great examples and tutorials lol, thank you !
I would say .ini is good for just few values to save / load (because easy single lines to get and set values in code)
And for larger amount settings /data -> definitely faster XML !
What you think ?
...
that's right
;)
bga
`
:)
Thank you again for XML examples... I still need to learn this, I have few ideas where to use it, but didn't have time to learn it. Now will be very easy.
Thank you !
`
ah, and the last thing I saw somewhere to convert string to Poin3 but it works with color too!
a = execute "(color 10 10 10)"a = execute "[10,10,10]"then it can be much easier to get color form your text file:
But if you have ini file it will be so easy to convert string "(color 10 10 10)" to color value.
Sorry I forgot about it yesterday.
Best,
`
and even better:
this is what I found in maxscript help about execute
readExpr <filestream>andexecute <filestream>maxscript sample:
and this should be very easy to read from txt file :)
...
Also to store some data of any tool (read/write) the best and fastest way will be XML.
bga
...
Yup. Can be done with .net but ...
bga
Thanks barigazy, I try your
Thanks barigazy, I try your function :)
At this point I agree with you as regards the format xml....
Thanks Again!!