greubel
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018
11:58 AM
Task subroutine
Can Task code call a subroutine in Main brs code ?
5 REPLIES 5
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018
08:36 AM
Re: Task subroutine
Yes. I believe you can call any subroutine in any file in your source directory.
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
greubel
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2018
08:52 AM
Re: Task subroutine
This isn't true. Here is a call to XR() which fails. It is defined in the main.brs code
Current Function:
018: Sub Activate()
019:* XR(100)
020: x = m.top.Input.data
021: ? "Task in = " x
022: sleep(100)
023: ? "Task exit after 100 milliseconds"
Function Call Operator ( ) attempted on non-function. (runtime error &he0) in pkg:/components/Task.xml(19)
019: XR(100)
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2018
11:59 AM
Re: Task subroutine
afaik you should put the sub in a separate file (eg "mySubs.brs")
and include it from your task's XML; something like:
You could also have a subfolder of /source/ with a bunch of such subs separated out to be included as needed.
and include it from your task's XML; something like:
<script type="text/brightscript" uri="pkg:/source/mySubs.brs" />
You could also have a subfolder of /source/ with a bunch of such subs separated out to be included as needed.
aspiring
greubel
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2018
03:38 PM
Re: Task subroutine
Good idea. Thanks !
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2018
06:04 PM
Re: Task subroutine
"joetesta" wrote:
afaik you should put the sub in a separate file (eg "mySubs.brs")
and include it from your task's XML; something like:<script type="text/brightscript" uri="pkg:/source/mySubs.brs" />
Ah, that's it! Sorry greubel. I knew I was calling subroutines in other source files, but I forgot that I listed the file in the XML.
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.