This direct command button sub below works.
It returns the value of Me.ToActor.Health by grabbing the object Me then the member ToActor then the Member Health
Code: Select all
Private Sub cmdMeToActorHealthFunction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMeToActorHealthFunction.Click
LavishVMAPI.Frame.Lock()
Dim vObj As LavishScriptObject = LavishScript.Objects.GetObject("Me")
If IsNothing(vObj) Then
InnerSpace.Echo("object Me not found")
Else
Dim vToActorObj As LavishScriptObject = vObj.GetMember("ToActor") '${Me.ToActor}
If Not IsNothing(vToActorObj) Then
Dim vHealthObj As LavishScriptObject = vToActorObj.GetMember("Health") '${Me.ToActor.Health}
If Not IsNothing(vHealthObj) Then
Dim vHealth As Integer = vHealthObj.GetValue(Of Integer)()
InnerSpace.Echo("Me.ToActor.Health=" & vHealth)
End If
End If
End If
LavishVMAPI.Frame.Unlock()
End Sub
I have my me class
Code: Select all
Public Class ISXEQ2_Me
Inherits ISXEQ2_character
Public Sub New(ByVal Obj As LavishScriptObject)
MyBase.New(Obj)
End Sub
End Class
Code: Select all
Public Class ISXEQ2_character
Inherits LavishScriptObject
Public Sub New(ByVal Obj As LavishScriptObject)
MyBase.New(Obj)
End Sub
Public ReadOnly Property Name() As String
Get
LavishVMAPI.Frame.Lock()
Dim vRet As String = GetMember(Of String)("Name")
LavishVMAPI.Frame.Unlock()
Return vRet
End Get
End Property
Public Function ToActor() As ISXEQ2_Actor
LavishVMAPI.Frame.Lock()
Dim vRet As ISXEQ2_Actor
vRet = New ISXEQ2_Actor(GetMember(Of LavishScriptObject)("ToActor"))
' I also tried the line below
'vRet = New ISXEQ2_Actor(LavishScript.Objects.GetObject("ToActor"))
LavishVMAPI.Frame.Unlock()
Return vRet
End Function
End Class
Code: Select all
Public Class ISXEQ2_Actor
Inherits LavishScriptObject
Public Sub New(ByVal Obj As LavishScriptObject)
MyBase.New(Obj)
End Sub
Public ReadOnly Property Health() As Integer
Get
LavishVMAPI.Frame.Lock()
Dim vRet As Integer = GetMember(Of Integer)("Health")
LavishVMAPI.Frame.Unlock()
Return vRet
End Get
End Property
End Class
Code: Select all
Public Function GetISXEQ2_Me() As ISXEQ2_Me
Return New ISXEQ2_Me(LavishScript.Objects.GetPermanentObject("Me"))
End Function
Code: Select all
mee = GetISXEQ2_Me()
InnerSpace.Echo("${Me.Name}=" & Mee.Name)
Code: Select all
InnerSpace.Echo("${Me.ToActor.Health}=" & Mee.ToActor.Health)