Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / List of all "ARRAY" commands in AGK

Author
Message
SirRolo
1
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 17th Dec 2017 19:38
I am having trouble with using text strings in an array. Is there a command to use the index number of an array? There was in dark basic and I did not have to create a length of an array every time I needed to use a list of strings. I have searched the whole internet and I come up with just the help info on the AppGameKit page. I would really just like a list of all basic commands but the help page list of commands has no array commands in them. It is only on the types, array and arrays with version 2. I would like a list of all the commands if possible.
Phaelax
DBPro Master
14
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Dec 2017 14:27
Can you show what code you're using? As I'm aware, using the index number is the only way to access an array.
+ Code Snippet
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
SirRolo
1
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 18th Dec 2017 19:53
I was having trouble with putting text on the screen trying to use the MyArray$[1] as an integer, Example CreateText( MyArray$[1] ,MyString$[x ), when that statement was a String Value. If I could have used the index number of the array, Which would have been an integer, I thought it would be easier. The more I use AppGameKit the more i am getting used to it.



Phaelax
DBPro Master
14
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Dec 2017 13:49
Quote: " CreateText( MyArray$[1] ,MyString$[x ),"


By the looks of it, MyArray$ is a string and thus that syntax is incorrect. You cannot assign a text object to a string array.
https://www.appgamekit.com/documentation/Reference/Text/CreateText.htm

You can do something like this:
+ Code Snippet


Or, simplify it using a UDT. The benefit here is you don't have to worry about the integrity of the data in keeping two arrays parallel.

+ Code Snippet


And, depending on what you're doing, you don't really even need to save the text in a separate array if you're creating a text object for each one. As it's already being stored in the text object itself, just keep an integer array of the indices and retrieve the text string this way as needed: myString = getTextString(index)
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
SirRolo
1
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 20th Dec 2017 05:43
I di the first code snippit now. If I did the second, I could have an index but it would be adding more code. The original reason of using the array.index that Dark Basic let me use was to save making more code. No biggie. Thank you for the examples though.

Login to post a reply

Server time is: 2018-01-23 01:55:55
Your offset time is: 2018-01-23 01:55:55