How to calculate text length to determine loop cycle?

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
xboxown
001 Subscriber
 
Joined: Sun Jun 03, 2012 2:28 am

How to calculate text length to determine loop cycle?

Postby xboxown » Fri May 20, 2016 11:57 pm

Hey,

This maybe an advance script request but I will explain exactly what scenario I am looking at. I have a picture of a book opened with 10 fields on one page and 10 fields in the other page. Of course each field is underneath the top field. My intention is to take the string and check each 15 characters of the line of the string and put it in field 0, then the next 15 characters string put it in field 1, then the next 15 characters put it in field 2 and repeat until I have reached field 20 (which is second page of the book). However, if there are more texts then I wait for the user to left click the mouse button and then erase all the texts on the fields and then add the next 15 length of the text on field 0 and the next 15 length of the text on field 1 until I exhaust all the characters from the variable stored in string. I was thinking of using collections as collections will be like an array that stores the characters in it.

So I was thinking the first thing I would do...is use the method above and loop for certain amount and take 15 characters from the string and insert it into collection, then repeat the loop for each 15 characters until there are no more characters left and all the 15 characters are inserted into the collections. When the number of collections are inserted with their 15 characters each there will be another loop engine where it reads the first index of the collection and put it in field 0, the next index of collection and put it in field 1 and repeat until it reaches field 20. Then there will be another check on the loop if there are more than 20 indexes it waits for the mouse button to be clicked...erase all the fields in the interface system (text not delete the action field mind you), continue looping for another 20 indexes and repeat procedure until there are no more indexes to loop. If the last loop is 5 not 20 indexes for example...it will display the last contents on the left side of the page for field 0,1,2, 3,4 and 5.

While i may think I have the solution written on words and logically I should be able to implement it as I have the answer, I am not so sure how to begin, where to begin and what I need to do to make it work? Is the above solution I put above is correct? Do you guys have another alternative answer that will get the result better? What advice do you have? Can someone give me a starter code where the light bulb will appear on top of my head and I can build upon it and get it working?


Here is my script so far



Image. I think I am half way in my attempt. Problem I have is the second line. It should be in the 1st line:

Many of the pages
are damaged and
etc
etc etc
then when it is on the second page it waits for the mouse button to be clicked before it erases the text and continue looping adding the remaining text on the top left side of the page again. Any help would be greatly appreciate it on my error. I am sharing my script in hope someone can shed light into where I am stuck.
Attachments
bookissue.png
Image
Check out my blog at http://gamemakermagazine.com

Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron