playMaker

Author Topic: Strange Int behaviours ;-S  (Read 1410 times)

Menno007

  • Playmaker Newbie
  • *
  • Posts: 11
Strange Int behaviours ;-S
« on: February 05, 2020, 08:41:17 AM »
I have some really strange basic behaviour with generating random Ints and doing Math:

The Random Int operators are not generating any value

And one state further when multyplying these zero values I get a weird value
see the 2 screenshots

Could this be some kind of cache/memory issue?

And; How can I get things to work as it should again?

Menno007

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Strange Int behaviours ;-S
« Reply #1 on: February 05, 2020, 11:08:39 AM »
Would it be an idea to make a screencast showing what's going on?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Strange Int behaviours ;-S
« Reply #2 on: February 06, 2020, 07:39:52 AM »
Hi,

 the first step is to create an empty scene, and make a simple fsm.

- test the random action to make sure it generates a result
- test with two random actions
- now multiply both

if that works, then in your actual scene, there is a good chance that something is else forcing the value of your variables. Can you double check that as well?

Bye,

 Jean

Menno007

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Strange Int behaviours ;-S
« Reply #3 on: February 06, 2020, 03:46:44 PM »
Jean, Each FSM stores the variables in their own scope right?

I did copy some states over within the FSM, and someone on Discord suggested not doing that. I have this feeling also, when you copy and paste states, things start to act weird sometimes.

Now I have separated each 'calculation set' into its own FSM, and in each FSM I have put each action into it's own state. It helps a bit but it is still not correct ;-(

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Strange Int behaviours ;-S
« Reply #4 on: February 07, 2020, 02:38:36 AM »
Hi,

 well yes, copy pasting stuff in playmaker sometimes isn't solid enough. Do you think it's related? usually, it's because you copy a variable that exists already in the fsm, and then things gets oddly pasted. I do that a lot, but I am extra careful that it all works after that, not just because of the above, but copy pasting is tricking your brain and half of the time you forgot to do something and it bugs out...

you can do your logic in one fsm, why do you want to do that in several?

each fsm indeed keeps its local values so you can have two fsm with two variables named the same and they will be have different values ( different pointers in memory)


if you do it again in one fsm does it bug again?

Bye,

 Jean

Menno007

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Strange Int behaviours ;-S
« Reply #5 on: February 07, 2020, 08:11:21 AM »
Using 1 FSM was my initial idea.
Using 4 global transforms, 1 for each equation.
Each round 1 equation gets created (add, substract, multiply or divide)
This way everything was kept together.

The Adding equation works fine (is the easiest off course)
but for instance with the substract equation, I do a compare Int to check if the first generated Int is higher than the second. If not I use a thidt variable to swap these around and continue create the equation.
90% this works, but sometimes I still get a minus answer, which means the Int compare didn't work.

The multiply and divide equations do some more compares and calculations, so they basicly fail too often.

But I'll re-create all of them this weekend from scratch without copying actions, see if things will start working again.

By the way, it did work at first, but soon started to fail ;-S

Keep u posted