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.

AppGameKit Classic Chat / are there any substring methods in AGK?

Author
Message
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 5th Jun 2018 09:55
I've been searching the forums, and I find them referencing substring stuff on other boards, but not specifically anything for AppGameKit, and I've searched the help files for everything involving strings, and maybe it's just not easily recognizable? I've searched google, but that doesn't seem to turn anything up either. My reasoning for this is that if I have a number, it's far easier to convert it to a string, then step through each string character index, converting each individual character back to a number to display a score. I'm sure I can write a function to display the score, but it would be infinitely easier with a substring method.

I did experiment with text objects for displaying of numerical data, however, what looks perfect at declared resolution on my computer, looks horrendous on my mobile. Even though I apply the same modifiers to size, and position coords as I apply to my sprites to keep them exactly as I want them (size and position) regardless of window size, the text objects are 4 to 5 times the size they should be, and the text is not as clear at the size I need it to be on the mobile device. So I'm using sprites to display numerical data, which allows me to display very clear numbers in the space I have to display them, with the added bonus that my sprites don't do wild things when the window is resized, or the platform changes. (yes I'm using virtual display, and not using percentages with my size or location data.)

So if anyone could point me toward commands that would permit me to access a string characters by an index, ie "Hello World!" = 0,1,2,3,4,5,6,7,8,9,10,11 I would greatly appreciate it.

Currently I'm thinking of a function similar to the following if there aren't any valid string methods.

Which will work in a roundabout fashion, but what I don't like about it is that it's going to be checking from what is likely going to be a very big number, and it's 5 lines of code per place.
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 5th Jun 2018 10:08 Edited at: 5th Jun 2018 10:25
Ok, I've finally stumbled upon Help/Reference/Core.htm, and when you search the commands for string the relevant string commands relating to substring access (left() & right()) do not show up when you search for STRING! So maybe this should just be in bug reports, maybe a better directory structure in the help file that groups all relevant data together clearly. But standard programming rule applies. Ask for help, and immediately find the answer yourself. Although there aren't specifically any substring commands, it looks like there's ways to step through a string.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 5th Jun 2018 10:28
lol...you seem to be having problems with even the most simple tasks over the last few days.

If your lookiing for a command...use the search option:
https://www.appgamekit.com/documentation/search.html
Searching for "string" brings up the string commands. This take 2 seconds.

The commands a re listed here:
https://www.appgamekit.com/documentation/commands.html

I believe the one you might be interested is Mid()
https://www.appgamekit.com/documentation/Reference/Core/Mid.htm



Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 5th Jun 2018 13:17
Well, search for string, and see what comes up... mid, left, right, don't show up. search substring and get nada. Getting mid, left and right to show up in a search requires searching directly for those commands. So searching for commands with logical thoughts toward finding the information I wanted, namely commands that interact with strings, provides you with a definite lack of commands for interacting with strings, when those commands do exist. I think it's certainly a bug in the documentation.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 5th Jun 2018 17:04
My site isn't up to date on the latest commands, but should contain all of AppGameKit v1. I've incorporated a more broad search method that might help you in the future.

http://www.zimnox.com/resources/agk/docs/search.php
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
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 6th Jun 2018 09:47 Edited at: 6th Jun 2018 09:49
Most Excellent! This is a good resource. Thank you for sharing it!
Already used it to find the command I needed to find next !

Login to post a reply

Server time is: 2024-11-23 20:40:16
Your offset time is: 2024-11-23 20:40:16