Been struggling with getting the textures on my .x file and I cant get the update for some reason so I decided to post this and maybe someone can add on.. it seems to work ok for a novice...
function MakeTextureFileFromX(filename$)
/// Error Handling
if getstringtoken(Filename$,".",2) <> "x" then exitfunction
/// Definitions
result as string
result = ""
texture as string[100]
/// Open file
OpenToRead(1,filename$)
do
read$ = readline(1)
if FindString(read$,"Material")> 0
meshnum = val(getstringtoken(read$,"_",2))
for i = 1 to 8: read$ = readline(1) : next i
t$ = StripString(read$, chr(KEY_QUOTE2))
texturefile$ = StripString(t$, ";")
endif
texture[meshnum] = texturefile$
if fileeof(1) = 1 then exit
loop
closefile(1)
/// Take Array and make a file
ArrayToFile1(texture, TrimString(filename$,".x")+".texture")
endfunction
function ArrayToFile1(values ref as string [ ], filename as string )
i = 0
opentowrite(1, filename)
i=0
do
inc i
if i>values.length then exit
writeline(1,values[i])
loop
closefile(1)
endfunction