HElp i am a noob C++

I

Icemaster

Help meeeee haha

I am a noob C++ and i have no idea how to do diablo 2 haks...
if u have like some sort of sample other hak or maybe even some tips at programming C++ at all plzzzz help (especially if u have a smaple dupe code or something)

:nooob
 

Jim07

Member!
Joined
Jul 14, 2003
Messages
260
Reaction score
0
Location
Michigan
Website
Visit site
Look in the bnet hacking sticky, starfish made a lot of cool things to help you there. Also try searching in google for c++ tutorials, if you are just looking for c++ in general. The bnet hacking sticky won't teach you c++.
 

BlackSunFilter

Member!
Joined
Sep 30, 2003
Messages
27
Reaction score
0
Location
Probly on USWest as we speak
Website
Visit site
How much of a C++ newbie are you? Do you know what this program does?

#include <iostream.h>

int main()
{
cout << "Hello World!\n";
return 0;
}

Or can I get a bit more complex and say something like this without losing you?

#include <iostream.h>
class Mammal
{
public:
Mammal():itsAge(1) { cout << "Mammal constructor...\n"; }
virtual ~Mammal { cout << "Mammal destructor...\n"; }
virtual void Speak() const { cout << "Mammal speak!\n"; }
protected:
int itsAge;
};

class Cat: public Mammal
{
public:
Cat() { cout << "Cat constructor...\n"; }
~Cat() { cout << "Cat destructor...\n"; }
void Speak()const { cout << "Meow!\n"; }
};

int main()
{
Mammal *pCat = new Cat;
pCat->Speak();
return 0;
}

Did I lose you? Use these to determine how much of a newbie you are, if you understand both then you are doing fine. I you understand the first one then I can help you comprehend more advanced things. If you have no clue what either one does then you need a book or something.

Good Luck! I will be glad to help you if I can!
 

sam_the_man

Premium Member
Joined
Oct 2, 2003
Messages
509
Reaction score
2
Location
Boston
wow u got me ... heh the first one = np (lol hello world)
but that second thing .. DANG! i gotta go read some boox lol
 
I

Icemaster

im a noob as in i know absolutely nothing about anything that remotely resembles something that might look like c++ hehe

I bought a C++ for dummies But I cant seem to get the program to work so im a huge noob, however im ok at BASIC if u know any good books or anything that would be great. I kinda knew the first one, I think it just pops up and says hello world, im not sure tho. Thx for helping too

ME = MAjor :nooob
 

Psycho*Killa

Member!
Joined
Jan 24, 2004
Messages
70
Reaction score
0
Location
Georgia
well im sure starfish & custom has made a really good tutorial for this just read the stickys and u can have all the help u need in the tutorials goto the stick that says" BnetHacking 1.10 Sticky - READ BEFORE ASKING! " or
" [NEW] The D2ModuleMaker & Tutorial Part III "
 
I

Icemaster

ok i might have to check that out thanks btw i was browsing around and is blizzard actually making a diablo 3? that would be cool.
 

Xerxxes

Member!
Joined
Nov 5, 2003
Messages
24
Reaction score
0
Website
Visit site
"#include <iostream.h>

int main()
{
cout << "Hello World!\n";
return 0;
}

Or can I get a bit more complex and say something like this without losing you?

#include <iostream.h>
class Mammal
{
public:
Mammal():itsAge(1) { cout << "Mammal constructor...\n"; }
virtual ~Mammal { cout << "Mammal destructor...\n"; }
virtual void Speak() const { cout << "Mammal speak!\n"; }
protected:
int itsAge;
};

class Cat: public Mammal
{
public:
Cat() { cout << "Cat constructor...\n"; }
~Cat() { cout << "Cat destructor...\n"; }
void Speak()const { cout << "Meow!\n"; }
};

int main()
{
Mammal *pCat = new Cat;
pCat->Speak();
return 0;
} "

I'd really like to get into c++, and learn how to do some useful things with in in Diablo 2, when I get home I will look over the other info in the hacking forum. I can see what each of these things say easily, the things I didn't really understand were in bold.

\n, Is this like a script for a channel? Trying to understand the #include thing... So I guess it goes to the thing after #include, and it says the text in /n?

I sorta get the rest... sorta.. Could you explain a little further, I'm intrigued. If not that is okay too. I'd just like to get started in my c++ quest.



Edit: Although it would be nice to think about, I doubt highly that they will be making a Diablo 3 anytime soon. Only because with WoW they probally don't want some of their buyers being taken away due to D3, but who knows.
 

BlackSunFilter

Member!
Joined
Sep 30, 2003
Messages
27
Reaction score
0
Location
Probly on USWest as we speak
Website
Visit site
Sure I'd be glad to explain further.

#include can be broken down a little:
# is simply a symble that a part of the compiler called the preprocessor looks for, these are simply evaluated BEFORE anything else in the program. The word include tells the preprocessor that what follows is file, find it and insert it here. So iostream.h is a file just like any other C++ file, but instead of you typeing it all in yourself it is premade and input there. Also the<> symbles tell the preprocessor to look for the file in all of the common places.

cout stands for Charecter Output the << are redirection arrows stating that "Hello World!\n"; is to be outputted to the screen.

\n is a simple command the just means, create a new line.

The { and } symbles are opening and closing braces, they show where a function begins and where it ends.

The ; symble is always put at the end of a statement to tell the compiler that the statement has ended. If that was missing then it would blend all the statements together and give you a big error.

}; is always put at the end of a class definition, note that a closing brace (}) is not always followed by a semicolen. ONLY when it is a class definition is a ; needed to follow the }.

int stands for integer, pretty simple really, just like in math. An interger is a little different in C++ though. It is a type of value that ranges from -32,768 to 32,767 if it is 16-bit, it ranges from -2,147,483,648 to 2,147,483,647 if it is 32-bit. Dont worry though, you dont need to memorize these numbers lol.

I will list 2 good resources if you want to learn more about C++:
SAMS Teach Yourself C++ 2nd Edition is a good book on the subject.
http://www.cprogramming.com/ is a good site on the subject.

Also I will be willing to help you in any way I can. Good Luck!
 

Xerxxes

Member!
Joined
Nov 5, 2003
Messages
24
Reaction score
0
Website
Visit site
If, in the 2nd part of the code, why can't you remove the {'s and make it all just one function. They are all in the same menu correct? I don't see how they would interfere.

With my limited amount of knowledge shouldn't there be a trig function or somthing that activates a certain thing? How does it get going after it opens iostream.h?

I'm sure a lot of these answers are answered in your link so sorry if I am repetitive, I'll go read now.
 

BlackSunFilter

Member!
Joined
Sep 30, 2003
Messages
27
Reaction score
0
Location
Probly on USWest as we speak
Website
Visit site
There is no need for a trigger after #include <iostream.h> because it is detected and executed before anything else. To the compiler it is as if the program does not even begin untill after this line.

The reason that you cannot remove the closing braces and make the entire thing one fuction is because class functions must remain seperate, this way they can be independantly accessed and thus can gain access to private functions. How many fuctions do you see in the second example?



There are 4: Mammal(), Speak(), Cat(), and main().
Do not cofuse the class Mammal with the fuction mammal, the fuction mammal is within the class mammal, Speak is also a fuction within the class mammal, Cat is a fuction of the class mammal but it is not within the class mammal. main accesses these fuctions and uses them as they are needed.
For refrence reasons here are the outputs of both programs:
Example 1:
Prints Hello World! to the screen, thats right it is the infamous Hello World program!
Example 2 prints the following to the screen:
Mammal constructor...
Cat Constructor...
Meow!
 

NewPosts

New threads

Top