Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: atmuc on August 28, 2013, 03:32:40 AM
-
i use {0:F2} as format on Format String Action. it returns full float value like 0.232347284 not 0.32. F2 works on Convert Float To String Action. i also tried {0.00}. do i do something wrong?
-
if i change this line(objectArray = variables.GetValue(); ) it works. is there any reason to send FSMVars to stringFormat?
void DoFormatString()
{
for (var i = 0; i < variables.Length; i++)
{
objectArray[i] = variables[i].GetValue();
}
try
{
storeResult.Value = string.Format(format.Value, objectArray);
}
catch (System.FormatException e)
{
LogError(e.Message);
Finish();
}
}
-
FSMVar.GetValue does not work on Action.OnEnter method. even i see float value it return 0 when i call this method inside OnEnter. it works fine in OnUpdate. is it a bug or is it by design?
-
i think i cannot getvalue of named variables onenter method. when i change code like this it works. i changed it just for named float variable.
void DoFormatString()
{
for (var i = 0; i < variables.Length; i++)
{
if(variables[i].Type== VariableType.Float)
{
objectArray[i] = ((FsmFloat)(variables[i].NamedVar)).Value;
}
else
objectArray[i] = variables[i].GetValue();
}
try
{
storeResult.Value = string.Format(format.Value, objectArray);
}
catch (System.FormatException e)
{
LogError(e.Message);
Finish();
}
}
-
is it a bug? should i send it to bug report section?
-
Please submit a bug report and I'll take a look... Thanks!
-
I was able to repro. Indeed it should use GetValue(). Good catch!!
However, I wasn't able to repro GetValue failing in OnEnter(). Are you still seeing that?
-
i wrote my own action :-) for now i use it.
-
This works:
void DoFormatString()
{
for (var i = 0; i < variables.Length; i++)
{
if (variables[i].NamedVar != null)
{
variables[i].GetValueFrom(variables[i].NamedVar);
}
objectArray[i] = variables[i].GetValue();
}
try
{
storeResult.Value = string.Format(format.Value, objectArray);
}
catch (System.FormatException e)
{
LogError(e.Message);
Finish();
}
}
-
Hi,
Also, ArrayMaker has a playMakerUtils set of class that feature Fsmvar wrappers to properly get/set them. I use it always when I work with FsmVar, it's doing all the tedious work. AND I am working on a system that can parse var types. for example you pass a string but want a vector 3, that playmakerUtils will let you do that automatically :) more on this in few weeks.
Bye
Jean