playMaker

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

fis

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
[solved] Substraction operation
« on: April 10, 2011, 03: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, 12:09:50 AM by alexchouls »

Pleasuremaker

  • Guest
Re: Substraction operation
« Reply #1 on: April 10, 2011, 07: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
    • View Profile
    • FluidPlay Studios
Re: Substraction operation
« Reply #2 on: April 10, 2011, 01: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
    • View Profile
Re: Substraction operation
« Reply #3 on: April 10, 2011, 05: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
    • View Profile
Re: Substraction operation
« Reply #4 on: April 10, 2011, 05: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
    • View Profile
Re: Substraction operation
« Reply #5 on: April 11, 2011, 07:19:26 AM »
My gratitude :)!
It's more convenient to use one action instead of two.

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
    • View Profile
Re: Substraction operation
« Reply #6 on: April 11, 2011, 07: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 :).