import text file
-
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.
-
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.
-
How can I import a prepared text file (e.g. json format or simple comma separated values) into an array?
@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. :)
-
@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? -
@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.
-
@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? -
@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)?
-
@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)?
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
