SOL
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2011
12:33 PM
So many ideas
I have read some recent threads of individuals getting frustrated on starting. I can relate but only because of my lack of programming skills. I have ideas that I would like to learn more about, but I am finding frustration in the documentation to some extent.
The information is there, but real life examples I think are something that I need to get a better grasp on things. I continue to read the PDF's, I continue to browse the internet... but still something is missing for me. I thank everyone for the help that is out there, but maybe this isnt for me? I hope that isn't the case and I can find some way to wrap my head around everything.
I am able to Side-Load channels, I am able to use the examples given and load them, and then successfully change minor attributes such as "text" or #color to get a different effect on screen. The problem is when I try and fly.. 😞 and add things that werent originally there.
I understand the power of Roku, streaming and all that.... but I can't even THINK about starting to figure that part out, if I can't do my simple project ideas.
if else statements : RND() : Passing RND() variables to statements to call.
My simple first idea I wanted to try was something in essence of making a coin toss channel
hort = RND(3)
if hort = 1
printMsg("Heads")
else if hort = 2
printMsg("Tails")
end if
The information is there, but real life examples I think are something that I need to get a better grasp on things. I continue to read the PDF's, I continue to browse the internet... but still something is missing for me. I thank everyone for the help that is out there, but maybe this isnt for me? I hope that isn't the case and I can find some way to wrap my head around everything.
I am able to Side-Load channels, I am able to use the examples given and load them, and then successfully change minor attributes such as "text" or #color to get a different effect on screen. The problem is when I try and fly.. 😞 and add things that werent originally there.
I understand the power of Roku, streaming and all that.... but I can't even THINK about starting to figure that part out, if I can't do my simple project ideas.
if else statements : RND() : Passing RND() variables to statements to call.
My simple first idea I wanted to try was something in essence of making a coin toss channel
hort = RND(3)
if hort = 1
printMsg("Heads")
else if hort = 2
printMsg("Tails")
end if
6 REPLIES 6
bandal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2011
02:50 PM
Re: So many ideas
I think there are many in the same boat. I understand that RokuJoel may be writing some better examples or complete apps with descriptions for the next SDK release. I know we need them now, not later.

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2011
04:07 PM
Re: So many ideas
"SOL" wrote:
hort = RND(3)
if hort = 1
printMsg("Heads")
else if hort = 2
printMsg("Tails")
end if
So that should work, if you wrap it up:
sub main()
hort = RND(2)
if hort = 1 then
printMsg("Heads")
else if hort = 2 then
printMsg("Tails")
end if
while true
end while
end sub
The "while" loop is to keep your channel from exiting when it finishes.
FYI rnd(3) output will be 1, 2 or 3. For two value pseudo-random number generation you would do rnd(2). This may be different from what you see on other platforms.
Also, me, personally, I prefer to tack a "then" on the end of my if statements, as a habit, as there are some conditions under which the statement will fail if you leave it off.
- Joel
SOL
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2011
05:59 PM
Re: So many ideas
Thanks Joel.
In the example in the PDF... they used RND(56).... this was stated to give a number between 1-55. I guess I got confused
In the example in the PDF... they used RND(56).... this was stated to give a number between 1-55. I guess I got confused
SOL
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2011
07:41 PM
Re: So many ideas
sub Main()
screen = CreateObject("roPosterScreen")
screen.Show()
hort = RND(2)
if hort = 1 then
screen.ShowMessage("Heads")
else if hort = 2 then
screen.ShowMessage("Tails")
end if
while true
end while
end sub
This is what I ended up with. Thanks again

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011
08:30 AM
Re: So many ideas
"SOL" wrote:
In the example in the PDF... they used RND(56).... this was stated to give a number between 1-55. I guess I got confused
This is what I see in the BrightScript 3.0 Reference Manual:
RND(integer) returns an integer between 1 and integer inclusive . For example, RND(55) returns a pseudo-random integer greater than zero and less than 56.
Maybe this was different in an earlier version?
--Mark
SOL
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011
08:53 AM
Re: So many ideas
You guys are correct. I read it wrong.
Now, 1 last thing before I go.....for now.
If I were to say.... have 2 jpg's *heads.jpg and tails.jpg that I put in the images folder, and instead of wanting the text- I would like one of the images...
Question 1) Do I need roImageCanvas ? (God help me if I do 😉 )
Question 2) What is the path for images contained in 'images' folder to be called by channel
Now, 1 last thing before I go.....for now.
If I were to say.... have 2 jpg's *heads.jpg and tails.jpg that I put in the images folder, and instead of wanting the text- I would like one of the images...
Question 1) Do I need roImageCanvas ? (God help me if I do 😉 )
Question 2) What is the path for images contained in 'images' folder to be called by channel