smallbasic

How do I make a typewriter text effect in Small Basic?


I want to make a typewriter text effect in small basic, but I'm not sure how. I've tried many ways, but none of them worked.


Solution

  • This is how you would use rpg text in Small BASIC:

    dialogueText = "add text here"                  'Text string
    dialogueTextX = (X)                             'X value for the text to appear
    dialogueTextY = (Y)                             'Y value fpr the text to appear
    rpgText()                                       'Calls the sub
    
    
    Sub rpgText
      textLength = Text.GetLength(dialogueText)                'Getting loop value
      textCheck = 1                                            'Start of string
      textCheck2 = 1                                           'Length of string
      textInput = Text.GetSubText(dialogueText, textCheck, 1)  'Grabs a letter from the string
      textOutput = Shapes.AddText(textInput)                   'Displays the letter grabbed
      For i = 1 To textLength                                  'Loop
        Shapes.SetText(textOutput, textInput)                  'Adding to that letter to form the string
        Shapes.Move(textOutput, dialogueTextX, dialogueTextY)   'Moves it to X and Y value specified
        textCheck2 = textCheck2 + 1                             'Value to grab letter
        textInput = Text.GetSubText(dialogueText, 1, textCheck2)'Grabs letter 
        Program.Delay(20) '
      EndFor
    EndSub
    

    (Yes I know I responded to my own question, but this has been tested and it works.)