0 Favourites

How do I count lines

  • hello there how do i count numbes of the lines from text object?

  • tokencount(src, separator)

    Read up on it here

    but it will be tokencount(text.text,newline)

  • no, its now good for me. because if sentence is too long, the newline wont work

  • 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)

  • 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.

  • 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.

  • ok, ty. i'll google text editors

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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??)))

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,158
karshinkoff's avatar
karshinkoff
Unread hot topic
56 4,736
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
0 Favourites
Why is Stencyl doing better?
44 16,859
Potato's avatar
Potato