Forum Discussion

scaper12123's avatar
10 years ago

can xml reference functions outside of xml?

I have a function I use to record time that I want to reference in an xml document I'm using to create a countdown timer. Is the code within the xml document capable of recognizing that I am referencing a function within my primary brightscript documents, or do I have to do something special to point that fact out?

to clarify, I have this in the xml document
      sub changeTime(seconds as integer)
        m.label.text = CountdownTime(seconds)
        return
      end sub


And I have this in a brs document
function CountdownTime(seconds as integer) as string
    h = seconds / 3600
    m = (seconds - h * 3600) / 60
    s = seconds Mod 60
    Return h.ToStr() + ":" + Right("0" + m.ToStr(), 2) + ":" + Right("0" + s.ToStr(), 2)
end function

16 Replies

  • renojim's avatar
    renojim
    Community Streaming Expert
    Wow, I really need to read those release notes more often.  There's all kinds of goodness that's been added since the last time I looked.  ğŸ˜„

    -JT
  • "EnTerr" wrote:
    "TheEndless" wrote:
    "EnTerr" wrote:
    I would have, if i could remember it is "\". Today I pondered for a moment if int division was added at some point, even tried "div" and "//" but no dice. Somewhat embarrassing really... 

    If it makes you feel any better, I don't think it was added until 7.0.

    1.5 years ago actually, together with << and >>.  Hindsight 20/20

    And I'm sure you'll find some joy in the fact that the Eclipse plugin still doesn't recognize it as valid syntax...

    Umm... who? [spoiler=star-lord:3blt4gik][youtube:3blt4gik]vWh6VllqX_4[/youtube:3blt4gik][/spoiler:3blt4gik]
    Speaking of which, didn't RokuCo hire someone to write a proper IDE last year? I seem to recollect there was job posting on that which is gone now. So by deduction, one would expect that turd be gone soon?


    As much as I'm sure you're enjoying discussing this, can we please return to the topic at hand? I really would like to figure this stuff out so I can finish up this program. My inexperience with screen graph applications is extreme and cannot find the information I need to solve these problems I'm having from anywhere.
  • "scaper12123" wrote:
    As much as I'm sure you're enjoying discussing this, can we please return to the topic at hand? I really would like to figure this stuff out so I can finish up this program. My inexperience with screen graph applications is extreme and cannot find the information I need to solve these problems I'm having from anywhere.

    My apologies for the diversion. As i said
    The main question however remains...

    I'll leave to the Roku* evangelists on staff to answer it - they are being paid to be enthusiastic about and to shill for the SG xml-ography. The question is broad, so even the more reason it falls under their auspices.
  • "scaper12123" wrote:
    I have a function I use to record time that I want to reference in an xml document I'm using to create a countdown timer. Is the code within the xml document capable of recognizing that I am referencing a function within my primary brightscript documents, or do I have to do something special to point that fact out?


    If I understand what you are asking, you need to reference the code with a script tag:

    <?xml version="1.0" encoding="utf-8" ?>
    <component name="basic" extends="Scene" initialFocus="Channels">
    <script type="text/brightscript" uri="pkg:/components/radio.brs" />
    <script type="text/brightscript" uri="pkg:/source/utils.brs" />


    Hope that helps answer your question, if not, post back here.

    "EnTerr" wrote:

    I'll leave to the Roku* evangelists on staff to answer it - they are being paid to be enthusiastic about and to shill for the SG xml-ography. The question is broad, so even the more reason it falls under their auspices.


    I think most Roku employees are enthusiastic because we believe in the product, the company and the potential for revolutionizing the TV space.
    I don't know anyone who isn't at least a little bit excited, even the people who have been here for many years.

    - Joel
  • "RokuJoel" wrote:
    "EnTerr" wrote:

    I'll leave to the Roku* evangelists on staff to answer it - they are being paid to be enthusiastic about and to shill for the SG xml-ography. The question is broad, so even the more reason it falls under their auspices.

    I think most Roku employees are enthusiastic because we believe in the product, the company and the potential for revolutionizing the TV space.
    I don't know anyone who isn't at least a little bit excited, even the people who have been here for many years.

    RokuJoel,
    perhaps you misread what i said. I was not talking about Roku devices or employees.

    Rather, it was about the "SDK2.0" - hinting that the way scene graph is implemented is far from "great". It's distant from "good" even - on which i opine as someone who has used scene graph elsewhere. So, what i mean was that the paid evangelists are bound by duty to be enthusiastic about rSG - whether they like it (because have not seen better and think it's "the paradigm shift" that makes rSG so hard to use) or not - they ought to follow the party line and promote/explain it. It's like having Trump as GOP nominee - like it or not, have to drum up that "the Donald" is great. OTOH i as "independent voter" have the luxury of choosing what questions to answer.

    I am curious if someone with experience using scene graphs on other platforms can share opinion on rSG ?
    Contrast & compare would be great!
  • "RokuJoel" wrote:
    If I understand what you are asking, you need to reference the code with a script tag:

    <?xml version="1.0" encoding="utf-8" ?>
    <component name="basic" extends="Scene" initialFocus="Channels">
    <script type="text/brightscript" uri="pkg:/components/radio.brs" />
    <script type="text/brightscript" uri="pkg:/source/utils.brs" />


    Hope that helps answer your question, if not, post back here.

    - Joel


    OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOH! Ok, that makes sense. Thank you.