The compiler does not recognise that val() returns an integer. For example the following works:
c = val(mid$(words(w), len(words(w))))
ink textColours(c), 0
but the following contraction to one line does not:
ink textColours(val(mid$(words(w), len(words(w))))), 0
Here's sample complete code which works. Just comment/uncomment the relevant lines to see the bug:
` use of tags to change the colour of text
dim textColours(6) as dword ` we will use just 7 different colours
textColours(0) = rgb(255, 0, 0)
textColours(1) = rgb(0, 255, 0)
textColours(2) = rgb(0, 0, 255)
textColours(3) = rgb(255, 0, 255)
textColours(4) = rgb(255, 255, 0)
textColours(5) = rgb(0, 255, 255)
textColours(6) = rgb(255, 255, 255)
dim words(10) as string
` define some words and give them a colour
words(0) = "THE"+str$(rnd(6))
words(1) = "QUICK"+str$(rnd(6))
words(2) = "BROWN"+str$(rnd(6))
words(3) = "FOX"+str$(rnd(6))
words(4) = "JUMPED"+str$(rnd(6))
words(5) = "OVER"+str$(rnd(6))
words(6) = "THE"+str$(rnd(6))
words(7) = "LAZY"+str$(rnd(6))
words(8) = "DOG"+str$(rnd(6))
words(9) = "by"+str$(rnd(6))
words(10) = "GREEN GANDALF"+str$(rnd(6))
cls 0
set cursor 100, 100
for w = 0 to 8
` the next two lines work
c = val(mid$(words(w), len(words(w))))
ink textColours(c), 0
` but the following does not
` ink textColours(val(mid$(words(w), len(words(w))))), 0
print left$(words(w), len(words(w))-1)+" ";
next w
print ""
set cursor 200, 130
c = val(mid$(words(9), len(words(9))))
ink textColours(c), 0
print left$(words(9), len(words(9))-1)+" ";
set cursor 150, 160
c = val(mid$(words(10), len(words(10))))
ink textColours(c), 0
print left$(words(10), len(words(10))-1)+" ";
wait key