playMaker

Author Topic: Conditional Expression Action (BETA)  (Read 52424 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Conditional Expression Action (BETA)
« on: May 17, 2014, 12:58:57 PM »
First a huge thanks to Lea Hayes for doing all the hard work on this action!!

The Conditional Expression action lets you evaluate an expression as true or false and store the result or send events based on the result.

You can use named FSM variables in the expression. If the variable name has spaces use this format: $(variable name with spaces)

Anyway, have a play with it and post feedback. This should be considered a beta release. The final version will be included in the next update.

And again, a huge thanks to Lea Hayes for contributing this action to Playmaker!
Lea makes the excellent Rotorz Tile System: http://u3d.as/content/rotorz-limited/rotorz-tile-system/2UU
He also has a great blog: http://leahayes.wordpress.com/
And Rotorz blog: http://rotorz.com/blog/

EDIT: Updated to v1.1:
- Made text field bigger.
- Added Refresh button.

Some sort of auto-refresh is preferable, but it will need editor support, so for now there is a manual refresh button for when you add/remove/edit variables and then return to the action.

EDIT: Fixed build error.
« Last Edit: May 21, 2014, 12:40:15 PM by Alex Chouls »

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Conditional Expression Action (BETA)
« Reply #1 on: May 17, 2014, 01:17:22 PM »
 :o oWoow

EDIT: I like seeing programmer centric actions. Being able to evaluate little bits of code like this might not be strictly 'playmaker style', but it would really cut down on action clutter and it's quite awesome!

And I'm also happy I avoid spaces in my variable names now :)
« Last Edit: May 17, 2014, 01:21:01 PM by TrentSterling »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Conditional Expression Action (BETA)
« Reply #2 on: May 17, 2014, 01:19:42 PM »
Awesome!  ;D

1) First thing I would suggest is a bigger space to type the expression =) Like the comment action field has.

2) Also during the editor mode you have to actually click and change the expression field if you want it to re-evaluate any variable changes you've made in the editor.
« Last Edit: May 17, 2014, 01:21:54 PM by Lane »
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: 15594
  • Official Playmaker Support
Re: Conditional Expression Action (BETA)
« Reply #3 on: May 19, 2014, 09:35:11 AM »
Hi,

 Very cool, I would see straight away a lot of thing to expand on this.

 expression should allow the return of more than a bool, floats, ints, string, etc. I feel it could be frustrating to get such a convenient action to just return bools, but I am not sure how it's made under the hood, so it may be not really possible to expand on this.

also, I tried to use a string variable but I think the value will always evaluate to true, I think it should evaluate string for "1", "true" "false", empty or with content and return true or false on these cases.

Or, maybe double check what variables are use and warn the user about unsupported variable types within this expression

Bye,

 Jean

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: Conditional Expression Action (BETA)
« Reply #4 on: May 19, 2014, 04:22:23 PM »
Awesome!  ;D

1) First thing I would suggest is a bigger space to type the expression =) Like the comment action field has.

2) Also during the editor mode you have to actually click and change the expression field if you want it to re-evaluate any variable changes you've made in the editor.

Great feedback! I've uploaded v1.1 above...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: Conditional Expression Action (BETA)
« Reply #5 on: May 19, 2014, 04:25:42 PM »
Quote
expression should allow the return of more than a bool, floats, ints, string, etc. I feel it could be frustrating to get such a convenient action to just return bools, but I am not sure how it's made under the hood, so it may be not really possible to expand on this.

I'm looking into this - maybe Lea will help out :)

But I think it will be a separate action, e.g.,: Math Expression.

Quote
also, I tried to use a string variable but I think the value will always evaluate to true, I think it should evaluate string for "1", "true" "false", empty or with content and return true or false on these cases.

Or, maybe double check what variables are use and warn the user about unsupported variable types within this expression

Good point. This should be possible...

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Conditional Expression Action (BETA)
« Reply #6 on: May 21, 2014, 07:35:22 AM »
Build errors! Woo!

This is for Standalone. It also happened on the previous version.

The line compiles apparently, so I assume its not being picky about formatting. (edit, actually it fails without any actions being used, so its in the dll)
« Last Edit: May 21, 2014, 07:37:08 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: Conditional Expression Action (BETA)
« Reply #7 on: May 21, 2014, 11:52:33 AM »
Thanks! I'll fix this in the next release...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: Conditional Expression Action (BETA)
« Reply #8 on: May 21, 2014, 12:40:44 PM »
Uploaded a new version that should fix the build error.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Conditional Expression Action (BETA)
« Reply #9 on: May 21, 2014, 01:28:50 PM »
Works great, I can't seem to break anything else on it. Going to start using it on future iterations of the flight AI and might find more out then. Bundling lots of conditions into a bool value is going to be so useful for AI, especially with a delegate fsm just reading contextual data and flipping bools, then the behavior fsm responding to those flags async.... *hnnnngggghh*..

Only other thing I notice that could be a small nuisance is toggling the expression box to a variable and back will null the field, so you lose anything you might have typed in. Really just a minor inconvenience on the rare occasion that you hit the button accidentally.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: Conditional Expression Action (BETA)
« Reply #10 on: May 21, 2014, 01:34:51 PM »
Great! Please also keep an eye on performance as you use this. I'll build a stress test to compare expressions to regular actions, but I'd also like real world tests...

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Conditional Expression Action (BETA)
« Reply #11 on: July 29, 2014, 12:39:51 PM »
This is fantastic! Many, many thanks to the developer!

One question... What if I wanted to get the "X" value of a vector2 variable (or vector3 variable) to test? Would it be something to simply extract and place into a float or would there be something like a "Vector2.x" or "Vector2[1]" kinda thing?

edit: using "Vector2.x", "Vector2[1]" and "Vector2{1}" all produce errors... So, can I get it to fetch the values within the expression itself or is this something that I'd do with an action external to this function? If the suggestion to me is to extract them separately, I'd love to suggest the ability to work with vectors (both 2 and 3)
« Last Edit: July 29, 2014, 12:49:40 PM by Red »

gsmetzer

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Conditional Expression Action (BETA)
« Reply #12 on: August 06, 2014, 12:50:27 PM »
I also agree with Jean that it would really expand functionality if we had different variable outputs.   I would love a similar math action where I could do things like, example:

(myFloat1 + myFloat2)/myInteger  = myOutput float


everyframe

Does that make sense? 
It could really cut down on the clicks and extra actions

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: Conditional Expression Action (BETA)
« Reply #13 on: August 07, 2014, 08:24:33 AM »
That would definitly help a lot !
+1 for math action
Visit my portfolio: http://www.yanivcahoua.com/

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Conditional Expression Action (BETA)
« Reply #14 on: August 25, 2014, 12:04:26 PM »
I think I may have stumbled on a potential bug here... Not sure if this is with the expression system itself or if it's with the prefab management thing but here goes the details.

I've noticed that sometimes the conditional expression doesn't always update the proper expression in the field when working with it as a prefab and adjusting or changing it. The expression shows the right one but it behaves like a previous change/edit/etc... The workaround I found was to simply remove that action and re-add it and put the expression in again which makes me think that there may be a bit of confusion in how the expressions are stashed and handled. It's not something I can easily reproduce but if I do come across it again I'll do what I can to save the information so that I can maybe post a package link.

Still, I can't say that this sours me on this system... It's fantastic! But as with it being beta I can totally understand how there may be some bugs to work out or that kinda thing (and it may not even be with the system itself but rather the prefab management thing that was (is?) an issue.)