How do I count lines

Get help using Construct 2

Post » Mon Sep 01, 2014 9:40 am

hello there :) how do i count numbes of the lines from text object?
B
6
S
1
Posts: 53
Reputation: 506

Post » Mon Sep 01, 2014 10:23 am

tokencount(src, separator)

Read up on it here
but it will be tokencount(text.text,newline)
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon Sep 01, 2014 10:45 am

no, its now good for me. because if sentence is too long, the newline wont work
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 53
Reputation: 506

Post » Mon Sep 01, 2014 11:24 am

Then count number white spaces " " and divide by average number words per line... how accurate do you want it because even word isn't accurate it is best guess.

Total number words/average number words per line gives you a pretty good idea of total lines.
round(tokencount(text.Text," ")/10)
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon Sep 01, 2014 11:36 am

Message: Shuher is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
well it's not good too)) because i need exact number. i need to split very big text, and then set one part right down from previous. why? because max text object height is 15 898 and it is not enough for my project.
B
6
S
1
Posts: 53
Reputation: 506

Post » Mon Sep 01, 2014 11:45 am

Are you showing the full 15 898 lines?
You can insert a special character on each line like word does for paragraphs? And remove it later?
But text isn't the best option, you should be using an array and build it from there.

Is it an online book? because text object has limits in place for a reason. You don't need to load it all it one go or rather you shouldn't.
You are going to have performance issues I would imagine?

Anyways, google how to make a text editor like word etc. They have the formula's you need, and how to hack up a piece of text.

My guess you will be using RegexMatchCount /search/replace/match - lol - good luck.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon Sep 01, 2014 11:59 am

ok, ty. i'll google text editors :)
B
6
S
1
Posts: 53
Reputation: 506

Post » Sat Sep 06, 2014 2:48 pm

i googled text editors, and yes, this was bad idea to load full text at once.
now i'm splitting text to pages, and draw pages only when it's necessary. but still there is a problem with text objects. i'm using 2 text objects for previous and next page. when previous page is gone from screen, next page will appear. but there is always some space between them. because text object's height is fixed. i need to calculate exact number of lines, then calculate height of text object and place other text right under first one... how??)))
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 53
Reputation: 506


Return to How do I....?

Who is online

Users browsing this forum: ksiads and 1 guest