playMaker

Author Topic: Int Interpolate  (Read 7015 times)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Int Interpolate
« on: June 25, 2014, 10:55:40 AM »
Same as Float Interpolate, but for integers.

Update 15Jun2014: This action has been cloned in Ecosystem.
« Last Edit: July 15, 2014, 02:13:42 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #1 on: July 18, 2014, 09:41:20 AM »
Hi Lane,

Would you be able to adjust this so that the Finish Event waits another frame?

I'm running into the problem where I'm using this, and Int to String every frame to display my Int, but the final value of what is converted to a String is slightly lower than the final Int value.

See the screenshot.

At least that's what I guess the problem is.

I need to use the Finish event to progress to the next state, but this seems to cause my problem.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Interpolate
« Reply #2 on: July 18, 2014, 11:06:52 AM »
Man, this one had me worried!

The trouble is that the same action is...
1) Computing the final number
2) Sending the finished event (at the end of its Update process)

This means that as soon as the interpolate is done then the state will exit in the same Update. So if the interpolate is put at very top or bottom of the stack then the string will not be built to the final score because other actions need to do some work but Int Interpolate is all "k im done we're leaving screw you guys". It's basically boils down to you not being able to use the Int Interpolate action in a stack with other actions if the Int Interpolates finish event is used.

So, you can solve by using a Wait (with the same Time variable) to fire the finish or you can finish the state as-is and just build the final score string in the next state without interpolating anything. You wouldn't notice anything weird visually either way.
« Last Edit: July 18, 2014, 11:09:26 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #3 on: July 18, 2014, 12:09:23 PM »
Thanks for the clarification. I think I'll try both methods you recommended and see which is less hassle to manage.

Given "It's basically boils down to you not being able to use the Int Interpolate action in a stack with other actions if the Int Interpolates finish event is used."... would making the finish event wait a frame be a potential way around that?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Interpolate
« Reply #4 on: July 18, 2014, 12:11:48 PM »
It would be fixed it the action checked if it was done at the beginning of the update, rather than the end. That way, the calculation would finish and the other actions would have one update cycle to catch up before the interpolate action ran again and realized it needs to send the finish.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #5 on: July 18, 2014, 06:23:35 PM »
Is there any chance you could make that change?

I've got it working now, but it's awkward - as setting the same time float in the Wait action didn't work, I have to use Float Operator to take my time and add on 0.1 seconds, and use that float as my Wait time - without that, it was exiting the state before the string was final. (my original problem)

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #6 on: July 18, 2014, 08:05:14 PM »
Urgh, I thought it was working, with a wait time of 0.1 seconds more than the time of the Int Interpolate - but now it's way under the amount it's supposed to be. 120,000 instead of 140,000.

I guess that method isn't going to work.

I'll try the option of putting the Int to String in the next state instead. :(

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15552
  • Official Playmaker Support
Re: Int Interpolate
« Reply #7 on: July 21, 2014, 06:09:10 AM »
Hi,
 
The best way to achieve this is to not trigger a finish event within the Int interpolate action, but instead have the very last action on that state comparing the current value with the target value, if it's equal or more then move out of the state.

 that's typically a very good logical structure for complex states content, not just for this case.

 Bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #8 on: July 21, 2014, 08:09:14 AM »
Nope, that didn't work.

It was closer, but the final Int to String update didn't make it to the target number. See the screenshot. I used a Int Compare to trigger an exit when it reached the target, that action shows it as met - yet the Int to String is low.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Interpolate
« Reply #9 on: July 21, 2014, 08:26:37 AM »
Try moving Int Interpolate to the bottom.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15552
  • Official Playmaker Support
Re: Int Interpolate
« Reply #10 on: July 21, 2014, 08:28:54 AM »
Hi,

 Hang on, you have "real time" checked, have you tried without "real time" checked?

 Bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #11 on: July 21, 2014, 08:36:56 AM »
@Jean - Turned off Real Time made no difference.


jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Int Interpolate
« Reply #12 on: July 21, 2014, 08:41:24 AM »
@Lane - Moving it to the bottom did fix the problem!  (thanks!)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Interpolate
« Reply #13 on: July 21, 2014, 09:20:29 AM »
Cool. The last thing the state does is finish the Interpolate, so on the next update all of the actions run are working on the final numbers and everything lines up.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D