Author Topic: Small integer increment/decrement value  (Read 2225 times)

jcdick1

  • Jr. Member
  • **
  • Posts: 55
Small integer increment/decrement value
« on: January 16, 2021, 08:25:59 PM »
Might someone be willing or able to give me an example of the use of the Small Integer as an increment/decrement value?

Thanks!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Small integer increment/decrement value
« Reply #1 on: January 16, 2021, 08:33:58 PM »
In what context? Incrementing means the chosen value is added to the current value, decrementing means it's subtracted instead. Not much more to know about that feature.

In just about all cases you'd want to use the regular Integer type instead, which has the full complement of math functions (Small Integer is a legacy carryover, basically only existing for backwards compatibility).

jcdick1

  • Jr. Member
  • **
  • Posts: 55
Re: Small integer increment/decrement value
« Reply #2 on: January 16, 2021, 09:17:34 PM »
Okay, I think that answers the question.  I could use the Small Integer as an incremental in order to start an interation, but have it stop when the incremental value reaches a desired maximum?

I learned this evening that there are some undocumented variables passed to VA regarding materials on scanned bodies.  One is a DEC value that contains the percentage of a material found.  The name contains a number that corresponds to an index of discovered materials.  The second is an INT that tells you a zero-based maximum indexed value.  So if you scan a body, and there are seven materials discovered, you'd have seven versions of the DEC variable named 0 through 6.

The third value is a TXT that tells you what material corresponds to which DEC name.

So I could use the small incremental to iterate through all that to find how much Germanium a given body has.

I think.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Small integer increment/decrement value
« Reply #3 on: January 16, 2021, 09:24:06 PM »
The "Loop Start - Repeat a Certain Number of Times" action takes literal integer numbers (or tokens that return integer numbers, which are equivalent to literal text), and can set an Integer variable indexer, which would allow you to step through those values (by using a token as part of or a substitute for the variable name)

jcdick1

  • Jr. Member
  • **
  • Posts: 55
Re: Small integer increment/decrement value
« Reply #4 on: January 16, 2021, 09:25:01 PM »
Oh, okay.  I'll look at that then.