Questions tagged [brightscript]

Brightscript is a BASIC-like language developed for the Roku and Brightsign hardware platforms.

Brightscript is a BASIC-like language developed for the Roku and Brightsign hardware platforms.

Brightscript is single threaded, procedural language with some object oriented features. It lacks support for Classes and Inheritance. Brightscript allows only one global variable, "m". However m can contain a complex global data structure. Arrays are one-dimensional; however, you can create arrays of arrays.

There are two primary types of array variables: roArray and roAssociativeArray.

Arrays can be defined with a CreateObject statement or using shorthand

varname=createobject(roArray,5,true) 

creates an expandable array containing 5 elements. Alternatively:

varname=[]

creates an empty, but expandable Array.

roAssociativeArrays can also be described as a data dictionary. They can be created as follows:

varname=createobject(roAssociativeArray)

or

varname={}

using curly brackets.

To assign values to an Array:

varname=[100,200,"ABCD","ZYXW"]

or

varname[0]=100
varname[1]=200
varname[2]="ABCD"
varname[3]="ZYXW"

to assign values to an AssociativeArray or "AA":

varname={name:"John Smith",address:"1023 West Alameda",telephone:"415-555-1212"}

or

varname={}
varname["name"]="John Smith"
varname["address"]="1023 West Alameda"
varname["telephone"]="415-555-1212"

a mode which allows almost any ASCII character to be used as a key, or, using dot notation:

varname={}
varname.name="John Smith"
varname.address="1023 West Alameda"
varname.telephone="415-637-1283"

Aside from the usual text and numeric manipulation functions, Brightscript also has specialized objects that can be created, such as "roAudioPlayer", "roVideoPlayer" and many different display screen types, the most commonly used are "roPosterScreen" and "roGridScreen". These objects are created and assigned a reference variable in the following manner:

screen=CreateObject("roPosterScreen")

It could then be populated:

item1={ShortDescriptionLine1:"item 1"}
item2={ShortDescriptionLine1:"item 2"}
item3={ShortDescriptionLine1:"item 3"}

content=[item1,item2,item3]   

screen.setcontentlist(content)

Note that item 1 2 and three are roAssociativeArrays and that content is an roArray containing three roAssociativeArrays.

To display the screen:

screen.show()

Instead of a REM statement, Brightscript uses the single quote:

'this is a comment

Program Execution statements include:

  • For / End For / Exit for
  • While / End While / Exit While
  • If / Then / Else / Else If / End If

Brightscript is not Case Sensitive for the most part; however, string comparisons and AssociativeArray keys can be case sensitive.

For more information on Brightscript, please see the following links:

Roku Developer Guide

BrightScript Language Reference

Roku Developer Program signup link

And the frequently helpful Roku Developers Forum

415 questions
12
votes
7 answers

How can I do mod without a mod operator?

This scripting language doesn't have a % or Mod(). I do have a Fix() that chops off the decimal part of a number. I only need positive results, so don't get too robust.
tladuke
  • 1,337
  • 2
  • 11
  • 22
7
votes
2 answers

How to make api request to some server in roku

I am very much new in working with roku and roku specific language( BasicScript ). I need to make api calls to some server to get the channels. I am not understanding how to do it in roku. Please suggest.
user850234
  • 3,373
  • 15
  • 49
  • 83
6
votes
1 answer

Redirect to Home page After Clicked Save button using bright script?

I have created Login Screen and setting URL Screen in bright script with the credential username, password in Login screen and setting URL in setting URL Screen with two buttons save and setting. Here simply my Login Screen: Login…
6
votes
1 answer

How to move focus between a keyboard and button group on a screen?

So, for a project at work, we have been tasked with creating a Roku app for a client. Sorry if this is a stupid question, but I have never touched brightscript or Roku development in general, and am mostly a react/javascript developer. I am plugging…
6
votes
1 answer

Read and write from temp file in Roku

In Roku, how do I read and write data from a temporary file in the folder tmp:? I cannot find any documentation relating to this. The data which I am storing is too big to be stored in the registry.
khateeb
  • 5,265
  • 15
  • 58
  • 114
5
votes
0 answers

Why is Roku player throwing error "reader pick stream error:bad:invalid or corrupt playlist" when play a Stream using AKAMAI CDN

We are using the Akamai CDN HLS stream for one of our OTT apps. This app has two types (Live & VOD) stream URLs. When playing the VOD content the Roku player plays the stream smoothly but when we play Live Stream content, the Roku player throws the…
Vijay Kumar
  • 141
  • 1
  • 13
5
votes
2 answers

How can we test Roku application

I'm new to Roku development (in R&D phase actually). I read that we can't test Roku app on simulator and need real device. If we develop an application, how will we test it? I checked Roku developer site and different links on internet, but could…
Fayza Nawaz
  • 2,256
  • 3
  • 26
  • 61
4
votes
2 answers

Play MultipleAudioTrack in Roku

I know about Roku doesn't support multiple videos at a time. But, Some Developers are mix up two things multiple playbacks and multiple audio tracks. Roku Does Support Multiple Audio Track? I tried to Play MultipleAudioTrack in Roku. I used the…
4
votes
3 answers

Difference Between m and m.top in brightscript?

This Difference available on Roku Forum. But I didn't Understand. Does anyone know this difference and its attribute?
4
votes
1 answer

How to use Circle image View in Roku..?

I am using BrightScript and SceneGraph components to display an image in a circle view but Circle View option is not found. I want a view like the image below:
Raj G
  • 73
  • 8
4
votes
3 answers

Roku - ButtonGroup advance focus with left and right keys

I am pretty new to Roku world. I smell like its a very simple and straight forward question, but was not able to figure out any solutions. Any help would be much appreciated. I was trying to create a sample application which includes three button in…
nithin ks
  • 285
  • 3
  • 11
4
votes
2 answers

Error: Install Failure: No manifest. Invalid package.Install Failure: No manifest

Hi I am just beginning with Roku development. I downloaded the sdk and have been trying to run an hello world application. I have a source folder and a manifest file. But I still keep getting the following error: Error: Install Failure: No…
G droid
  • 956
  • 5
  • 13
  • 36
4
votes
2 answers

Call function from another file in BrightScript

I have two files in source folder (BrightScript project), file a.brs and file b.brs There is a function in a.brs file function aa() print "Hello World!" end function and I want to call it from b.brs aa() There is an error Function Call…
javagc
  • 846
  • 1
  • 17
  • 37
3
votes
4 answers

Navigation concept in Roku

I am facing some issue in screen navigation in Roku Brightscript. Please, anyone, help me how I can manage 5-6 screen in my Roku project. I want to navigate from 1 to 2 screen and also want to back from that screen. This is some major issue I have…
3
votes
1 answer

Click button not fire a click Event and how to navigate another panel in ROKU

I create the Login panel in Roku. At a Login time, I click ok button to navigate another panel it is possible. I create a login panel with using two text boxes one for username and another for password and two buttons one for sign-in and another for…
1
2 3
27 28