playMaker

Author Topic: How do I save multiple values (eg. Get Distance) to the same float variable?  (Read 4130 times)

brainchildbc

  • Playmaker Newbie
  • *
  • Posts: 6
Hi Guys so I am trying to use only playmaker to do this. What I am trying to solve is using the Get Distance action to save a distance to the variable I have every frame. Right now I have a state set up which loops itself as long as I need it to. In it there is the Get Distance action which saves the distance to a float variable. However when debugging I see that the variable only always stores the first value. Any ideas on how I can make it continuous?

Help is much appreciated!

Jeff

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Hi,
You should remove the wait action and the loop (FINISHED transition)
and check 'every frame' on both the get distance

This way it will do the get distance every frame.

brainchildbc

  • Playmaker Newbie
  • *
  • Posts: 6
Thanks for the reply! I have removed the transition and the wait action as well as checked "every frame" but it still does not work properly. The variable gives me only three distances and not all of them.
Can it maybe be something with the conversion? I am trying to also convert the float to a string variable in order to use the Easy Save append raw action.

I am not sure if the float variable that has continuously tracked distances is also converted properly.

thanks in advance!



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Hi,
Are you storing each 'distance' in a different variable?
Maybe you can make a quick video showing all the actions/states/fsm's

brainchildbc

  • Playmaker Newbie
  • *
  • Posts: 6
Hey! Not quite I am trying to store each distance in the same variable. So that I have a distance for each frame saved consecutively while the state loops. Once the transition then moves on to the next state the variable should be converted with all the distances in the variable.
Hope this is comprehensible. I will add a video either today or tomorrow once I get back to my desktop :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Hi,
You Can't place multiple values in a single variable.
what you can do is save each distance into a different variable, then convert the value to a different string variable for each float variable,
then you can use a 'build string' to put them into a single string variable

brainchildbc

  • Playmaker Newbie
  • *
  • Posts: 6
I see.. is it then still feasable to do this technique if I need to save a distance every frame? Since this would produce very large amounts of varables that all need to be named and saved and later converted. Is there a straightforward way of doing this at all?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Hi,
if you want to save the distance every frame from a single object you can try this :


brainchildbc

  • Playmaker Newbie
  • *
  • Posts: 6
Dino thank you so very much! This worked perfectly for me and I got the results I needed :)

One last small question I have which you might be able to answer is, is there a way for me to see the exact (or approximate) frame rate of the scene? If yes can it be altered?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Hi,
What you can do is :
Make an fsm, in the 1st state place an 'int add' make an int variable for it, set add to 1 and check every frame
then add a 'wait', set time to 1 and real time checked

then on the next state
place a covert int to string and convert the int from the int add
now you can show the string in a ugui or gui text

then add a 'set int value' and place the int variable you made in it.
Set the Int Value to 0

add a finish transition and loop it back to state 1