Custom Variable Cnfrontation

Posted: 21 Aug 2020 13:11
by drunkrobot

Hi I taked a naninovel custom variable from c# with this method:
public Naninovel.CustomVariableManager G_PunteggioMC = Engine.GetService<Naninovel.CustomVariableManager>();
void SetVariableValue()
{
G_PunteggioMC.SetVariableValue("G_PunteggioMC", Mathf.RoundToInt(scoreCount).ToString());

My problem it's that i'm tryng to confront it with other naninovel custom variable that are number, while this is a string and the SetVariableValue command accepts only a string for value.
How can i do this confrontation? There is a way in naninovel to do the typecast of the number to the string or also better of the string to the number?
Thanks for help.


Re: Custom Variable Cnfrontation

Posted: 21 Aug 2020 16:38
by Elringus

Just parse the string to the required type and then cast it back to string when saving. All the custom variable values are stored as strings in Naninovel.


Re: Custom Variable Cnfrontation

Posted: 24 Aug 2020 09:04
by drunkrobot

But there is a way to do it in Naninovel script or i have to do it in c# ?


Re: Custom Variable Cnfrontation

Posted: 24 Aug 2020 09:56
by Elringus

In naninovel the conversion is performed automatically.


Re: Custom Variable Cnfrontation

Posted: 24 Aug 2020 12:16
by drunkrobot

oh ok so i am doing somethings else wrong, thank you