playMaker

Author Topic: Math Expression action[SOLVED]  (Read 3400 times)

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Math Expression action[SOLVED]
« on: August 17, 2019, 06:51:06 AM »
There seems to be an issue with it where it wont go to the next frame cause it gets stuck at that action and anything below it doesnt register. It also seems to not update at all when I play with the variables.

I looked through the code [I dont know code at all] but I was hoping I could see an error that it would let me auto correct but nothing. It uses Mathos Parser and someone converted it into an action. It worked a long time ago but I assume the Mathos Parser changed. I am running the latest version of Unity and Playmaker.

I got the action from here: https://hutonggames.com/playmakerforum/index.php?topic=18385.msg79967#msg79967
« Last Edit: September 17, 2019, 04:40:53 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Math Expression action
« Reply #1 on: August 19, 2019, 03:01:13 AM »
Hi,

 can you share  the setup and expression + values you are using?? It works here.

 Bye,

 Jean

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action
« Reply #2 on: August 19, 2019, 03:46:17 AM »
Hi,

 can you share  the setup and expression + values you are using?? It works here.

 Bye,

 Jean
Here are some videos of the setup.
https://streamable.com/xzf05 - Math Expression turned on but not every frame
https://streamable.com/pc46c - Math Expression turned on but with every frame
https://streamable.com/z8ovm - Math Expression turned off and Float Operator turned on to show that it goes through all the actions.

Notice how I have Next Frame Event at the bottom under Math Expression but it never gets to it and Math Expression doesnt even calculate anything. I turned off Math Expression again and tested it with a Float Operator and it went through all the actions seamlessly.

The attachment shows that the sword stored the enemy hit and their defense value and stored it as "enemy defense". "Physical" is the weapon damage and I am subtracting it from the enemy defense and the result is a float called "sent damagefloat" that will be sent to the enemy's health as damage. There will be far more calculating than that but this is a test and it isnt working. I have used this action in the past and it has worked great but something is causing it not to work. Maybe my action isnt update.=?

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action
« Reply #3 on: August 22, 2019, 05:40:31 PM »
Friendly bump
I really need this action  :'(

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Math Expression action
« Reply #4 on: August 23, 2019, 03:11:12 AM »
Hi,

 your streams do not work, it says insecure connection...

can you give me your math expression? I'll try.

Bye,

 Jean

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action
« Reply #5 on: August 23, 2019, 08:16:42 AM »
Hi,

 your streams do not work, it says insecure connection...

can you give me your math expression? I'll try.

Bye,

 Jean

Heres the link for the Math Expression Action download. TY.
https://drive.google.com/open?id=1n0i4I9djA9Z2hjJTIUPyP2y4FkISZY_F

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action
« Reply #6 on: August 28, 2019, 05:11:00 PM »
Hi,

 your streams do not work, it says insecure connection...

can you give me your math expression? I'll try.

Bye,

 Jean
Bump
Wanted to know if you were able to download the action?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Math Expression action
« Reply #7 on: August 29, 2019, 07:19:52 AM »
Hi,

I am on it :)
but your streams are not working, I need the actual math expression you use, not the action.

bye,

 Jean

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action
« Reply #8 on: August 29, 2019, 12:02:26 PM »
Hi,

I am on it :)
but your streams are not working, I need the actual math expression you use, not the action.

bye,

 Jean
Oh. both Physical and Enemy Defense were placeholders. The actual equation is enemyS-(SD*enemyS)+enemyT-(TD*enemyT)+enemyB-(BD*enemyB)+enemyA-(AD*enemyA)+enemySA-(SAD*enemySA)

I found out after more testing that it doesnt work with spaces. If there are any spaces between the equation then it just doesnt work. Also it doesnt update itself even if I loop it or use every frame. The only way I was able to update it is by updating the equation itself. My work around for updating the equation itself but not actually changing it in a way that would mess up the results was to have an action before it that called String Append that adds a space at the end of the equation which doesnt break it but does update it and after calculating everything will reset the equation back to it's original way.

The action also just stops working if the state is being called with a global action from other objects or fsms. The way I fixed that is by adding a state before that state that will take the global action with an next frame event to the state with the Math Expression action which again, works but its too slow.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Math Expression action
« Reply #9 on: September 12, 2019, 01:43:12 AM »
Hi,

 Can you replace this script? and tell me if it works?

Bye,

 Jean

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action
« Reply #10 on: September 13, 2019, 10:17:05 PM »
Hi,

 Can you replace this script? and tell me if it works?

Bye,

 Jean

OMG Thanks a ton!
It works perfectly now. It updates on every change so I no longer need to jump through hoops to get it to update. Thank you once again. ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Math Expression action[SOLVED]
« Reply #11 on: September 18, 2019, 07:15:18 AM »
Hi,

 just put that on the ecosystem for convinience,

 I also found that mathos library has been updated, I think we can take it a lot further and add vectors, functions like delta time, etc etc, I'll see what I can do with this.


 Bye,

 Jean

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Math Expression action[SOLVED]
« Reply #12 on: September 18, 2019, 10:58:50 AM »
Hi,

 just put that on the ecosystem for convinience,

 I also found that mathos library has been updated, I think we can take it a lot further and add vectors, functions like delta time, etc etc, I'll see what I can do with this.


 Bye,

 Jean
You are truly amazing. I cant imagine how useful this tool can be for making states smaller. Being able to write it down into an equation is much faster than having 10 float operators in a single state.