Valhalla Legends Forums Archive | Battle.net Bot Development | C++ help plz

AuthorMessageTime
WiLD
hi all,
im kinda new to c++ im only really good in vb. but i was looking at some source codes of bots (c++) and i did find some errors so i fixed them up but 1 i just cant get it to work here it is: at the top of wild.cpp i have #include <Connection.h> it was "Connection.h" but that caused errors so i just changed it to <Connection.h>. But when i click compile it says Connection.h cant be found. I no its a existing file because its in the same folder so what should i do?
and remember im new 2 c++ so kinda make it simple 2 read ;)

I justed edited this to show u wats in wild.cpp

[code]#include <Connection.h>
#include <conio.h>

void main()
{
   BinaryBot *Bot = new WiLD BinaryBot;
   strcpy(Bot->username, "Usernmae");
   strcpy(Bot->password, "Pssword");
   strcpy(Bot->cdkey, "CD-key");
   strcpy(Bot->statstring, "WiLD ChaT");
   strcpy(Bot->homechannel, "Clan VioLaToRz");
   if(Bot->Connect("211.233.0.73"))
   {
      Bot->Output->WriteEx(ConsoleOutput::YELLOW, "Connected To B.net!\n");
      Bot->Startup();
   }
   else
      Bot->Output->WriteEx(ConsoleOutput::RED, "Connection Failed!");
   delete Bot;
   getch();
}[/code]
March 31, 2003, 3:27 AM
Eibro
[quote author=WiLD link=board=17;threadid=853;start=0#msg6731 date=1049081233]
hi all,
im kinda new to c++ im only really good in vb. but i was looking at some source codes of bots (c++) and i did find some errors so i fixed them up but 1 i just cant get it to work here it is: at the top of wild.cpp i have #include <Connection.h> it was "Connection.h" but that caused errors so i just changed it to <Connection.h>. But when i click compile it says Connection.h cant be found. I no its a existing file because its in the same folder so what should i do?
and remember im new 2 c++ so kinda make it simple 2 read ;)

I justed edited this to show u wats in wild.cpp

[code]#include <Connection.h>
#include <conio.h>

void main()
{
BinaryBot *Bot = new WiLD BinaryBot;
strcpy(Bot->username, "Usernmae");
strcpy(Bot->password, "Pssword");
strcpy(Bot->cdkey, "CD-key");
strcpy(Bot->statstring, "WiLD ChaT");
strcpy(Bot->homechannel, "Clan VioLaToRz");
if(Bot->Connect("211.233.0.73"))
{
Bot->Output->WriteEx(ConsoleOutput::YELLOW, "Connected To B.net!\n");
Bot->Startup();
}
else
Bot->Output->WriteEx(ConsoleOutput::RED, "Connection Failed!");
delete Bot;
getch();
}[/code]
[/quote]First off, it's int main() not void main(). Second, You need to #include "Connection.h" not <Connection.h> Third you need to lose "WiLD" in BinaryBot *Bot = new WiLD BinaryBot;
March 31, 2003, 4:25 AM
WiLD
ok thank you, but now im getting a extra error.
i still got the same error as before but i also have this one on line 4.

Line | Unit
4 c:\wildbot\packetbuffer.h

| Message
from c:\wildbot\Connection.h:4,

so wats wrong now......
March 31, 2003, 4:45 AM
SiMi
hm maybe i should learn C++
March 31, 2003, 5:16 AM
Zakath
Perhaps you shouldn't rip off DarkMinion's work, also.

The source you're copying from isn't functional...and hasn't been for a long time. Moreover, it's very bad form to just insert your name in places like that.
March 31, 2003, 5:51 AM
WiLD
if u had havd read my first post i said it wasnt my source im learning. i wasnt going to relese it. i just want to learn c++. and i cant find ne GOOF decent tutorials on the net
March 31, 2003, 5:58 AM
Zakath
I'm afraid that looking at DM's source isn't gonna be very helpful for just starting out. He used a number of fairly advanced concepts in creating even that rather primitive vLBBot - classes, dynamic memory allocation, a custom string library...try to find a more conventional source of inspiration if you can - it'll be much easier to understand.
March 31, 2003, 7:11 AM
n00blar
I recommend this to you... and if you say its lame I will strangle you and cut off your nads and feed them raw to the dogs.. kthx

www.google.com -> search query = "Teach Yourself C++ in 21 Days"
March 31, 2003, 12:14 PM
Camel
[quote author=Eibro link=board=17;threadid=853;start=0#msg6733 date=1049084736]First off, it's int main() not void main().[/quote]
what's wrong with void main() ?
April 1, 2003, 3:22 AM
Skywing
[quote author=Camel link=board=17;threadid=853;start=0#msg6803 date=1049167377]
[quote author=Eibro link=board=17;threadid=853;start=0#msg6733 date=1049084736]First off, it's int main() not void main().[/quote]
what's wrong with void main() ?
[/quote]void main() doesn't exist in C or C++. It's a nonstandard compiler extension.
April 1, 2003, 3:52 AM
WiLD
well thx about all, and i will have a look at that c++ in 21 days. i also learnt several new things today =)
just 1 quick quetion that no 1 in me chanel would help me with is:
szName = the %s before hand right....
and wat does \n\r mean i no its a varible but of like wat does it do..

Thx alot.
April 1, 2003, 1:44 PM
MrRaza
you really need to buy a book and read it.

\n == New Line
\r == Return

there's alot mmore.
April 1, 2003, 2:51 PM
St0rm.iD
This is why people shouldn't start with VB.
April 2, 2003, 8:35 PM
WiLD
dont you mean SHOULD start with vb storm?

well thx raza.

because all the sources iv looked at i always see \n\r so that helps me alot. mmm FINAL LAST THING: do you have to put \n on every line? and \r means return but return to wat is it like return aka enter?
April 3, 2003, 12:38 AM
Starnaught
\n = new line
\r = carriage return

\n puts the cursor on the next line
\r returns the cursor to the leftmost position
April 3, 2003, 12:42 AM
WiLD
wow thank you again. every1 here is so helpful thank you all. now that i understand those 2 varibles clearly i will understand most bot sources abit more.
Thank you

WiLD
April 3, 2003, 12:48 AM
St0rm.iD
No typo in my post. VB lets you assume a lot of stuff you can't assume in other languages.
April 3, 2003, 2:18 AM
kamakazie
[quote author=St0rm.iD link=board=17;threadid=853;start=15#msg6908 date=1049336316]
No typo in my post. VB lets you assume a lot of stuff you can't assume in other languages.
[/quote]

I don't want to start a language war, but I'm wondering what that "stuff" is. Care to elaborate?
April 3, 2003, 4:30 AM
St0rm.iD
That memory is magically handled for you.
Also that it's ok to, say, assign a string to an int.
April 5, 2003, 3:56 AM
Yoni
It's not OK to assign a string to an int in VB, but the conversion is indeed much simpler than in, say, C.

Converting from VB to C = "wtf? You have to use a function to copy strings?"
April 5, 2003, 12:00 PM
St0rm.iD
"what's a function?"
April 6, 2003, 2:04 AM
Yoni
Naa, VB at least uses the keyword "Function". Maybe "what's a pointer"
April 6, 2003, 2:19 AM
St0rm.iD
I mean, it's not like VB programmers actually make their own functions anyway.
April 6, 2003, 2:35 AM
Yoni
If they didn't write their own functions, they wouldn't get very far (not much farther from Label1.Caption="l33tb4wt")
April 6, 2003, 12:56 PM
Camel
hey, it's entirely possible to use pointers in vb!
1) manipulating copymemory (not really manipulating -- that is actually the intended use for copymemory, but to a vb programmer it's manipulation ::))
2) VarPtr(), StrPtr(), and ObjPtr()

i mean, why bother doing "str1 = mid(str2, 2)" when you could do "str1 = space(len(str2) - 1) : copymemory str1, strptr(str2) + 1, len(str2) - 1" ?
April 7, 2003, 5:15 AM
Grok
That won't work.

Strings in VB are ... well I'll let you try it.
April 7, 2003, 9:04 AM
Etheran
Unicode.
April 7, 2003, 12:02 PM
Camel
of course it would work
it wouldnt *accomplish* anything, but it would work
April 7, 2003, 8:06 PM
c0ol
NO, again im with storm, VB is horrible for you. VB will get u thinking like a retarted monkey, then when u actaully try to code in a real language you will have no idea whats going on.
April 10, 2003, 5:04 AM
Camel
well of course you wouldn't want to learn about pointers in vb. that would just be recockulous. it can be confusing enough just learning it in a real language, so it would be 50million times harder in vb. my point was that it is _possible_ to manipulate data with pointers in vb. example:
[code] VerQueryValue lpbBuffer(0), "\", ffip, dwSize
CopyMemory ffi, ffip, Len(ffi)

version = 0
CopyMemory x, ByVal ffip + 16, 4: version = version Or ((x And &HFF) * (256 ^ 2)) 'LShift(x And &HFF, 8 * 2)
CopyMemory x, ByVal ffip + 18, 4: version = version Or ((x And &HFF) * (256 ^ 3)) 'LShift(x And &HFF, 8 * 3)
CopyMemory x, ByVal ffip + 20, 4: version = version Or (x And &HFF)
CopyMemory x, ByVal ffip + 22, 4: version = version Or ((x And &HFF) * (256 ^ 1)) 'LShift(x And &HFF, 8)[/code]

this doesn't write data to an address, it only reads data..but i think you'll get the point
April 10, 2003, 5:36 AM
St0rm.iD
Pointers are syntax though...
April 10, 2003, 7:31 PM

Search