Author Topic: Adding DEC: Variables?  (Read 4607 times)

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Adding DEC: Variables?
« on: March 14, 2017, 04:01:50 AM »
I know this is probably simple but I'm trying to add 2 different DEC: variables to create a 3rd DEC:

Basically Variable 1 + Variable 2 = Variable 3

Looking though the manual etc and I'm not seeing anything :/
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Adding DEC: Variables?
« Reply #1 on: March 14, 2017, 06:26:02 AM »
You'd have to use "{EXP:}" for that.

Try
Code: [Select]
Set decimal [dec1] value to 50,00000
Set decimal [dec2] value to 25,00000
Set decimal [dec3] value to the converted value of {EXP: {DEC:dec1} + {DEC:dec2}}
Write '[Purple] {DEC:dec3} = {EXP: {DEC:dec1} + {DEC:dec2}}' to log
Put the token in the "Convert Text/Token" field.


If it writes "Not Set = Expression error" to the log, let me know whether you use a comma as the decimal separator.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2831
Re: Adding DEC: Variables?
« Reply #2 on: March 14, 2017, 12:05:15 PM »
This works too if you don't want to use EXP:

Set decimal [dec1] value to 50
Set decimal [dec2] value to 25
Set decimal [dec3] value to the value of [dec1]
Set decimal [dec3] to [dec3] plus [dec2]

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Adding DEC: Variables?
« Reply #3 on: March 14, 2017, 12:24:29 PM »
This works too if you don't want to use EXP

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2831
Re: Adding DEC: Variables?
« Reply #4 on: March 14, 2017, 12:26:56 PM »
Lol!

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: Adding DEC: Variables?
« Reply #5 on: March 15, 2017, 12:12:52 AM »
@Pfeil... very on point! LOL

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Adding DEC: Variables?
« Reply #6 on: March 25, 2017, 08:48:21 AM »
Thanks for this, I haven't been  hanging about these forums as much as I should to see replies and missed it. will try it out as soon as I've tidied up my scripts. They are pretty messy atm
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer