Exception accessing properties in ISXVGWrapper

luthael

Active Member
When I try to access properties like Me().IsSprinting or other booleans like it, I get an exception in ISXVGWrapper.

It seems to me like it's an error in the generics code, but it could also be me using it wrong.

The exception is:

System.FormatException: String was not recognized as a valid Boolean.
at System.Boolean.Parse(String value)
at System.String.System.IConvertible.ToBoolean(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at LavishScriptAPI.Conversion.LavishScriptTypes.As[T](Int32 objtoken, Int32 typetoken)
at LavishScriptAPI.LavishScriptPersistentObject.GetMember[T](String Member)
...
..
.


I have tried both of these approaches:

bool isSprinting = vgExt.Me().IsSprinting;
and
bool isSprinting = vgExt.Me().GetMember<bool>( "IsSprinting" );

Any ideas as to what goes wrong?
 

MstrGareth

Active Member
The extention is returning NULL for this value.

echo ${Me.IsSprinting}
NULL

I never bothered to have the special abilties enabled so I am not sure if this NULL value is due to that.
 

Amadeus

The Maestro
Staff member
Did you email me and have the 'sprint', 'warp' and 'afterburner' type features turned on? This has been discussed on the forums before and should be plenty of stuff for it under 'search'.

"IsSprinting" refers to the isxvg version of 'sprint' ..not the in-game version....which is made clear in the ISXVGChanges.txt and/or ISXVGChanges(Archives).txt files.
 

luthael

Active Member
No, I did not email you to get those features turned on. I don't think I need to either, as I only used those properties as a proof-of-concept in learning to use the ISXVGWrapper.

Thank's for the info though, it explains a lot.

I do however, in principle, believe that feature-cut should be implemented differently. Getting a conversion exception when trying to use a disabled feature, is wrong.
The correct way to do it, if one wants to throw an exception is to override ApplicationException with for example an ISXVGDisabledFeatureException class and throw that.

It would probably save the writer a lot of unwanted questions and lead to a lot less confusion.

This might not be the best forum for a best practices discussion tho :)
 
Top Bottom