Author Topic: Add two variables together.  (Read 2841 times)

Antrys

  • Newbie
  • *
  • Posts: 22
Add two variables together.
« on: June 10, 2017, 02:00:35 PM »
This is likely so obvious that it hitting me in the face.

How do I add the values of two small integer variables and put the result into a third?
[result integer] = [integer x] + [integer y]

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Add two variables together.
« Reply #1 on: June 10, 2017, 03:15:58 PM »
If you want it in one action you'll have to use the "{EXP:}" token:
Code: [Select]
Set integer [First] value to 1
Set integer [Second] value to 2
Set integer [Third] value to the converted value of {EXP: {INT:First} + {INT:Second}}

Otherwise, this should work:
Code: [Select]
Set integer [First] value to 1
Set integer [Second] value to 2
Set integer [Third] value to the value of [First]
Set integer [Third] to [Third] plus [second]

Note that at the moment, the "Compute against a variable or token" box must only contain lower case letters, regardless of the actual variable name. This is a bug, reported here.

Antrys

  • Newbie
  • *
  • Posts: 22
Re: Add two variables together.
« Reply #2 on: June 10, 2017, 03:59:15 PM »
Thanks. I see what you're doing.
Wish we had a built-in function, but at least I can make my own now.

Again, Thanks  :)