A simple greeter bot


If you completed the preperations, you can follow the steps below to login your bot.

1. Double click anywhere in your form except the icons. A new screen will show up with the text

Private Sub Form_Load()

End Sub

2. Remove all the text. And then place the follow text in the screen.

Private Sub CallBack_Timer()

' Gets events and callbacks
sdk.aw_wait (0)

End Sub

Private Sub Form_Load()

' The declarations
' NOTE: for VB .NET use Short insteed of Integer and use Integer insteed of Long.
 
Dim Login_Host As String, Login_Port As Integer, Login_Name As String, Login_Number As Long, Login_Password As String, Login_Description As String, Login_World As String, Login_X As Long, Login_Y As Long, Login_Z As Long, Login_Yaw As Long

' Set the strings and integers.
Login_Host = "auth.activeworlds.com" ' Host.
Login_Port = 5670 ' Port.
Login_Name = "VB Example" ' The name of the bot.
Login_Number = 123456789 ' Your citizen number.
Login_Password = "Secret" ' Your privilege password.
Login_Description = "VB Example 1." ' Bot description, can be read by Universe admin
Login_World = "AW" ' The world the bot needs to join
Login_X = 0 ' Bot X
Login_Y = 0 ' Bot Y
Login_Z = 0 ' Bot Z
Login_Yaw = 0 ' Bot Rotate

' Initializes the bot needs.
rc = sdk.aw_init(AW_BUILD)

' Sets the events and callbacks.
sdk.aw_event_set AW_EVENT_AVATAR_ADD

' Connect to the universe.
rc = sdk.aw_create(Login_Host, Login_Port)

' Send login data. And login.
sdk.aw_string_set AW_LOGIN_NAME, Login_Name
sdk.aw_int_set AW_LOGIN_OWNER, Login_Number
sdk.aw_string_set AW_LOGIN_PRIVILEGE_PASSWORD, Login_Password
sdk.aw_string_set AW_LOGIN_APPLICATION, Login_Description
rc = sdk.aw_login()

' Enter the world.
rc = sdk.aw_enter(Login_World)

' Set position and becomes visible.
sdk.aw_int_set AW_MY_X, Login_X
sdk.aw_int_set AW_MY_Y, Login_Y
sdk.aw_int_set AW_MY_Z, Login_Z
sdk.aw_int_set AW_MY_YAW, Login_Yaw
rc = sdk.aw_state_change()

Callback.Interval = 100
Callback.Enabled = True

End Sub

Private Sub Form_Unload(Cancel As Integer)

' Clears memory
sdk.aw_destroy
sdk.aw_term

End Sub

Private Sub sdk_EventAvatarAdd()

Dim Avatar_Name As String

Avatar_Name = sdk.aw_string(AW_AVATAR_NAME)

sdk.aw_say "Hi " & Avatar_Name

End Sub

3. Search 'Login_Host', and replace all the values in the list if it is required.
4. If you are done press F5 to start your bot. A new screen wil popup wich is empty, now go to your world and you can see the bot is inside.


Many thanks to DutchBull for providing this example.
Note, The example is kept very simple. Advanced VB coders might have more sophisticated solutions.

Active Worlds™ is a trademark of Activeworlds Inc. You may obtain support from the Active Wiki at http://wiki.activeworlds.com/index.php?title=SDK. Problems with this web page should be reported to the author.

Copyright © 1998-2008 Activeworlds Inc. All rights reserved.