Author Topic: .SetInt() format  (Read 62 times)

BaronArron

  • Newbie
  • *
  • Posts: 1
.SetInt() format
« on: August 10, 2017, 02:35:40 am »
Hello,

I'm developing a plugin which allows various different data types to be read from the target application and fed back into VoiceAttack. For float/double/bool it's straight forward to determine what the conversion proccess should be. But for SetInt(), it's not clear from the documentation the exact integer format that this function expects (and as the proxy object is dynamic, there's no clear API).

Does SetInt() take signed or unsigned int? What about long integers?

Clarification on this would be great.

Thanks!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 978
  • RTFM
Re: .SetInt() format
« Reply #1 on: August 10, 2017, 10:31:13 am »
Admittedly I'm just a novice programmer, but the documentation states "SetInt(string VariableName, int? Value) – Set a nullable integer value".

Look up the built-in C# datatypes and you'll find that translates to a signed int32, which in C# is referred to as "int". In VB.Net it would be an "Integer".
The questionmark signifies that it's nullable, so your code should be equipped to handle NULL values, if you're getting data from VoiceAttack.



and as the proxy object is dynamic, there's no clear API
If you mean there is no code completion because of this, that's a fair point, but the compiler will still tell you which values the function doesn't accept, E.G.:
Code: [Select]
public class VAInline
{
public void main()
{
            long test = 1;
VA.SetInt("myInt", test);
}
}
Quote
Compile errors: 2
7: The best overloaded method match for 'VoiceAttack.VoiceAttackInitProxyClass.SetInt(string, int?)' has some invalid arguments
7: Argument 2: cannot convert from 'long' to 'int?'