Forum Discussion

dynamitemedia's avatar
dynamitemedia
Binge Watcher
15 years ago

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

4 Replies

  • 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() ?
  • 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
  • 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