Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
lt // User Search
lt // User SearchSample code for VB Wrapper. Newbies check this out!Feb 25, 2001, 9:52am
This is a multi-part message in MIME format.
------=_NextPart_000_0045_01C09F20.55524A00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Here you go for all you newbies to the VB Wrapper. =20 Not the best format, but it works and is most easy to understand. (well = by me anyhow) Doing it this way gets rid of the quickstart, but i prefer it because it = adds a lot more functionality. This also allows you to specify the = universe the bot logs into. If you have any probs, email me at: support at gateway-net.net Enjoy, LT ---- -------------------------------------------------------------------------= ------- Here goes: Create an empty project add the awsdkocx2.ocx module to the form and change the name to: SDK = *** NB, You may use this code for awsdkocx3.ocx when it becomes = available. then add a timer to the form and name it timAwWait Then use the following code to get the bot to log into the universe, = enter a world, appear and then say hello to everyone present, via = whisper. Copy and paste into VB below this line. Remove any other code from the = form before you do. Also remember to make changes to the starting world, citizen number and = priv password before you run it. you may also want to change the = universe. -------------------------------------------------------------------------= ------- Private Const CitizenNumber =3D 1 'This is the citizen number Private Const Password =3D "mypassword" 'The priv pass for that citizen = number Private Const BotName =3D "VB Bot" 'I'm sure you can be creative on this = one Private Const Application =3D "VB Bot using AWSDKOCX2" 'This is optional Private Const Universe =3D "auth.activeworlds.com" 'This is the universe = to enter, ie. auth.seeray.com for OuterWorlds etc. Private Const Port =3D 5670 ' This is the port to enter on the universe. = NB: MOST if not all universes use the default port so you can just put = a 0 (ZERO) here. Private Const World =3D "GBot" ' This is the world to enter ' These below give the starting point within the world Private Const MyX =3D 0 Private Const MyY =3D 0 Private Const MyZ =3D 0 Private Const MyYaw =3D 0 Private Const MyType =3D 0 'This is the avatar type 0 and 1 are the = tourist types. Private Sub Form_Load() With sdk =20 ..AwInit AW_BUILD ' Init the API ..AwCreate Universe, Port ' Gets ready to log into the universe =20 ..AwEventSet AW_EVEN_AVATAR_ADD ' Allows the program to receuve events = for the entry of an user into the world or the "visual" range of the = bot. =20 'All of theses below set the login parameters .AwLoginApplication =3D Application .AwLoginOwner =3D CitizenNumber .AwLoginPrivilegePassword =3D Password .AwLoginName =3D BotName .AwLogin 'Performs the login, I would suggest you put in error = checking here, but I have left it out for simplicty =20 .AwEnter World, 0 'This enters the world. IMPORTANT NOTE: If you = are using the 3.1 SDK, you MUST remove the ", 0" or the program WILL = NOT FUNCTION. At the time of writing, the 3.1 VB Wrapper has not been = released, so for most of you, this will remain as it is, but for those = that come back in a couple of months time and need the info, here is the = solution. =20 ' The lines below specify the location of the bot within the world. IF = you ommit the lines here, the bot will still be in the world, only = invisible and will be limited to only a few functions. .AwMyType =3D MyType .AwMyX =3D MyX .AwMyY =3D MyY .AwMyZ =3D MyZ .AwMyYaw =3D MyYaw =20 .AwStateChange =20 =20 End With =20 ' Starts the aw wait timer =20 TIMawWAIT.Interval =3D 1000 TIMawWAIT.Enabled =3D True End Sub Private Sub Form_Unload(Cancel As Integer) TIMawWAIT.Enabled =3D False ' Stops the timer sdk.AwTerm ' Kills the SDK End Sub Private Sub timAwWait_Timer() sdk.AwWait 0 End Sub Private Sub sdk_EventAvatarAdd() ' When another user enters the = world.... sdk.AwWhisper sdk.AwAvatarSession, "Hello " & sdk.AwAvatarName = 'Whisper Hello and their name to him / her End Sub ------=_NextPart_000_0045_01C09F20.55524A00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3DArial size=3D2>Here you go for all you newbies to the = VB=20 Wrapper. </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Not the best format, but it works and = is most easy=20 to understand. (well by me anyhow)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Doing it this way gets rid of the = quickstart, but i=20 prefer it because it adds a lot more functionality. This also = allows you=20 to specify the universe the bot logs into.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>If you have any probs, email me at: <A=20 href=3D"mailto:support at gateway-net.net">support at gateway-net.net</A></FONT= ></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Enjoy,</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>LT</FONT></DIV> <DIV><FONT face=3DArial size=3D2>----</FONT></DIV> <DIV> </DIV> <DIV> <HR> </DIV> <DIV><FONT face=3DArial size=3D2>Here goes:</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Create an empty project<BR>add the = awsdkocx2.ocx=20 module to the form and change the name to: SDK *** NB, You may = use this=20 code for awsdkocx3.ocx when it becomes available.<BR>then add a timer to = the=20 form and name it timAwWait<BR></FONT></DIV> <DIV><FONT face=3DArial size=3D2>Then use the following code to get the = bot to log=20 into the universe, enter a world, appear and then say hello to everyone = present,=20 via whisper.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Copy and paste into VB below this = line. =20 Remove any other code from the form before you do.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Also remember to make changes to the = starting=20 world, citizen number and priv password before you run it. you may = also=20 want to change the universe.</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D1> <HR> </FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D1>Private Const CitizenNumber =3D = 1 'This is=20 the citizen number<BR>Private Const Password =3D "mypassword" 'The priv = pass for=20 that citizen number<BR>Private Const BotName =3D "VB Bot" 'I'm sure you = can be=20 creative on this one<BR>Private Const Application =3D "VB Bot using = AWSDKOCX2"=20 'This is optional<BR>Private Const Universe =3D "auth.activeworlds.com" = 'This is=20 the universe to enter, ie. auth.seeray.com for OuterWorlds = etc.<BR>Private Const=20 Port =3D 5670 ' This is the port to enter on the universe. NB: = MOST if not=20 all universes use the default port so you can just put a 0 (ZERO)=20 here.<BR>Private Const World =3D "GBot" ' This is the world to = enter</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>' These below give the starting = point=20 within the world</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>Private Const MyX =3D = 0<BR>Private Const MyY=20 =3D 0<BR>Private Const MyZ =3D 0<BR>Private Const MyYaw =3D = 0</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>Private Const MyType =3D 0 = 'This is the=20 avatar type 0 and 1 are the tourist types.<BR>Private Sub=20 Form_Load()</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>With sdk<BR> <BR>.AwInit = AW_BUILD '=20 Init the API</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>.AwCreate Universe, Port ' Gets = ready to=20 log into the universe<BR> <BR>.AwEventSet = AW_EVEN_AVATAR_ADD '=20 Allows the program to receuve events for the entry of an user into the = world or=20 the "visual" range of the = bot.<BR> =20 <BR> 'All of theses below set the login parameters</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1> = ..AwLoginApplication =3D=20 Application<BR> .AwLoginOwner =3D=20 CitizenNumber<BR> .AwLoginPrivilegePassword =3D=20 Password<BR> .AwLoginName =3D BotName</FONT></DIV> <DIV> </DIV> <DIV><BR><FONT face=3D"Courier New" size=3D1> .AwLogin = 'Performs=20 the login, I would suggest you put in error checking here, but I have = left it=20 out for simplicty<BR> <BR> .AwEnter = World,=20 0 'This enters the world. IMPORTANT NOTE: If you are = using the=20 3.1 SDK, you MUST remove the ", 0" or the program WILL NOT = FUNCTION. At=20 the time of writing, the 3.1 VB Wrapper has not been released, so for = most of=20 you, this will remain as it is, but for those that come back in a couple = of=20 months time and need the info, here is the = solution.<BR> =20 </FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>' The lines below specify the = location of=20 the bot within the world. IF you ommit the lines here, the bot = will still=20 be in the world, only invisible and will be limited to only a few=20 functions.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1> .AwMyType = =3D=20 MyType<BR> .AwMyX =3D MyX<BR> .AwMyY = =3D=20 MyY<BR> .AwMyZ =3D MyZ<BR> .AwMyYaw = =3D=20 MyYaw<BR> <BR> =20 ..AwStateChange<BR> <BR> =20 <BR> End With<BR> <BR>' Starts the aw wait=20 timer<BR> <BR> TIMawWAIT.Interval =3D=20 1000<BR> TIMawWAIT.Enabled =3D True</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>End Sub</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>Private Sub Form_Unload(Cancel = As=20 Integer)<BR> TIMawWAIT.Enabled =3D False ' Stops the=20 timer<BR> sdk.AwTerm ' Kills the SDK<BR>End = Sub</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>Private Sub=20 timAwWait_Timer()<BR> sdk.AwWait 0<BR>End = Sub</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Courier New" size=3D1>Private Sub = sdk_EventAvatarAdd() ' When=20 another user enters the world....<BR> sdk.AwWhisper=20 sdk.AwAvatarSession, "Hello " & sdk.AwAvatarName 'Whisper Hello and = their=20 name to him / her<BR>End Sub<BR></FONT></DIV></BODY></HTML> ------=_NextPart_000_0045_01C09F20.55524A00-- pleaseFeb 26, 2001, 7:20am
I think you will find that starcube.vr needs help with the basics of VB. He
has VB and asked me for help. But, I am really not a good teacher of VB, so if someone could help him get started in VB i'm sure he would be very thankful. I think that a reply with simply the SDK page is extreamly rude, who do you think you are agent1?!? -LT [View Quote] |