ID:1028178
 
(See the best response by NNAAAAHH.)
Code:
var/numberHun=src.level/100


Problem description:
I want to make it so if numberHun=1.5 that the .5 is cut and the 1 is all that remains. In Java I would just convert it to an integer but can't do that in BYOND? So how do I do this?

Nevermind. I figured out I could use copytext. Awesome :)
In response to Ganing
Best response
Might wanna try round() instead.
Galactic Soldier wrote:
Actually, in Java that's called casting, and the same effect could be done in DM using a recreation of the floor procedure. DM also uses floats for its numeric literals. I'm not going to provide an example, because you need to learn the basic fundamentals of programming first.

I already know the basic fundamentals of programming, that class was fairly simple besides having to learn the different terms for everything. o.o

and thanks NNAAAAHH. But in the end I just decided to use copytext for the system I was trying to make. I was working on putting the players level on the client.screen
In response to Ganing
It's a lot more efficient to use round(). If you're putting this in maptext, you'll have to do:
maptext = "[round(number)]"

// This won't work:
maptext = round(number)
In response to Kaiochao
Kaiochao wrote:
It's a lot more efficient to use round(). If you're putting this in maptext, you'll have to do:
> maptext = "[round(number)]"
>
> // This won't work:
> maptext = round(number)
>


Yeah I know. I ended up not doing the division as that was just something I was thinking at the time. In the end I just did this for the hundreds place, tens place, and ones place. Came out really well!

var/numberHun1="[src.level]"
var/numberHun="[copytext(numberHun1,1,2)]"