Skip to content

Instantly share code, notes, and snippets.

@Mr-Byte
Created December 21, 2014 01:57
Show Gist options
  • Save Mr-Byte/d690bcb21bdc3b6af937 to your computer and use it in GitHub Desktop.
Save Mr-Byte/d690bcb21bdc3b6af937 to your computer and use it in GitHub Desktop.
Imports AW
Module GreeterBot
Dim Instance As IInstance
Sub Main()
Instance = New Instance()
AddHandler Instance.EventAvatarAdd, AddressOf OnAvatarEnter
Dim loginResult = Login("GreeterBot", 123456, "changeme")
If loginResult <> Result.Success Then
Console.WriteLine("Failed to login (Reason: {0}).", loginResult)
End If
Dim enterResult = EnterWorld("SomeWorld")
If enterResult <> Result.Success Then
Console.WriteLine("Failed to enter world (Reason: {0}).", enterResult)
End If
While Utility.Wait(0) = Result.Success
End While
End Sub
Private Function EnterWorld(ByVal worldName As String) As Result
Dim result = Instance.Enter(worldName)
If result <> result.Success Then
Return result
End If
With Instance.Attributes
.MyX = 0
.MyY = 0
.MyZ = 0
End With
Return Instance.Login()
End Function
Private Function Login(ByVal name As String, ByVal citizenNumber As Integer, ByVal privilegePassword As String) As Result
With Instance.Attributes
.LoginName = name
.LoginOwner = citizenNumber
.LoginPrivilegePassword = privilegePassword
End With
Return Instance.Login()
End Function
Private Sub OnAvatarEnter(ByVal sender As IInstance)
With sender
.Whisper(.Attributes.AvatarSession, "Greetings {0}, welcome to {1}!", .Attributes.AvatarName, .Attributes.WorldName)
End With
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment