'Subroutines
'Ask for string
Sub GetString
If EmptyString = "True" Then 'Makes the prompt red in case the user pressed Enter/Return without entering anything
TextWindow.ForegroundColor = "Red"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 0
TextWindow.WriteLine("Enter the string you want to scroll below:")
Else 'This is where the program will go to the first time the sub is called
TextWindow.ForegroundColor = "White"
TextWindow.WriteLine("Enter the string you want to scroll below:")
EndIf
'Assign the user's string to a variable
String = TextWindow.Read()
If String = "" Then 'If the user entered an empty string then ask again (basically loops to the first IF statement in this sub)
EmptyString = "True"
GetString()
Else
EmptyString = "False"
EndIf
'Ask for string colour
Sub GetColour
'If GetString prompt was red, this will fix that.
TextWindow.ForegroundColor = "White"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 0
TextWindow.Write("Enter the string you want to scroll below:")
If EmptyColour = "True" Then 'Makes the prompt red in case the user pressed Enter/Return without entering anything
TextWindow.ForegroundColor = "Red"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 3
TextWindow.Write("(R)ed, (G)reen, (B)lue, or (Y)ellow text: ")
Else 'This is where the program will go to the first time the sub is called
TextWindow.ForegroundColor = "White"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 3
TextWindow.Write("(R)ed, (G)reen, (B)lue, or (Y)ellow text: ")
EndIf
'Assign the user's string to a variable
Colour = TextWindow.Read()
If Colour = "" Then 'If the user entered an empty colour then ask again (basically loops to the first IF statement in this sub)
EmptyColour = "True"
GetColour()
Else
EmptyColour = "False"
EndIf
GetDirection()
EndSub
'Ask for scroll direction
Sub GetDirection
'If GetColour prompt was red, this will fix that.
TextWindow.ForegroundColor = "White"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 3
TextWindow.Write("(R)ed, (G)reen, (B)lue, or (Y)ellow text:")
If EmptyDir = "True" Then 'Makes the prompt red in case the user pressed Enter/Return without entering anything
TextWindow.ForegroundColor = "Red"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 5
TextWindow.Write("(L)eft or (R)ight scroll direction: ")
Else 'This is where the program will go to the first time the sub is called
TextWindow.ForegroundColor = "White"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 5
TextWindow.Write("(L)eft or (R)ight scroll direction: ")
EndIf
'Assign the user's string to a variable
Dir = TextWindow.Read()
If Dir = "" Then 'If the user entered an empty colour then ask again (basically loops to the first IF statement in this sub)
EmptyDir = "True"
GetDirection()
Else
EmptyDir = "False"
EndIf
GetSpeed()
EndSub
'Ask for scroll speed
Sub GetSpeed
'If GetDirection prompt was red, this will fix that.
TextWindow.ForegroundColor = "White"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 5
TextWindow.Write("(L)eft or (R)ight scroll direction: ")
If EmptySpeed = "True" Then 'Makes the prompt red in case the user pressed Enter/Return without entering anything
TextWindow.ForegroundColor = "Red"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 7
TextWindow.Write("(0.25), (0.5), (1), (2), (4), or (8) characters/second: ")
Else 'This is where the program will go to the first time the sub is called
TextWindow.ForegroundColor = "White"
TextWindow.CursorLeft = 0
TextWindow.CursorTop = 7
TextWindow.Write("(0.25), (0.5), (1), (2), (4), or (8) characters/second: ")
EndIf
'Assign the user's string to a variable
Speed = TextWindow.Read()
If Speed = "" Then 'If the user entered an empty colour then ask again (basically loops to the first IF statement in this sub)
EmptySpeed = "True"
GetSpeed()
Else
EmptySpeed = "False"
EndIf
Animate()
EndSub
Sub Animate
TextWindow.Clear()
TextWindow.Title = "Scrolling Marquee - "+String
'Set Text Colour
If Text.ConvertToUpperCase(Colour) = "R" Then
TextWindow.ForegroundColor = "Red"
ElseIf Text.ConvertToUpperCase(Colour) = "G" Then
TextWindow.ForegroundColor = "Green"
ElseIf Text.ConvertToUpperCase(Colour) = "B" Then
TextWindow.ForegroundColor = "Blue"
ElseIf Text.ConvertToUpperCase(Colour) = "Y" Then
TextWindow.ForegroundColor = "Yellow"
EndIf
'Set Inc variable to be later used for the animation speed and direction
If Text.ConvertToUpperCase(Dir) = "L" then
Pos = 79
If Speed = "0.25" then
Inc = -0.125
ElseIf Speed = "0.5" then
Inc = -0.25
ElseIf Speed = "1" then
Inc = -0.5
ElseIf Speed = "2" then
Inc = -1
ElseIf Speed = "4" Then
Inc = -2
ElseIf Speed = "8" Then
Inc = -4
EndIf
ElseIf Text.ConvertToUpperCase(Dir) = "R" Then
Pos = 0
If Speed = "0.25" then
Inc = 0.125
ElseIf Speed = "0.5" then
Inc = 0.25
ElseIf Speed = "1" then
Inc = 0.5
ElseIf Speed = "2" then
Inc = 1
ElseIf Speed = "4" Then
Inc = 2
ElseIf Speed = "8" Then
Inc = 4
EndIf
EndIF
TextWindow.CursorTop = 25
Running = "True"
While Running
TextWindow.Clear()
If Text.ConvertToUpperCase(Dir) = "L" Then
If Pos < Speed then
Pos = 79
EndIf
ElseIf Text.ConvertToUpperCase(Dir) = "R" Then
If Pos > (80-Speed) then
Pos = 0
EndIf
EndIf