In your code example above, it's not working because you're retrieving the wrong string token.
volume = val(get split word$(1))
if this is your string:
volume = 100
The first token is "volume" and the second token is "100". So if you change that 1 to a 2 in the code above, it'll work.
If you don't want to use the split word commands or rely on 3rd party plugin, here's the alternative:
print getValue("c:\test.txt", "volume")
wait key
end
function getValue(filename$, key$)
open to read 1, filename$
while file end(1) = 0
` Read line from file
read string 1, n$
x$ = ""
` Search through the line
for i = 1 to len(n$)
c$ = mid$(n$, i)
` Read the characters until = is found
if c$ = "="
` Trim leading and trailing spaces
x$ = ztrim$(x$)
` See if this is our key we're looking for
if lower$(x$) = lower$(key$)
` Grab the value after the equal sign
v# = val(right$(n$, len(n$)-i))
exitfunction v#
endif
else
` Rebuild the word one letter at a time
x$ = x$ + c$
endif
next i
endwhile
endfunction 0.0
function ztrim$(w$)
local a = 0
local b = 0
local stopa = 0
local stopb = 0
n = len(w$)
for i = 1 to n
if stopa = 0 and mid$(w$, i) = " "
a = i
else
stopa = 1
endif
if stopb = 0 and mid$(w$, n-(i-1)) = " "
b = n-(i-1)
else
stopb = 1
endif
next i
if b <> 0 then w$ = left$(w$, b-1)
if a <> 0 then w$ = right$(w$, len(w$)-a)
endfunction w$