playMaker

Author Topic: [solved] Substraction operation  (Read 5475 times)

fis

  • Playmaker Newbie
  • *
  • Posts: 12
[solved] Substraction operation
« on: April 10, 2011, 06:19:48 AM »
There is an ability to add up variables in PM. I'm talking about the FloatAdd action.
But what about the substraction? Is it possible in the current version of PM?
« Last Edit: April 15, 2011, 03:09:50 AM by alexchouls »

Pleasuremaker

  • Guest
Re: Substraction operation
« Reply #1 on: April 10, 2011, 10:49:04 AM »
You just need to use negative values in the Add field. No need for another action for that.

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Re: Substraction operation
« Reply #2 on: April 10, 2011, 04:31:23 PM »
You just need to use negative values in the Add field. No need for another action for that.
True, although if you need to subtract from a variable you'll need two actions - one to multiply the variable value by -1 and a second one to add that result to the intended variable. In that case an actual subtract float action would be handy.

Sounds like a great exercise into creating a custom action for whoever wants to get into the most powerful aspect of playmaker, after all it'll be just one signal switch. C'mon guys, try it, it won't bite you! :)
--
Breno "MaDDoX" Azevedo
@brenoazevedo

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Substraction operation
« Reply #3 on: April 10, 2011, 08:05:16 PM »
I don't quite get it? I use subtract all the time using FloatAdd. In the add field I just say for an example " -2 ". I guess what you are saying is that if you have a variable that you must keep as a positive float var but sometimes want to subtract it from another float you'd have to do it in two steps like you said.

Wouldn't it be as easy as going into the custom action of FloatAdd and exchange the + for a - and call it FloatSubtract?

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Substraction operation
« Reply #4 on: April 10, 2011, 08:23:48 PM »
Well, my very first custom action completed! It was as easy as I thought, I replaced + with -, I replaced "Add" with "Subtract" and "add" with "subtract" (case sensitivity differences). I put it in "Share New Playmaker Actions":

http://hutonggames.com/playmakerforum/index.php?board=19.0

fis

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Substraction operation
« Reply #5 on: April 11, 2011, 10:19:26 AM »
My gratitude :)!
It's more convenient to use one action instead of two.

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Substraction operation
« Reply #6 on: April 11, 2011, 10:40:04 PM »
Sure! Gratitude is what will make me want to share more custom actions when I get to learning it better. So thank you :).