edited June 2016 in ORK Scripting
Hi guys,

well, as I am getting deeper into the dev process, I am writing some pretty complex formulas, and one of the things that was driving me bonkers was the inability to track my formula step by step to see where I am messing something up.

So here is a simple script that adds a step called "Print Value". Just add it wherever you want to know the current value in your formula.

How it works: It simply takes the current formula value, adds 0, and prints it to the console


using UnityEngine;
using ORKFramework;
using ORKFramework.Formulas;
using System.Collections.Generic;

namespace ORKFramework.Formulas.Steps
{
[ORKEditorHelp("Print Value", "Send current value to debug console", "")]
[ORKNodeInfo("Value")]
public class PrintValueStep : BaseFormulaStep
{
// variable and player prefs
[ORKEditorHelp("Console Text", "What to print to the console before the value.", "")]
[ORKEditorInfo(expandWidth = true)]
[ORKEditorLayout("type", ParameterType.String, endCheckGroup = true)]
public string stringValue = "";

public PrintValueStep()
{

}

public override int Calculate(FormulaCall call)
{
ValueHelper.UseOperator(ref call.result, 0, FormulaOperator.Add);
Debug.Log(stringValue + " Custom Value: " + call.result);
return this.next;
}


/*============================================================================
Name functions
============================================================================*/
public override string GetNodeDetails()
{
return "";
//return this.formulaOperator.ToString() + " " + this.value.GetInfoText();
}
}

}


if there's a substantial need, I could make a script that also prints local variables and such, but im pretty sure you can figure it out.
Post edited by chud575 on
  • You don't need this line:
    [ORKEditorLayout("type", ParameterType.String, endCheckGroup = true)]ORKEditorLayout attribute is for hiding settings based on other settings :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.