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 / Help needed with text files.

Author
Message
lmb
9
Years of Service
User Offline
Joined: 3rd Apr 2015
Location:
Posted: 3rd Apr 2015 12:02
Hi. I'm putting together a revision/school app. I'd like to be able to read from a .txt or .csv file to easily edit a layer that appears as information. When an image is clicked I'd like to bring up a picture and/or layer that has a block of text from the file. The amount of text will change so if the block of text is large I will also need to be able to "flick" the image up and down only to read the text. I hope this makes sense.


Thanks in advance.

lmbeeee
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Apr 2015 20:17
Baxslash posted code to do this here

Quidquid latine dictum sit, altum sonatur
lmb
9
Years of Service
User Offline
Joined: 3rd Apr 2015
Location:
Posted: 6th Apr 2015 15:12
Thank you for the link. I have learned a lot about text and readline commands over the past few days trying to find the best solution.

The script from baxslash certainly is better than just using text on a background, the quality of the text appears very good. Though I keep having a problem with the function deleteTextBox() with gives an error with the "Subscript is out of bounds at line" marked with ##



for i=1 to box.numlines


I have not done anything different with the code. All functions are included in an extra file #include function.agc

if anyone else has any suggestions they too will be greatly received.

lmbeeee
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Apr 2015 16:47
This:

for i=1 to box.numlines

should be:

for i= box.numlines to 1 step -1

(otherwise, by the time you are half way through the deletions, you are trying to access an index that has already been deleted).

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
lmb
9
Years of Service
User Offline
Joined: 3rd Apr 2015
Location:
Posted: 7th Apr 2015 18:51
Thank you BatVink. I really like the idea and the maths behind the half way through issue. However there was another issue with the text and box being removed but the scrollingtext still be present. The use of a new textshown as integer 0 or 1 added to the code made a big difference.

I will continue with this!

lmbeeee

Login to post a reply

Server time is: 2024-04-20 08:38:35
Your offset time is: 2024-04-20 08:38:35