Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Skaeren on December 05, 2015, 05:00:09 PM

Title: [Request] new Set Float action [Solved]
Post by: Skaeren on December 05, 2015, 05:00:09 PM
I was wondering if someone could make me a set float action that will set the float value like this:

float=intX.intY

Just in case it is difficult to read, what I mean is that the float, given floats are decimal, is a number where intX is the whole number and intY becomes the decimal portion of the float.
Title: Re: [Request] new Set Float action
Post by: Auggie on December 05, 2015, 08:51:37 PM
Can can use Convert Float To String action possibly ?  If you use that you can print out as many decimal places as you like with the Format field in the action.

Just use Nx in the Format part of the action where x is the number of decimal places you'd like to use.  IE 1.123456 with N3 in the format field will store 1.123 in the string.

Here's the complete list for formatting options
https://msdn.microsoft.com/en-us/library/dwhawy9k.aspx
 
Title: Re: [Request] new Set Float action
Post by: dudebxl on December 05, 2015, 09:01:47 PM
here you go:

http://hutonggames.com/playmakerforum/index.php?topic=11775.0

+ bonus: http://hutonggames.com/playmakerforum/index.php?topic=11776.0
Title: Re: [Request] new Set Float action
Post by: Skaeren on December 07, 2015, 06:56:57 PM
Thanks so much! The reason I needed this was because the project I am working on features a hex grid, with each hex having an int value for its horizontal hex position, and it's vertical hex position. To make checking specifics for a particular hex easier, I wanted their hex coordinates stored as a float, with the x axis hex value being pre-decimal and their y axis hex value being post-decimal.

So, once again, thank you so much!
Title: Re: [Request] new Set Float action
Post by: jeanfabre on December 08, 2015, 12:43:27 AM
Hi,

 Thanks dubebxl :) you should definitly tweet about them to get even more exposure.

 https://twitter.com/JeanAtPlayMaker/status/674101582921867264

Bye,

 Jean
Title: Re: [Request] new Set Float action
Post by: Skaeren on December 08, 2015, 01:21:33 AM
I, once again, need help. Using split int to float gives my float a value of NaN. Both Ints are positive in value. I have also tested split float to int incase I was using the wrong one, and it does not modify the float variable, so I am assuming split int to float is the correct one.

Could it be because of my own personal modification adding an every frame bool?
Title: Re: [Request] new Set Float action
Post by: dudebxl on December 08, 2015, 09:49:42 AM
hi,

mmm weird cause it works on my side (there are limitations and it is best to keep your ints to max 3/4 digits - if you have large numbers then you will have to use strings to avoid having unity rounding the float). I have added everyframe to both actions so please re-download from eco, test and let me know.
Title: Re: [Request] new Set Float action
Post by: dudebxl on December 08, 2015, 09:50:29 AM
@jeanfabre

thx dude..  ;D
Title: Re: [Request] new Set Float action
Post by: Skaeren on December 09, 2015, 03:08:07 AM
Works perfectly, thanks heaps!