Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
YungBlood
Streaming Star

Type Mismatch.

I'm slightly confused... I'm well into making a channel, and when I added some code, I get a type mismatch error.

Here's my Initialization:

Dim Xn[9, 9]
Dim Yn[9, 9]
for y = 1 to 9
for x = 1 to 9
Orig[x, y] = Int(Val(Mid(OrigStr,z,1)))
if(Orig[x, y] > 0) then
Xn[x, Orig[x, y]] = 1
Yn[y, Orig[x, y]] = 1
else
Xn[x, Orig[x, y]] = 0
Yn[y, Orig[x, y]] = 0
end if
...


That all seems to work perfect. However when I try to increment a position, it crashes with a type mismatch error on line:

Xn[mx, Play[mx, my]] = Xn[mx, Play[mx, my]] + 1


And yet this line works flawlessly:

Play[mx, my] = Play[mx, my] + 1


Any ideas why?
YungBlood

Bringing more fun to Roku!
0 Kudos
2 REPLIES 2
YungBlood
Streaming Star

Re: Type Mismatch.

Here's something stranger...


for y = 1 to 9
for x = 1 to 9
Xn[x, Orig[x, y]] = 0
Yn[y, Orig[x, y]] = 0
if(Orig[x, y] > 0) then
Xn[x, Orig[x, y]] = Xn[x, Orig[x, y]] + 1
Yn[y, Orig[x, y]] = Yn[y, Orig[x, y]] + 1
end if
end for
end for
Xn[x, Orig[x, y]] = Xn[x, Orig[x, y]] + 1


It runs through the loop just fine. But fails on the line outside the loop...
Do I have a defective box???
YungBlood

Bringing more fun to Roku!
0 Kudos
YungBlood
Streaming Star

Re: Type Mismatch.

In the words of Homer Simpson....

"Doh!"

I wasn't initializing correctly, so anything that wasn't initialized, was set to "invalid" and you can't add 1 to "invalid"... :roll:
YungBlood

Bringing more fun to Roku!
Tags (1)
0 Kudos