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: 
dynamitemedia
Binge Watcher

if msg.isButtonPressed() error

I keep getting this error

255:     screen.Show()
256: while true
257: msg = wait(0, screen.GetMessagePort())
258: if msg.isButtonPressed()
259: ' print "Evt: msg.GetMessage();" idx:"; msg.GetIndex()
260:
261: if msg.GetIndex() = 1
262: exit while
263: endif
264: if msg.GetIndex() = 2

/tmp/plugin/FPAAAA997H4h/pkg:/source/appMain.brs(258): runtime error ec: 'Dot' Operator attempted with invalid BrightScript Component or interface reference.

258: if msg.isButtonPressed()



sometimes it will still load with it sometimes it wont
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
4 REPLIES 4
kbenson
Visitor

Re: if msg.isButtonPressed() error

Sounds like you are getting invalid instead of an actual message, which was covered somewhat in http://forums.roku.com/viewtopic.php?f=34&t=31487. The simple solution is to throw another check that a valid event message was received (msg <> invalid).
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
FML2010
Visitor

Re: if msg.isButtonPressed() error

is because there is no "then" in there?

ive had issues with them placed in the wrong spot


msg = wait(0, screen.GetMessagePort())
if msg.isScreenClosed() then
print "Screen closed"
exit while
else if msg.isButtonPressed()


or should the "then " be with the elseif msg.isButtonPressed() ?
0 Kudos
kbenson
Visitor

Re: if msg.isButtonPressed() error

The "then" of an if statement is optional, so that has no bearing. I was referring to the msg variable holding an invalid values, so something like this may be required:


msg = wait(0, screen.GetMessagePort())
if msg<>invalid then
if msg.isScreenClosed() then
print "Screen closed"
exit while
else if msg.isButtonPressed()
... do something ...
end if
end if
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
RokuKevin
Visitor

Re: if msg.isButtonPressed() error

We have an open bug we can easily reproduce by hitting the Home button on a script that causes a wait() with a timeout of zero to return an invalid message. We consider this a bug on our part and will fix it.

Do you have another scenario that causes invalid to be returned from a wait() with a timeout of zero??

--Kevin
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.