For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
Truncating float returns
- gopostal
- OldUnreal Member
- Posts: 1005
- Joined: Thu Jul 31, 2008 9:29 pm
Truncating float returns
UEngine defaults float returns to six decimals. For example you would get the return of "3.333333" when the decimal repeats. Is there a simple way to truncate that return to one or two decimal places without having to convert to a string value and then parsing the string after the "."? I looked through the function list and I can't find anything.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day
- yrex .
- OldUnreal Member
- Posts: 275
- Joined: Wed May 06, 2015 6:46 am
- Contact:
Re: Truncating float returns
int(x*100)/100, but it may introduce some error.
My work | contact: ampoyrex at wp dot pl
- gopostal
- OldUnreal Member
- Posts: 1005
- Joined: Thu Jul 31, 2008 9:29 pm
Re: Truncating float returns
Thank you y, this is exactly what I needed. I see the introduced error but it's slight enough that it works just fine.
BTW, in case this bubbles up in a google search here is how I was able to get to where I wanted to go...
BTW, in case this bubbles up in a google search here is how I was able to get to where I wanted to go...
Code: Select all
//Kills to Deaths Ratio computation (protects from divide-by-zero)
If(PRI.Deaths
Last edited by gopostal on Wed Sep 11, 2019 4:54 pm, edited 1 time in total.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day
- []KAOS[]Casey
- OldUnreal Member
- Posts: 4497
- Joined: Sun Aug 07, 2011 4:22 am
- Location: over there
Re: Truncating float returns
it's too bad fstring printf was never exposed to unrealscript, i use it all the time in native code
- gopostal
- OldUnreal Member
- Posts: 1005
- Joined: Thu Jul 31, 2008 9:29 pm
Re: Truncating float returns
Your posts came up in almost every google search I did trying to solve this. I admit I didn't understand what you were advocating for but now that I've dealt with the issue I see what you mean. There needs to be a better way to get from A to B on this, something native and much faster than code to truncate returns.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day