ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
VB.NET(2005) Working SDK Code. (Sdk)
VB.NET(2005) Working SDK Code. // Sdkds dark scorpionNov 25, 2005, 3:38am
I have it working now. It was pretty easy but it keeps giving me exceptions
and it's just being gay. If anyone wants the SDK Core code for .NET just post. deltaphcNov 25, 2005, 4:52am
You made a .NET wrapper for the AW SDK?
If so, I wanna see. -- - DeltaPHC Cit 355508 http://delta.digibase.ca [View Quote] strike rapierNov 25, 2005, 9:00am
[View Quote]
Programming code cannot be gay. Please grow up.
-- - Mark Randall http://zetech.swehli.com "Those people that think they know everything are a great annoyance to those of us who do" Isaac Asimov ds dark scorpionNov 25, 2005, 11:13am
You can use the 36 or 41 COM Wrapper for .NET...Here is the code, but you
must put AWSDK3 as a reference. This is a module by the way Imports AWSDKLib3 Imports System Imports System.IO 'import the enums Imports AWSDKLib3.AW_ATTRIBUTE Imports AWSDKLib3.AW_CHAT_TYPES Imports AWSDKLib3.AW_EVENT_ATTRIBUTE Imports AWSDKLib3.AW_SDK_CONSTANTS Module SDKCore Public BotName As String Public AvatarName As String Public ChatMessage As String Public ObjectAction As String Public Session As Long Public BotVersion As String Public WithEvents SDK As New AwSdk3 Private WithEvents EvntTimer As New Timer Public Function Logon(ByVal UniHost As String, ByVal UniPort As Long, ByVal Owner As Long, ByVal Bot As String, ByVal PPW As String, ByVal World As String, ByVal X As Long, ByVal Y As Long, ByVal Z As Long, ByVal YAW As Long) As Long BotName = Bot Dim RC As Long = 0 'initialize the AW Sdk RC = SDK.aw_init(AW_BUILD) If Not RC = 0 Then Logon = RC : Exit Function 'connect to universe RC = SDK.aw_create(UniHost, UniPort) If Not RC = 0 Then Logon = RC : Exit Function 'logon to the universe SDK.aw_string_set(AW_LOGIN_APPLICATION, BotName) SDK.aw_string_set(AW_LOGIN_NAME, BotName) SDK.aw_int_set(AW_LOGIN_OWNER, Owner) SDK.aw_string_set(AW_LOGIN_PRIVILEGE_PASSWORD, PPW) BotName = BotName RC = SDK.aw_login() If Not RC = 0 Then Logon = RC : Exit Function 'get into the world with global mode SDK.aw_bool_set(AW_ENTER_GLOBAL, 1) RC = SDK.aw_enter(World) If Not RC = 0 Then Logon = RC : Exit Function 'Set the coordinates RC = ChangeBotCoords(X, Y, Z, 0, 0) If Not RC = 0 Then Logon = RC : Exit Function 'Set the Events Dim i As Integer = 0 For i = 0 To AW_MAX_EVENT - 1 SDK.aw_event_set(i) Next 'Set the timer EvntTimer.Interval = 100 EvntTimer.Enabled = True End Function Public Sub Disconnect() SDK.aw_term() SDK.aw_destroy() End Sub 'useful functions Public Function ChangeBotCoords(ByVal X As Long, ByVal Y As Long, ByVal Z As Long, ByVal Type As Long, ByVal Yaw As Long) As Long SDK.aw_int_set(AW_MY_X, X) SDK.aw_int_set(AW_MY_Y, Y) SDK.aw_int_set(AW_MY_Z, Z) SDK.aw_int_set(AW_MY_YAW, Yaw) SDK.aw_int_set(AW_MY_TYPE, Type) ChangeBotCoords = SDK.aw_state_change End Function Public Function Console(ByVal Session As Long, ByVal Message As String, Optional ByVal Red As Long = 0, Optional ByVal Green As Long = 0, Optional ByVal Blue As Long = 0, Optional ByVal Bold As Boolean = False, Optional ByVal Italics As Boolean = False) As Long Message = Replace(Message, "%t", vbTab) Message = Replace(Message, "%n", vbCrLf) SDK.aw_string_set(AW_CONSOLE_MESSAGE, Message) SDK.aw_int_set(AW_CONSOLE_BLUE, Blue) SDK.aw_int_set(AW_CONSOLE_RED, Red) SDK.aw_int_set(AW_CONSOLE_GREEN, Green) SDK.aw_bool_set(AW_CONSOLE_ITALICS, Italics) SDK.aw_bool_set(AW_CONSOLE_BOLD, Bold) Console = SDK.aw_console_msg(Session) End Function Public Function ObjectAdd(ByRef ReturnNumber As Long, ByVal Model As String, ByVal X As Long, ByVal Y As Long, ByVal Z As Long, Optional ByVal Action As String = "", Optional ByVal Description As String = "", Optional ByVal Yaw As Long = 0, Optional ByVal Tilt As Long = 0, Optional ByVal roll As Long = 0, Optional ByVal owner As Long = 0) As Long SDK.aw_int_set(AW_OBJECT_X, X) SDK.aw_int_set(AW_OBJECT_Y, Y) SDK.aw_int_set(AW_OBJECT_Z, Z) SDK.aw_int_set(AW_OBJECT_YAW, Yaw) SDK.aw_int_set(AW_OBJECT_TILT, Tilt) SDK.aw_int_set(AW_OBJECT_ROLL, roll) SDK.aw_string_set(AW_OBJECT_MODEL, Model) SDK.aw_string_set(AW_OBJECT_ACTION, Action) SDK.aw_string_set(AW_OBJECT_DESCRIPTION, Description) If Not owner = 0 Then SDK.aw_int_set(AW_OBJECT_OWNER, owner) ObjectAdd = SDK.aw_object_load() Else ObjectAdd = SDK.aw_object_add() End If ReturnNumber = SDK.aw_int(AW_OBJECT_NUMBER) End Function Public Function ObjectDelete(ByVal Number As Long, ByVal X As Long, ByVal Z As Long) As Long SDK.aw_int_set(AW_OBJECT_OLD_NUMBER, Number) SDK.aw_int_set(AW_OBJECT_NUMBER, Number) SDK.aw_int_set(AW_OBJECT_OLD_X, X) SDK.aw_int_set(AW_OBJECT_X, X) SDK.aw_int_set(AW_OBJECT_OLD_Z, Z) SDK.aw_int_set(AW_OBJECT_Z, Z) ObjectDelete = SDK.aw_object_delete() End Function Private Sub EvntTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles EvntTimer.Tick SDK.aw_wait(0) End Sub Private Sub SDK_EventAvatarAdd() Handles SDK.EventAvatarAdd End Sub Private Sub SDK_EventAvatarDelete() Handles SDK.EventAvatarDelete End Sub Private Sub SDK_EventChat() Handles SDK.EventChat End Sub End Module r i c h a r dNov 25, 2005, 2:02pm
I just add it to my toolbox and drop it straight on a form in vb.net its not
that hard and appart from a couple imports is identical to using it as we did in VB6 deltaphcNov 25, 2005, 7:42pm
[View Quote]
I prefer to do it all in code myself.
Public WithEvents sdk As New AwSdk41 sdk.whatever() Also, a bot that I've been working on for months on and off is written in VB.NET 2005. I posted about it in the bots newsgroup, but no one seems to be noticing it that much. =P -- - DeltaPHC Cit 355508 http://delta.digibase.ca ds dark scorpionNov 25, 2005, 8:37pm
It's easier in a module then when you want to do something in a different
form, you dont have to do Form2.SDK.Aw_string(AW_CHAT_MESSAGE) All you have to od is sdk.aw_string(AW_CHAT_MESSAGE) So, like I said, its easier. |