How do I remove decimal points from text object?

Get help using Construct 2

Post » Tue May 13, 2014 6:28 pm

Hi everyone,

In this scenario I have two scores, (ScoreA and ScoreB) where ScoreB is simply a factor of the ScoreA (say ScoreA divided by 10). Of course though this means ScoreB ends up being numbers like 1.1. How do I make it so that ScoreB is ONLY whole numbers?

For Example:

ScoreA = 107
divided by 10
ScoreB = 10.7

How can I make it so scoreB only shows 10 (omitting or removing the .7).

Thanks!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Tue May 13, 2014 6:32 pm

ScoreB = int(10.7)
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Tue May 13, 2014 7:11 pm

granpa wrote:ScoreB = int(10.7)


Thanks granpa! Perfect.
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Tue May 13, 2014 7:20 pm

TMAJA wrote:
granpa wrote:ScoreB = int(10.7)


Thanks granpa! Perfect.


You might also want to lookup Ceil , Round , and Floor

ceil(x) Round up x e.g. ceil(5.1) = 6
floor(x) Round down x e.g. floor(5.9) = 5
round(x) Round x to the nearest whole number e.g. round(5.6) = 6
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Tue May 13, 2014 8:15 pm

granpa wrote:
TMAJA wrote:
granpa wrote:ScoreB = int(10.7)


Thanks granpa! Perfect.


You might also want to lookup Ceil , Round , and Floor

ceil(x) Round up x e.g. ceil(5.1) = 6
floor(x) Round down x e.g. floor(5.9) = 5
round(x) Round x to the nearest whole number e.g. round(5.6) = 6



Thank you! Its always nice to get a bit of extra information along with a helpful answer.

Very much appreciated.
B
13
S
6
Posts: 130
Reputation: 1,553


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, Uk4dee and 29 guests