Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. import text file

import text file

Scheduled Pinned Locked Moved Help and Support
10 Posts 4 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • LupoL Offline
    LupoL Offline
    Lupo
    wrote on last edited by
    #1

    How can I import a prepared text file (e.g. json format or simple comma separated values) into an array?

    RobinsonXR 1 Reply Last reply
    1
    • TutorialDoctorT Offline
      TutorialDoctorT Offline
      TutorialDoctor
      wrote on last edited by TutorialDoctor
      #2

      A dictionary seems like it would be a more suitable behavior to use instead of an array. What are you trying to accomplish? You can use the HTTP Request behavior if your JSON file is stored somewhere on the internet.

      1 Reply Last reply
      1
      • MurtazaM Offline
        MurtazaM Offline
        Murtaza
        Admin
        wrote on last edited by
        #3

        Since apple makes the ios file system difficult to access (until recently with the addition of the files app) you can't exactly import a text file.

        However as suggested, you can have a file stored online somewhere and have you game import it with http requests.

        @RobinsonX has done this quite a bit and may have an example on it.

        1 Reply Last reply
        2
        • LupoL Lupo

          How can I import a prepared text file (e.g. json format or simple comma separated values) into an array?

          RobinsonXR Offline
          RobinsonXR Offline
          RobinsonX
          wrote on last edited by RobinsonX
          #4

          @Lupo You can import any text into hyperPad into a behavior.

          The Value behavior is a perfect way to store values, which you can plug it into any other behavior you wish to manipulate this value with. (You can copy and paste values in there)

          If you want to use JSON, you can simply plug the JSON string into Modify Array / Modify Dictionary. In both of these behaviors, there's an option to set the array / dictionary so you can manipulate these data structures to its fullest. :)

          1 Reply Last reply
          1
          • RobinsonXR Offline
            RobinsonXR Offline
            RobinsonX
            wrote on last edited by
            #5

            If you have something other than JSON, say like a comma-seperated list, then you can use something like Text Operation to split a string and form an array.

            1 Reply Last reply
            1
            • LupoL Offline
              LupoL Offline
              Lupo
              wrote on last edited by
              #6

              @RobinsonX I have a few MB comma separated text file I would like to import into array or dictionary. I can put it into Dropbox and with a direct download link I could donwload it with HttpRequest.
              Do you have an example of a GET HttpRequest and reading response and put into array/dictionary?

              RobinsonXR 1 Reply Last reply
              1
              • RobinsonXR Offline
                RobinsonXR Offline
                RobinsonX
                wrote on last edited by
                #7

                @Lupo Currently, there's no way to import text as a file. The only ways are copying and pasting it (yes, it works for larger texts too that is in MB) or using something outside of hyperPad to store your text file and accessing that.

                If you want to store your text file online, I recommend using something like Firebase by Google. You can store your text file there and then access it via URL without dealing with authentication or advanced API stuff.

                1 Reply Last reply
                0
                • LupoL Lupo

                  @RobinsonX I have a few MB comma separated text file I would like to import into array or dictionary. I can put it into Dropbox and with a direct download link I could donwload it with HttpRequest.
                  Do you have an example of a GET HttpRequest and reading response and put into array/dictionary?

                  RobinsonXR Offline
                  RobinsonXR Offline
                  RobinsonX
                  wrote on last edited by
                  #8

                  @Lupo Here is an example using HTTP Request

                  0E338E6E-1D03-454C-94FA-E4EE34AC49B5.png

                  LupoL 1 Reply Last reply
                  0
                  • RobinsonXR RobinsonX

                    @Lupo Here is an example using HTTP Request

                    0E338E6E-1D03-454C-94FA-E4EE34AC49B5.png

                    LupoL Offline
                    LupoL Offline
                    Lupo
                    wrote on last edited by
                    #9

                    @RobinsonX Thanks for the sample. But how are the values separated and stored in the array? By magic 😉 or do I need to parse the txt file (comma separated strings)?

                    RobinsonXR 1 Reply Last reply
                    0
                    • LupoL Lupo

                      @RobinsonX Thanks for the sample. But how are the values separated and stored in the array? By magic 😉 or do I need to parse the txt file (comma separated strings)?

                      RobinsonXR Offline
                      RobinsonXR Offline
                      RobinsonX
                      wrote on last edited by
                      #10

                      @Lupo Oh yeah I forgot but you would use Text Operation if you're importing a comma-seperated string.

                      If you use the split feature in that behavior, then it will output an array that can be plugged into Modify Array to set the array.

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Search