Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
.duo. // User Search
.duo. // User SearchVery Very BAD errors in C++ (HELP!!!)Jul 8, 2002, 7:58pm
I get these linking errors when I try to compile a bot:
DuoBot.obj : error LNK2001: unresolved external symbol _aw_term DuoBot.obj : error LNK2001: unresolved external symbol _aw_destroy DuoBot.obj : error LNK2001: unresolved external symbol _aw_wait DuoBot.obj : error LNK2001: unresolved external symbol _aw_state_change DuoBot.obj : error LNK2001: unresolved external symbol _aw_enter DuoBot.obj : error LNK2001: unresolved external symbol _aw_login DuoBot.obj : error LNK2001: unresolved external symbol _aw_string_set DuoBot.obj : error LNK2001: unresolved external symbol _aw_int_set DuoBot.obj : error LNK2001: unresolved external symbol _aw_create DuoBot.obj : error LNK2001: unresolved external symbol _aw_event_set DuoBot.obj : error LNK2001: unresolved external symbol _aw_init DuoBot.obj : error LNK2001: unresolved external symbol _aw_say DuoBot.obj : error LNK2001: unresolved external symbol _aw_string Debug/DuoBot.exe : fatal error LNK1120: 13 unresolved externals Can anyone help me? HELP!! Fatal linking errors in C++!!Jul 8, 2002, 7:58pm
Whenever I try to compile a bot I get these linking errors:
DuoBot.obj : error LNK2001: unresolved external symbol _aw_term DuoBot.obj : error LNK2001: unresolved external symbol _aw_destroy DuoBot.obj : error LNK2001: unresolved external symbol _aw_wait DuoBot.obj : error LNK2001: unresolved external symbol _aw_state_change DuoBot.obj : error LNK2001: unresolved external symbol _aw_enter DuoBot.obj : error LNK2001: unresolved external symbol _aw_login DuoBot.obj : error LNK2001: unresolved external symbol _aw_string_set DuoBot.obj : error LNK2001: unresolved external symbol _aw_int_set DuoBot.obj : error LNK2001: unresolved external symbol _aw_create DuoBot.obj : error LNK2001: unresolved external symbol _aw_event_set DuoBot.obj : error LNK2001: unresolved external symbol _aw_init DuoBot.obj : error LNK2001: unresolved external symbol _aw_say DuoBot.obj : error LNK2001: unresolved external symbol _aw_string Debug/DuoBot.exe : fatal error LNK1120: 13 unresolved externals Could someone help me fix this? HELP My VB bot won't log onJul 26, 2002, 11:55pm
Here is the code for my vb bot:
Dim NSC As Long Dim EWC As Long Dim H As Long Dim AVR As Long Dim AVN As Long Dim PPW As String Dim BNa As String Dim WNa As String Dim CNu As Long Private Sub sdk_EventChat() CRTB.Text = CRTB.Text & sdk.AwAvatarName & ": " & sdk.AwChatMessage & Chr(13) & Chr(10) End Sub Private Sub CSTB_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then sdk.AwSay CSTB.Text CRTB.Text = CRTB.Text & BNTB.Text & ": " & CSTB.Text & Chr(13) & Chr(10) CSTB.Text = "" End If End Sub Private Sub ENDPROGRAM_Click() sdk.AwDestroy End End Sub Private Sub LB_Click() EWC = EWCTB.Text EWC = EWC * 1000 NSC = NSCTB.Text NSC = NSC * 1000 H = HTB.Text H = H * 1000 AVR = AVRTB.Text AVR = AVR * 1000 AVN = ANTB.Text CNu = CNTB.Text PPW = PPTB.Text BNa = BNTB.Text WNa = WNTB.Text sdk.AwInit AW_BUILD sdk.QuickStart CNu, PPW, BNa, "DuoBot", WNa, EWC, H, NSC, AVR, AVN CRTB.Text = CRTB.Text & sdk.AwWorldWelcomeMessage & Chr(13) & Chr(10) CML.Visible = True CMTB.Visible = True WTL.Visible = True WPTB.Visible = True WMTB.Visible = True CSTB.Visible = True CRTB.Visible = True EWCTB.Visible = False NSCTB.Visible = False HTB.Visible = False ANTB.Visible = False AVRTB.Visible = False CNTB.Visible = False WNTB.Visible = False PPTB.Visible = False BNTB.Visible = False AVL.Visible = False HL.Visible = False LEWL.Visible = False LNSL.Visible = False WNL.Visible = False BNL.Visible = False PPL.Visible = False CNL.Visible = False MainForm.Height = 4100 End Sub This is really wierd because it works fine until I changed the awsdkocx5 control's name from Aw1 to sdk. It didnt work after I tried chnaging it back either. HELP HELP My VB bot won't log onJul 27, 2002, 10:52am
HELP My VB bot won't log onJul 27, 2002, 11:23am
Here is my re-done code:
Dim rc As Long Public Sub PhaseB() 'Makes parts of the window invisible and makes the chat window visible CML.Visible = True CMTB.Visible = True WTL.Visible = True WPTB.Visible = True WMTB.Visible = True CSTB.Visible = True CRTB.Visible = True EWCTB.Visible = False NSCTB.Visible = False HTB.Visible = False ANTB.Visible = False AVRTB.Visible = False CNTB.Visible = False WNTB.Visible = False PPTB.Visible = False BNTB.Visible = False AVL.Visible = False HL.Visible = False LEWL.Visible = False LNSL.Visible = False WNL.Visible = False BNL.Visible = False PPL.Visible = False CNL.Visible = False AVRL.Visible = False AVRTB.Visible = False MainForm.Height = 4100 End Sub Private Sub Form_Load() sdk.AwInit (AW_BUILD) 'Initionalizes API rc = sdk.AwInit(AW_BUILD) If rc Then MsgBox "Error Initializing SDK! (Reason " & rc & ": " & sdk.RCLookUp(rc) & ")" End End If End Sub Private Sub sdk_EventChat() CRTB.Text = CRTB.Text & sdk.AwAvatarName & ": " & sdk.AwChatMessage & Chr(13) & Chr(10) 'Takes in message End Sub Private Sub CSTB_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then 'Checks for the enter key sdk.AwSay CSTB.Text 'Says what's in the text box CRTB.Text = CRTB.Text & BNTB.Text & ": " & CSTB.Text & Chr(13) & Chr(10) 'Displays what the bot says in the textbox used for recieving CSTB.Text = "" 'Empties text box used for entering things to say End If 'Ends the if statement End Sub Private Sub ENDPROGRAM_Click() sdk.AwDestroy 'Ends Aw End 'Closes Program End Sub Private Sub LB_Click() sdk.QuickStart CNTB.Text, PPTB.Text, BNTB.Text, "DuoBot", WNTB.Text, EWCTB.Text * 1000, HTB * 1000, NSCTB.Text * 1000, AVRTB.Text * 1000, AVN 'Logs the bot in If rc Then MsgBox "error: " & sdk.RCLookUp(rc) Else Call PhaseB 'Calls PhaseB CRTB.Text = CRTB.Text & sdk.AwWorldWelcomeMessage & Chr(13) & Chr(10) 'Displays the welcome message End If End Sub When I run this bot, I get a error in the message box saying: "Error Initializing SDK! (Reason 454: RC_Version_Mismatch" I hope this clears up what I need to dofo rall of you, because I have no idea. HELP My VB bot won't log onJul 27, 2002, 11:24am
O man, LOL turns out I was including the 3 and 5 OCX, LMAO. Now it works
that I've gotten rid of the 3 [View Quote] New to C++, how to make it work with an interface?Aug 19, 2002, 8:42pm
I'm pretty sure you guys are telling him the wrong thing. I had the same
error, and this is how you fix it: The ClassView window at the left side of the screen is what shows, but there are two tabs below that window. Click on FileView, then right click on Resource Files and then Add Files To Folder, then select AW_STATIC.lib and AW_STATIC will work. THen to get Aw.h working Right click on External Dependencies and go through the same process just to be sure. It should now work. I hate it when that happens. [View Quote] Local Console Messages?Aug 19, 2002, 8:33pm
Is there a session ID that allows you to create a console message only
within the bots range? If so please tell me. Local Console Messages?Aug 19, 2002, 8:57pm
Also, how do I get VB console messages to work, lol.
[View Quote] Local Console Messages?Aug 19, 2002, 8:33pm
Is there a session ID that allows you to create a console message only
within the bots range? If so please tell me. Local Console Messages?Aug 19, 2002, 11:41pm
Console messages are better for phonebots
[View Quote] Local Console Messages?Aug 20, 2002, 10:01am
I amde a set of functions that added session numbers to a list of people
during EventAvatarAdd using an array of sessions. The place where new session numbers should be are is saved by a long, and it sends messages, but it seems to not read the session ids from the array )-: [View Quote] HELP! I don't understand terrain and objects in the C++ SDK...Jan 19, 2003, 10:44pm
I don't understand how to add/change terrain and objects, let alone query
them. Could someone pelase help me with this, since the AW SDK site does a pretty bad job of explaining. HELP! I don't understand terrain and objects in the C++ SDK...Jan 25, 2003, 10:17am
Trees on terrainJan 21, 2003, 12:20am
Yeah, how do you query tertain? >_<
How do you edit it? How do you access what you queried? How do you know which terrain is in which cell? [View Quote] 3.4 vb sdkFeb 7, 2003, 7:56pm
Its based on the same architecture, but C is not as powerful. Hence C++.
BTW, this seems dumb, but I haven't programmed in a while, so I forgot how to add text to a string, LOL. Do you use an & sign or a function or what? [View Quote] 3.4 vb sdkFeb 7, 2003, 11:24pm
I know those functions but they always crash my bots. >_< Its kind of
annoying how unstable they are. [View Quote] 3.4 vb sdkFeb 7, 2003, 11:45pm
This is a multi-part message in MIME format.
------=_NextPart_000_001F_01C2CEE9.DAFEAAE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Honestly, I just suck at VB. I can't even get a VB bot to work. I can = do much more in C++. I just can't add text to these strings. I'm just = making a rights bot which has taken five minutes so far, its just that I = can't make it add the text. [View Quote] Its completely unpolished, rushed, and badly programmed, but oh well. My bots code: #define AW_STATIC #include <iostream.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <aw.h> void handle_avatar_add (void); void handle_chat (void); void handle_avatar_delete (void); void ProcessRights (); char* copya (char* t); bool CheckString (char* o,char* t); char* addtext (char* o,char* t); int StringLength (char* t); bool TheMask =3D false; bool Builderz =3D false; bool NelXaga =3D false; bool Cameron999 =3D false; bool SuperGuy3 =3D false; bool Cadet =3D false; void main (int argc, char *argv[]) { ProcessRights(); int rc; //API if (rc =3D aw_init (AW_BUILD)) { cout<<"Unable to initialize the API (reason %d)\n"<<rc; } //Set events aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add); aw_event_set (AW_EVENT_CHAT, handle_chat); aw_event_set (AW_EVENT_AVATAR_DELETE, handle_avatar_delete); aw_state_change (); for (;;) { if (aw_wait (1000)) { break; } } //Bot Instance if (rc =3D aw_create (0, 0, 0)) { cout<<"Unable to create bot instance (reason %d)\n"<<rc; exit (1); } //Login Bot aw_string_set (AW_LOGIN_NAME, "RightsBot"); aw_int_set (AW_LOGIN_OWNER, 342836); aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, "zero"); aw_string_set (AW_LOGIN_APPLICATION, "DuoBot: RightsBot"); if (rc =3D aw_login ()) { cout<<"Unable to login (reason "<<rc<<")\n"; } //Enter Bot Into World if (rc =3D aw_enter ("Jediwrld")) { printf("Unable to enter world (reason %d)\n", rc); exit (1); } puts (aw_string (AW_WORLD_WELCOME_MESSAGE)); //Go to place aw_int_set (AW_MY_X, 0000);=20 aw_int_set (AW_MY_Z, 0000);=20 aw_int_set (AW_MY_YAW, 0000); aw_int_set (AW_MY_TYPE, 0); aw_int_set (AW_MY_GESTURE, 0); if (rc =3D aw_state_change ()) { cout<<"Unable to change state (reason %d)\n"<<rc; exit (1); } //Main event loop while (!aw_wait (-1)) ; //Close Bot aw_destroy (); aw_term (); } void handle_avatar_add (void) { char* name =3D new char; int session; name =3D copya(aw_string(AW_AVATAR_NAME)); session =3D aw_int(AW_AVATAR_SESSION); if(!stricmp(name,"TheMask")) { aw_whisper(session,"Whisper password to gain rights"); } else if(!stricmp(name,"Builderz")) { aw_whisper(session,"Whisper password to gain rights"); } else if(!stricmp(name,"NelXaga")) { aw_whisper(session,"Whisper password to gain rights"); } else if(!stricmp(name,"Cameron999")) { aw_whisper(session,"Whisper password to gain rights"); } else if(!stricmp(name,"SuperGuy3")) { aw_whisper(session,"Whisper password to gain rights"); } else if(!stricmp(name,"Cadet")) { aw_whisper(session,"Whisper password to gain rights"); } } void handle_chat () { char* message =3D new char; char* name =3D new char; int session; message =3D copya(aw_string(AW_CHAT_MESSAGE)); name =3D copya(aw_string(AW_AVATAR_NAME)); session =3D aw_int(AW_CHAT_SESSION); if(!stricmp(message,"=B6Noob Hater Alpha Boss=B6")) { if(!stricmp(name, "TheMask")) { TheMask =3D true; } } else if(!stricmp(message,"=B6I Will Build Even Though I Say I = Won't=B6")) { if(!stricmp(name,"Builderz")) { Builderz =3D true; } } else if(!stricmp(message,"=B6Noob Hater Beta Supreme=B6")) { if(!stricmp(name,"NelXaga")) { NelXaga =3D true; } } else if(!stricmp(message,"=B6Large Stinky Gorillas Basking In The = Sun=B6")) { if(!stricmp(name,"Cameron999")) { Cameron999 =3D true; } } else if(!stricmp(message,"=B6Theworld is a dumbass noob using = AWHack=B6")) { if(!stricmp(name,"SuperGuy3")) { SuperGuy3 =3D true; } } else if(!stricmp(message,"=B6I Had Better Do Well :-P=B6")) { if(!stricmp(name,"Cadet")) { Cadet =3D true; } } else { //Do nothing } ProcessRights(); } void handle_avatar_delete () { char* name =3D new char; int session; name =3D copya(aw_string(AW_AVATAR_NAME)); session =3D aw_int(AW_AVATAR_SESSION); if(!stricmp(name,"TheMask")) { TheMask =3D false; } else if(!stricmp(name,"Builderz")) { Builderz =3D false; } else if(!stricmp(name,"NelXaga")) { NelXaga=3D false; } else if(!stricmp(name,"Cameron999")) { Cameron999 =3D false; } else if(!stricmp(name,"SuperGuy3")) { SuperGuy3 =3D false; } else if(!stricmp(name,"Cadet")) { Cadet =3D false; } else { //Do nothing } ProcessRights(); } void ProcessRights() { char* b =3D new char; char* ed =3D new char; char* ps =3D new char; char* e =3D new char; char* bt =3D new char; b =3D "342836"; ed =3D "342836"; ps =3D "342836"; e =3D "342836"; bt =3D "342836"; if(TheMask =3D=3D true) { strcat(b,",312237"); <b><----------- None of these work.</b> strcat(ed,",312237"); strcat(ps,",312237"); strcat(e,",312237"); strcat(bt,",312237"); } if(Builderz =3D=3D true) { strcat(b,",92986"); strcat(ed,",92986"); strcat(ps,",92986"); strcat(e,",92986"); strcat(bt,",92986"); } if(NelXaga =3D=3D true) { strcat(b,",337709"); strcat(ed,",337709"); strcat(ps,",337709"); strcat(e,",337709"); strcat(bt,",337709"); } if(Cameron999 =3D=3D true) { strcat(b,",350803"); strcat(ed,",350803"); strcat(ps,",350803"); strcat(e,",350803"); strcat(bt,",350803"); } if(SuperGuy3 =3D=3D true) { strcat(b,",347525"); strcat(ed,",347525"); strcat(ps,",347525"); strcat(e,",347525"); strcat(bt,",347525"); } if(Cadet =3D=3D true) { strcat(ps,",350957"); strcat(e,",350957"); } aw_string_set (AW_WORLD_BUILD_RIGHT, b); aw_string_set (AW_WORLD_EMINENT_DOMAIN_RIGHT, ed); aw_string_set (AW_WORLD_PUBLIC_SPEAKER_RIGHT, ps); aw_string_set (AW_WORLD_EJECT_RIGHT, e); aw_string_set (AW_WORLD_BOTS_RIGHT, bt); } char* copya (char* t) { char* out =3D new char; for(int C=3D0;t[C] !=3D NULL;C++) { out[C] =3D t[C]; } return out; } char* addtext (char* o,char* t) { char* out =3D new char; for(int C =3D StringLength (o) + 1;t[C] !=3D NULL;C++) { out[C] =3D t[C]; } return out; } int StringLength (char* t) { int Plength; for(Plength=3D0;t[Plength] !=3D NULL;Plength++); return Plength; } bool CheckString (char* o,char* t) { int olength =3D StringLength (o); int tlength =3D StringLength (t); int mlength =3D 0; if(olength =3D=3D tlength) { for(int C =3D 0;t[C] !=3D NULL;C++) { if(o[C] =3D=3D t[C]) { mlength++; } } } if(mlength =3D=3D tlength) { return true; } else { return false; } } ------=_NextPart_000_001F_01C2CEE9.DAFEAAE0 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 http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2722.900" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3DArial size=3D2>Honestly, I just suck at VB. I = can't even get=20 a VB bot to work. I can do much more in C++. I just can't = add text=20 to these strings. I'm just making a rights bot which has taken = five=20 minutes so far, its just that I can't make it add the text.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>"bowen" <</FONT><A=20 href=3D"mailto:thisguyrules at 7k2.4mg.com.ANTISPAM"><FONT face=3DArial=20 size=3D2>thisguyrules at 7k2.4mg.com.ANTISPAM</FONT></A><FONT face=3DArial = size=3D2>>=20 [View Quote] 0);<BR> aw_int_set (AW_MY_GESTURE, 0);<BR> if (rc =3D = aw_state_change=20 ())<BR> {<BR> cout<<"Unable to change state = (reason=20 %d)\n"<<rc;<BR> exit (1);<BR> }<BR> //Main = event=20 loop<BR> while (!aw_wait (-1))<BR> =20 ;<BR> //Close Bot<BR> aw_destroy ();<BR> aw_term=20 ();<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>void handle_avatar_add = (void)<BR>{<BR> char*=20 name =3D new char;<BR> int session;<BR> name =3D=20 copya(aw_string(AW_AVATAR_NAME));<BR> session =3D=20 aw_int(AW_AVATAR_SESSION);<BR> if(!stricmp(name,"TheMask"))<BR> = ;{<BR> aw_whisper(session,"Whisper=20 password to gain rights");<BR> }<BR> else=20 if(!stricmp(name,"Builderz"))<BR> {<BR> aw_whisper(sessio= n,"Whisper=20 password to gain rights");<BR> }<BR> else=20 if(!stricmp(name,"NelXaga"))<BR> {<BR> aw_whisper(session= ,"Whisper=20 password to gain rights");<BR> }<BR> else=20 if(!stricmp(name,"Cameron999"))<BR> {<BR> aw_whisper(sess= ion,"Whisper=20 password to gain rights");<BR> }<BR> else=20 if(!stricmp(name,"SuperGuy3"))<BR> {<BR> aw_whisper(sessi= on,"Whisper=20 password to gain rights");<BR> }<BR> else=20 if(!stricmp(name,"Cadet"))<BR> {<BR> aw_whisper(session,"= Whisper=20 password to gain rights");<BR> }<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>void handle_chat ()<BR>{<BR> char* = message =3D=20 new char;<BR> char* name =3D new char;<BR> int = session;<BR> message=20 =3D copya(aw_string(AW_CHAT_MESSAGE));<BR> name =3D=20 copya(aw_string(AW_AVATAR_NAME));<BR> session =3D=20 aw_int(AW_CHAT_SESSION);<BR> if(!stricmp(message,"=B6Noob Hater = Alpha=20 Boss=B6"))<BR> {<BR> if(!stricmp(name,=20 "TheMask"))<BR> {<BR> TheMask =3D=20 true;<BR> }<BR> }<BR> else = if(!stricmp(message,"=B6I Will=20 Build Even Though I Say I=20 Won't=B6"))<BR> {<BR> if(!stricmp(name,"Builderz"))<BR>&n= bsp; {<BR> Builderz=20 =3D true;<BR> }<BR> }<BR> else = if(!stricmp(message,"=B6Noob=20 Hater Beta=20 Supreme=B6"))<BR> {<BR> if(!stricmp(name,"NelXaga"))<BR>&= nbsp; {<BR> NelXaga=20 =3D true;<BR> }<BR> }<BR> else = if(!stricmp(message,"=B6Large=20 Stinky Gorillas Basking In The=20 Sun=B6"))<BR> {<BR> if(!stricmp(name,"Cameron999"))<BR>&n= bsp; {<BR> Cameron999=20 =3D true;<BR> }<BR> }<BR> else = if(!stricmp(message,"=B6Theworld=20 is a dumbass noob using=20 AWHack=B6"))<BR> {<BR> if(!stricmp(name,"SuperGuy3"))<BR>= {<BR> SuperGuy3=20 =3D true;<BR> }<BR> }<BR> else = if(!stricmp(message,"=B6I Had=20 Better Do Well=20 :-P=B6"))<BR> {<BR> if(!stricmp(name,"Cadet"))<BR> &= nbsp;{<BR> Cadet=20 =3D = true;<BR> }<BR> }<BR> else<BR> {<BR>  = ;//Do=20 nothing<BR> }<BR> ProcessRights();<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>void handle_avatar_delete = ()<BR>{<BR> char*=20 name =3D new char;<BR> int session;<BR> name =3D=20 copya(aw_string(AW_AVATAR_NAME));<BR> session =3D=20 aw_int(AW_AVATAR_SESSION);<BR> if(!stricmp(name,"TheMask"))<BR> = ;{<BR> TheMask=20 =3D false;<BR> }<BR> else=20 if(!stricmp(name,"Builderz"))<BR> {<BR> Builderz =3D=20 false;<BR> }<BR> else=20 if(!stricmp(name,"NelXaga"))<BR> {<BR> NelXaga=3D=20 false;<BR> }<BR> else=20 if(!stricmp(name,"Cameron999"))<BR> {<BR> Cameron999 =3D = false;<BR> }<BR> else=20 if(!stricmp(name,"SuperGuy3"))<BR> {<BR> SuperGuy3 =3D=20 false;<BR> }<BR> else=20 if(!stricmp(name,"Cadet"))<BR> {<BR> Cadet =3D=20 false;<BR> }<BR> else<BR> {<BR> //Do=20 nothing<BR> }<BR> ProcessRights();<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>void = ProcessRights()<BR>{<BR> char* b =3D new=20 char;<BR> char* ed =3D new char;<BR> char* ps =3D new = char;<BR> char*=20 e =3D new char;<BR> char* bt =3D new char;<BR> b =3D = "342836";<BR> ed =3D=20 "342836";<BR> ps =3D "342836";<BR> e =3D "342836";<BR> bt = =3D=20 "342836";<BR> if(TheMask =3D=3D=20 true)<BR> {<BR> strcat(b,",312237"); = <b><-----------=20 None of these=20 work.</b><BR> strcat(ed,",312237");<BR> strca= t(ps,",312237");<BR> strcat(e,",312237");<BR> strca= t(bt,",312237");<BR> }<BR> if(Builderz=20 =3D=3D=20 true)<BR> {<BR> strcat(b,",92986");<BR> strcat= (ed,",92986");<BR> strcat(ps,",92986");<BR> strcat(= e,",92986");<BR> strcat(bt,",92986");<BR> }<BR> if(N= elXaga=20 =3D=3D=20 true)<BR> {<BR> strcat(b,",337709");<BR> strca= t(ed,",337709");<BR> strcat(ps,",337709");<BR> strc= at(e,",337709");<BR> strcat(bt,",337709");<BR> }<BR> = ;if(Cameron999=20 =3D=3D=20 true)<BR> {<BR> strcat(b,",350803");<BR> strca= t(ed,",350803");<BR> strcat(ps,",350803");<BR> strc= at(e,",350803");<BR> strcat(bt,",350803");<BR> }<BR> = ;if(SuperGuy3=20 =3D=3D=20 true)<BR> {<BR> strcat(b,",347525");<BR> strca= t(ed,",347525");<BR> strcat(ps,",347525");<BR> strc= at(e,",347525");<BR> strcat(bt,",347525");<BR> }<BR> = ;if(Cadet=20 =3D=3D=20 true)<BR> {<BR> strcat(ps,",350957");<BR> strc= at(e,",350957");<BR> }<BR> aw_string_set=20 (AW_WORLD_BUILD_RIGHT, b);<BR> aw_string_set=20 (AW_WORLD_EMINENT_DOMAIN_RIGHT, ed);<BR> aw_string_set=20 (AW_WORLD_PUBLIC_SPEAKER_RIGHT, ps);<BR> aw_string_set=20 (AW_WORLD_EJECT_RIGHT, e);<BR> aw_string_set (AW_WORLD_BOTS_RIGHT,=20 bt);<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>char* copya (char* = t)<BR>{<BR> char* out =3D new=20 char;<BR> for(int C=3D0;t[C] !=3D = NULL;C++)<BR> {<BR> out[C] =3D=20 t[C];<BR> }<BR> return out;<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>char* addtext (char* o,char* = t)<BR>{<BR> char*=20 out =3D new char;<BR> for(int C =3D StringLength (o) + 1;t[C] !=3D=20 NULL;C++)<BR> {<BR> out[C] =3D = t[C];<BR> }<BR> return=20 out;<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>int StringLength (char* = t)<BR>{<BR> int=20 Plength;<BR> for(Plength=3D0;t[Plength] !=3D = NULL;Plength++);<BR> return=20 Plength;<BR>}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>bool CheckString (char* o,char*=20 t)<BR>{<BR> int olength =3D StringLength (o);<BR> int tlength = =3D=20 StringLength (t);<BR> int mlength =3D 0;<BR> if(olength =3D=3D = tlength)<BR> {<BR> for(int C =3D 0;t[C] !=3D=20 NULL;C++)<BR> {<BR> if(o[C] =3D=3D=20 t[C])<BR> {<BR> mlength++;<BR>&nb= sp; }<BR> }<BR> }<BR> if(mlength=20 =3D=3D tlength)<BR> {<BR> return=20 true;<BR> }<BR> else<BR> {<BR> return=20 false;<BR> }<BR>}</FONT></DIV></BODY></HTML> ------=_NextPart_000_001F_01C2CEE9.DAFEAAE0-- 3.4 vb sdkFeb 8, 2003, 12:10pm
I've ran the debugger many times, and it crashes as soon as I use the string
functions. I hope what you said will fix my problem. [View Quote] 3.4 vb sdkFeb 17, 2003, 10:15am
No, that won't make a difference. I just use the booleans to know who is
who, and I track name changes and can just reprogram the bot. Cit numbers are a better idea since identifying by names just won't work >_< You see, it no longer detects matches because there are the 1000 unused characters in the strings, which appear as dashes... I ended up making a VB bot as an equivelent, and it doesn't work either ROFL. It'll be a lot harder to understand because I'm horrible at vb, but here it is: Dim Cameron999 As Boolean Dim NelXaga As Boolean Dim SuperGuy3 As Boolean Dim TSAAgent1 As Boolean Dim DSdarkknight As Boolean Dim Ssl As Boolean Dim Aeo As Boolean Dim Reaper As Boolean 'DS dark knight,TSA Agent 1,Cameron999,NelXaga,Ssl.,Aeo,Reaper. Private Sub Command1_Click() sdk.QuickStop sdk.AwDestroy sdk.AwTerm End End Sub Private Sub Form_Load() sdk.AwInit AW_BUILD sdk.EnableDefaultEvents sdk.EnableDefaultCallbacks sdk.QuickStart 342836, "zero", "RightsBot", "DuoBot", "jediwrld", 0, 0, 0, 0, 0 Cameron999 = False NelXaga = False SuperGuy3 = False TSAAgent1 = False DSdarkknight = False Ssl = False Aeo = False Reaper = False Call ProcessRights End Sub Private Sub sdk_EventAvatarAdd() aname = sdk.AwAvatarName asession = sdk.AwAvatarSession sdk.AwCitizenAttributesByName (aname) anumber = sdk.AwCitizenNumber sdk.AwSay aname sdk.AwSay asession sdk.AwSay anumber 'Check for entering builders and prompt them for rights password If aname = "Cameron999" Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "NelXaga" Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "SuperGuy3" Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "TSA Agent 1" Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "DS dark knight" Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "Ssl." Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "Aeo" Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = "Reaper." Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub If aname = ".Duo." Then sdk.AwWhisper asession, "Please whisper your password to me to gain rights.": Exit Sub End Sub Private Sub sdk_EventAvatarDelete() aname = sdk.AwAvatarName If aname = "Cameron999" Then Cameron999 = False If aname = "NelXaga" Then NelXaga = False If aname = "SuperGuy3" Then SuperGuy3 = False If aname = "TSA Agent 1" Then TSAAgent1 = False If aname = "DS dark knight" Then DSdarkknight = False If aname = "Ssl." Then Ssl = False If aname = "Aeo" Then Aeo = False If aname = "Reaper." Then Reaper = False Call ProcessRights End Sub Private Sub sdk_EventChat() aname = sdk.AwAvatarName asession = sdk.AwChatSession amessage = sdk.AwChatMessage sdk.AwCitizenAttributesByName (aname) anumber = sdk.AwCitizenNumber 'Check for passwords and who is saying them, otherwise anyone could get rights. If sdk.AwChatType = AW_CHAT_WHISPER Then If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "Cameron999" Then If anumber = "350803" Then Cameron999 = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "NelXaga" Then If anumber = "337709" Then NelXaga = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "SuperGuy3" Then If anumber = "347525" Then SuperGuy3 = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "TSA Agent 1" Then If anumber = "341102" Then TSAAgent1 = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "DS dark knight" Then If anumber = "339192" Then DSdarkknight = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "Ssl." Then If anumber = "334597" Then Ssl = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "Aeo" Then If anumber = "336611" Then Aeo = True End If End If End If If amessage = "REMOVED AS A SECURITY PRECAUTION :-P" Then If aname = "Reaper." Then If anumber = "338925" Then Reaper = True End If End If End If End If Call ProcessRights End Sub Public Sub ProcessRights() 'Define strings that will eventually be passed into the world rights list. Dim b As String 'Build Dim ed As String 'Eminent Domain Dim ps As String 'Public Speaker Dim e As String 'Eject Dim bt As String 'Bots 'Give rights to the CT bosses b = "342836,312237" ed = "342836,312237" ps = "342836,312237" e = "342836,312237" bt = "342836,312237" 'Check who has logged in and give them rights If Cameron999 = True Then b = b & ",350803" ed = ed & ",350803" ps = ps & ",350803" e = e & ",350803" bt = bt & ",350803" End If If NelXaga = True Then b = b & ",337709" ed = ed & ",337709" ps = ps & ",337709" e = e & ",337709" bt = bt & ",337709" End If If SuperGuy3 = True Then b = b & ",347525" ed = ed & ",347525" ps = ps & ",347525" e = e & ",347525" bt = bt & ",347525" End If If TSAAgent1 = True Then b = b & ",341102" ed = ed & ",341102" ps = ps & ",341102" e = e & ",341102" bt = bt & ",341102" End If If DSdarkknight = True Then b = b & ",339192" ed = ed & ",339192" ps = ps & ",339192" e = e & ",339192" bt = bt & ",339192" End If If Ssl = True Then b = b & ",334597" ed = ed & ",339192" ps = ps & ",339192" e = e & ",339192" bt = bt & ",339192" End If If Aeo = True Then b = b & ",336611" ed = ed & ",336611" ps = ps & ",336611" e = e & ",336611" bt = bt & ",336611" End If If Reaper = True Then b = b & ",338925" ed = ed & ",338925" ps = ps & ",338925" e = e & ",338925" bt = bt & ",338925" End If 'Process Rights sdk.AwWorldBuildRight = b sdk.AwWorldEminentDomainRight = ed sdk.AwWorldPublicSpeakerRight = ps sdk.AwWorldEjectRight = e sdk.AwWorldBotsRight = bt End Sub I'm also making a more advanced rights bot later. ----- Original Message ----- From: "ananas" <vha at oct31.de> Newsgroups: sdk Sent: Saturday, February 08, 2003 1:20 PM Subject: Re: 3.4 vb sdk > What Andras wrote will fix some crashes, that's for sure. > > But why do you identify the people by name at all? > Citizen numbers will not change as often as names and > a comparison of two integers is way faster than a string > comparison orgy - plus you could use switch/case very > comfortable like this : > > #define CIT_TheMask 12345 (well, put the correct cit. numbers there ;) > #define CIT_Builderz 12346 > (... and some more) > #define CIT_Cadet 13254 > > void handle_avatar_add (void) > { > int Session; > > switch (aw_int (AW_AVATAR_CITIZEN)) > { > case CIT_TheMask : > case CIT_Builderz : > (... and some more) > case CIT_Cadet : > Session = aw_int(AW_AVATAR_SESSION); > aw_whisper (Session, "Whisper password to gain rights"); > break; > } > } > > In handle_chat() you could choose a similar solution. As you would > need the cit. number #defines in several places, it would be helpful > to put them into a header file that you can #include where you need > the definitions. > > Optional you could hold all citizen numbers in an integer array > and compare those in a loop, a little slower but easier to add > more citizens. > > [View Quote] 3.4 vb sdkFeb 17, 2003, 11:08am
Sorry, read your post too quickly. Yeah, thats a great idea, it'll work a
lot better. Thank you. Could someone check out my VB anyway? heh heh heh [View Quote] 3.4 vb sdkFeb 17, 2003, 12:52pm
Oh, the bot mainly works, its just that strcat still crashes it >_< BTW, is
there anyway to add CTs with a bot? Code (RightsBot.cpp): #define AW_STATIC #include <iostream.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <aw.h> #include "bteam.h" void handle_avatar_add (void); void handle_chat (void); void handle_avatar_delete (void); void ProcessRights (); char* copya (char* t); bool CheckString (char* o,char* t); char* addtext (char* o,char* t); int StringLength (char* t); bool Cameron999 = false; bool NelXaga = false; bool SuperGuy3 = false; bool TSAAgent1 = false; bool DSdarkknight = false; bool Ssl = false; bool Aeo = false; bool Reaper = false; bool Duo = false; void main (int argc, char *argv[]) { int rc; //API if (rc = aw_init (AW_BUILD)) { cout<<"Unable to initialize the API (reason %d)\n"<<rc; } //Set events aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add); aw_event_set (AW_EVENT_CHAT, handle_chat); aw_event_set (AW_EVENT_AVATAR_DELETE, handle_avatar_delete); aw_state_change (); for (;;) { if (aw_wait (1000)) { break; } } //Bot Instance if (rc = aw_create (0, 0, 0)) { cout<<"Unable to create bot instance (reason %d)\n"<<rc; exit (1); } //Login Bot aw_string_set (AW_LOGIN_NAME, "RightsBot"); aw_int_set (AW_LOGIN_OWNER, 342836); aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, "zero"); aw_string_set (AW_LOGIN_APPLICATION, "DuoBot: RightsBot"); if (rc = aw_login ()) { cout<<"Unable to login (reason "<<rc<<")\n"; } //Enter Bot Into World if (rc = aw_enter ("Jediwrld")) { printf("Unable to enter world (reason %d)\n", rc); exit (1); } puts (aw_string (AW_WORLD_WELCOME_MESSAGE)); //Go to place aw_int_set (AW_MY_X, 0000); aw_int_set (AW_MY_Z, 0000); aw_int_set (AW_MY_YAW, 0000); aw_int_set (AW_MY_TYPE, 0); aw_int_set (AW_MY_GESTURE, 0); if (rc = aw_state_change ()) { cout<<"Unable to change state (reason %d)\n"<<rc; exit (1); } ProcessRights(); //Main event loop while (!aw_wait (-1)) ; //Close Bot aw_destroy (); aw_term (); } void handle_avatar_add (void) { int session; session = aw_int(AW_AVATAR_SESSION); switch (aw_int (AW_AVATAR_CITIZEN)) { case CIT_Cameron999: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_NelXaga: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_SuperGuy3: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_TSAAgent1: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_DSdarkknight: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_Ssl: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_Aeo: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_Reaper: { aw_whisper(session,"Whisper password to gain rights"); break; } case CIT_Duo: { aw_whisper(session,"Whisper password to gain rights"); break; } } } void handle_chat () { int session; session = aw_int(AW_CHAT_SESSION); if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶La®ge Stinky Gorillas Basking In The Sun¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_Cameron999) { Cameron999 = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶Nøøb Hater¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_NelXaga) { NelXaga = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶find it Soon¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_SuperGuy3) { SuperGuy3 = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶©racker Bobbers¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_TSAAgent1) { TSAAgent1 = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶Sme||¥ little crag monkeys¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_DSdarkknight) { DSdarkknight = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶Rotten Bannanas Basking in the Sün¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_Ssl) { Ssl = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶§trange passwords are hard to crack¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_Aeo) { Aeo = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶Che× Mix is Evil¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_Reaper) { Reaper = true; } } else if(!stricmp(aw_string(AW_CHAT_MESSAGE),"¶WOOFERS¶")) { if(aw_int (AW_AVATAR_CITIZEN) == CIT_Duo) { Duo = true; } } else { //Do nothing } ProcessRights(); } void handle_avatar_delete () { int session; session = aw_int(AW_AVATAR_SESSION); switch (aw_int (AW_AVATAR_CITIZEN)) { case CIT_Cameron999: { Cameron999 = false; break; } case CIT_NelXaga: { NelXaga = false; break; } case CIT_SuperGuy3: { SuperGuy3 = false; break; } case CIT_TSAAgent1: { TSAAgent1 = false; break; } case CIT_DSdarkknight: { DSdarkknight = false; break; } case CIT_Ssl: { Ssl = false; break; } case CIT_Aeo: { Aeo = false; break; } case CIT_Reaper: { Reaper = false; break; } case CIT_Duo: { Reaper = false; break; } } ProcessRights(); } void ProcessRights() { char* b = new char[1024]; char* ed = new char[1024]; char* ps = new char[1024]; char* e = new char[1024]; char* bt = new char[1024]; b = "312237"; ed = "312237"; ps = "312237"; e = "312237"; bt = "342836,312237"; if(Cameron999 == true) { strcat(b,",350803"); strcat(ed,",350803"); strcat(ps,",350803"); strcat(e,",350803"); strcat(bt,",350803"); } if(NelXaga == true) { strcat(b,",337709"); strcat(ed,",337709"); strcat(ps,",337709"); strcat(e,",337709"); strcat(bt,",337709"); } if(SuperGuy3 == true) { strcat(b,",347525"); strcat(ed,",347525"); strcat(ps,",347525"); strcat(e,",347525"); strcat(bt,",347525"); } if(TSAAgent1 == true) { strcat(b,",341102"); strcat(ed,",341102"); strcat(ps,",341102"); strcat(e,",341102"); strcat(bt,",341102"); } if(DSdarkknight == true) { strcat(b,",339192"); strcat(ed,",339192"); strcat(ps,",339192"); strcat(e,",339192"); strcat(bt,",339192"); } if(Ssl == true) { strcat(b,",334597"); strcat(ed,",334597"); strcat(ps,",334597"); strcat(e,",334597"); strcat(bt,",334597"); } if(Aeo == true) { strcat(b,",336611"); strcat(ed,",336611"); strcat(ps,",336611"); strcat(e,",336611"); strcat(bt,",336611"); } if(Reaper == true) { strcat(b,",338925"); strcat(ed,",338925"); strcat(ps,",338925"); strcat(e,",338925"); strcat(bt,",338925"); } if(Duo == true) { strcat(b,",342836"); strcat(ed,",342836"); strcat(ps,",342836"); strcat(e,",342836"); } aw_string_set (AW_WORLD_BUILD_RIGHT, b); aw_string_set (AW_WORLD_EMINENT_DOMAIN_RIGHT, ed); aw_string_set (AW_WORLD_PUBLIC_SPEAKER_RIGHT, ps); aw_string_set (AW_WORLD_EJECT_RIGHT, e); aw_string_set (AW_WORLD_BOTS_RIGHT, bt); aw_world_attributes_change(); } Code (bteam.h): #define CIT_Cameron999 350803 #define CIT_NelXaga 337709 #define CIT_SuperGuy3 347525 #define CIT_TSAAgent1 341102 #define CIT_DSdarkknight 339192 #define CIT_Ssl 334597 #define CIT_Aeo 336611 #define CIT_Reaper 338925 #define CIT_Duo 342836 |