Discuss Scratch

xRandomness
Scratcher
6 posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

Hello! Just wondering if anyone knows a solution to my problem, I have a leveling up system with variables in my game, but instead of it showing 10.35, i just want it to show 10, while the .35 is still there in the background, anyone know? thanks
deck26
Scratcher
1000+ posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

So you either need a second variable set to round/floor of the first one. Or you use a text engine to display as much of the variable as you want to display.
xRandomness
Scratcher
6 posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

#2 I did try the second variable, but i found that as soon as it got past level 9, at level 10 it would still only show the first variable, which i tried to fix but couldn't. I might try the text engine, thanks!
deck26
Scratcher
1000+ posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

xRandomness wrote:

#2 I did try the second variable, but i found that as soon as it got past level 9, at level 10 it would still only show the first variable, which i tried to fix but couldn't. I might try the text engine, thanks!
No reason why float or round wouldn't show two or more digits.
ventoaurum
Scratcher
100+ posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

just use round:
(round (decimal number))


(signature)
i make bad decisions professionally
bSpyder
Scratcher
100+ posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

round should work, or floor depending on what you want

set [roundedLvl v] to (round (realLvl))
set [roundedLvl v] to ([floor v] of (realLvl))

Last edited by bSpyder (Nov. 26, 2021 15:44:32)


idk what im doing
xRandomness
Scratcher
6 posts

Making a variable only show the first 1/2/3 ect letters instead of (number).(numbers)

#5 Ayy thanks, it works perfectly, appreciate it! U too @bSpyder

Powered by DjangoBB