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 / Tier 1 - Cut a long string into slices

Author
Message
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 24th Jun 2014 02:42 Edited at: 8th Dec 2014 14:29
This function cuts a long string into slices.

I would really like to post this in the Snippet area, but this thread seems to be closed.




EDIT:

This code will give you a RPG style Text output, if you press the spacekey
(AGK1)




EDIT2: Full dialoge engine (spacekey to move)








[/url]

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 24th Jun 2014 02:56 Edited at: 24th Jun 2014 03:00
im wondering if your familiar with...

a$=getstringtoken(largestring$,".",1)

using tokens can split the string very nicely and is great for reading text files that contain data to split from it.

a perfect example would be for you to split your string into sentences. your token to look for would be"." and just specify what sentence you want to strip from the bigger string.

if your not sure how many tokens were found in a string you can count them using tokencount=countstringtokens(largestring$,".")

largestring$ being your large string to strip into smaller strings.

hope that helps... also " " (space) as a token would split the string into every word as separate strings

Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 24th Jun 2014 04:08
Hello SoftMotion!

I tried the getstringtoken command, but this command was limited to my demands. I wanted a text split function based on a maxium char length.
This function cuts the string to the maximum char length and search for the last space key in the string.

I don't have found a way to use the getstringtoken command for this operation. But I think this could be much faster than my method.

[/url]
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 24th Jun 2014 05:00 Edited at: 24th Jun 2014 05:01
oh I see.. its to split a string for a certain text length...yeah the token command can not really be useful for that then.

Nice function!

Login to post a reply

Server time is: 2024-11-25 06:25:42
Your offset time is: 2024-11-25 06:25:42