Skip to main content

Accelerate your myAvatar ScriptLink development.

Get started today with .NET or .NET Framework.

Hello, World!

AvatarScriptLink.NET simplifies common use cases as demonstrated by this Hello, World! example.

Before

Before AvatarScriptLink.NET you would have to construct your return OptionObject manually and often make changes directly to the incoming OptionObject.

[WebMethod]
public OptionObject2015 RunScript(OptionObject2015 optionObject, string parameters)
{
OptionObject returnOptionObject = new OptionObject();

returnOptionObject.EntityID = optionObject.EntityID;
returnOptionObject.EpisodeNumber = optionObject.EpisodeNumber;
returnOptionObject.Facility = optionObject.Facility;
returnOptionObject.Forms = optionObject.Forms;
returnOptionObject.NamespaceName = optionObject.NamespaceName;
returnOptionObject.OptionId = optionObject.OptionId;
returnOptionObject.OptionStaffId = optionObject.OptionStaffId;
returnOptionObject.OptionUserId = optionObject.OptionUserId;
returnOptionObject.ParentNamespace = optionObject.ParentNamespace;
returnOptionObject.ServerName = optionObject.ServerName;
returnOptionObject.SystemCode = optionObject.SystemCode;
returnOptionObject.SessionToken = optionObject.SessionToken;

// Do work here on returnOptionObject and prepare for return

returnOptionObject.ErrorCode = 3;
returnOptionObject.ErrorMesg = "Informational message...";

return returnOptionObject;
}

After

Afterwards, you can construct your working copy of the OptionObject directly from the object received.

You can also prepare the OptionObject for return as well as set the ErrorCode and ErrorMesg in a single command.

[WebMethod]
public OptionObject2015 RunScript(OptionObject2015 incomingOptionObject, string parameters)
{
OptionObject2015 optionObject = incomingOptionObject.Clone();
// Do work here on the clone of incoming OptionObject to retain original request for later comparison or restore
return optionObject.ToReturnOptionObject(ErrorCode.Informational, "Informational message...");
}