Discussion of Inner Space
Moderators: Lavish Software Team, Moderators
-
buddhist
- GamingTools Subscriber
- Posts: 2
- Joined: Wed Jan 17, 2007 3:30 am
Post
by buddhist » Sun Feb 04, 2007 5:07 pm
Hi,
I've just started using VB.NET with Innerspace in Eve. For example:
Code: Select all
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LavishVMAPI.Frame.Lock()
Dim vObj As LavishScriptObject = LavishScript.Objects.GetObject("Mouse")
If vObj.IsValid = False Then
InnerSpace.Echo("LSobj invalid")
Else
Dim args(1) As String
args(0) = "20"
args(1) = "391"
vObj.ExecuteMethod("SetPosition", args)
If vObj.ExecuteMethod("LeftClick") = False Then MsgBox("LeftClick Failed")
End If
LavishVMAPI.Frame.Unlock()
vobj = Nothing
End Sub
The position 20,391 happens to correspond to the "Assets" button on the left hand toolbar. Upon execution, the mouse cursor indeed moves to that position however the left click doesn't appear to work as the Assets dialog doesn't come up. I put this code in Form_Load thinking IS may have had the wrong focus (the VB.NET form instead of Eve) which seemed to help with the mouse position but not the left click.
If I add a second LeftClick to the above code, Eve brings up the ship's cargo dialog (typically accessed via a double click in the general space station graphic area) which leads me to believe the single LeftClick I desire is being executed whilst the mouse is not at 20,391. It visually appears to be at that position and I dumped the mouse position to the form from the Mouse object and that seems to jive.
Any ideas?
Thanks!
-
buddhist
- GamingTools Subscriber
- Posts: 2
- Joined: Wed Jan 17, 2007 3:30 am
Post
by buddhist » Sun Feb 04, 2007 11:54 pm
Ok, Lax helped me out with this one on IRC. Code below:
Code: Select all
LavishVMAPI.Frame.Lock()
Dim vObj As LavishScriptObject = LavishScript.Objects.GetObject("Mouse")
If vObj.IsValid = False Then
InnerSpace.Echo("LSobj invalid")
Else
Dim args(1) As String
args(0) = "20"
args(1) = "391"
vObj.ExecuteMethod("SetPosition", args)
LavishVMAPI.Frame.Unlock()
LavishVMAPI.Frame.Wait(True)
vObj = LavishScript.Objects.GetObject("Mouse")
If vObj.ExecuteMethod("LeftClick") = False Then MsgBox("LeftClick Failed")
LavishVMAPI.Frame.Unlock()
End If
end sub
Basically, Lax said that we had to wait via til the next frame such that the new mouse position was registered prior to left clicking. This was accomplished via Frame.Wait(True) [True locks the frame again]. Note that the Mouse object is not persistent and was lost out of lock therefore it was grabbed again.
Thanks!!