• Welcome to Valhalla Legends Archive.
 

Newbie, Variable question.

Started by LordVader, August 17, 2004, 07:02 PM

Previous topic - Next topic

LordVader

basically in short:
In C/C++
info: 'c9' is expected and other similar info but i want to pass the data in variable -> zsVerByte instead.
that one problem is hanging me up all over unable to make needed switches for client case matches etc.. alot of different needed things heh.
example:
dBuf.add((int)'c9');

Am new to C++
In: globals.h
Would like to define:
#define GAME_VERBYTE zsVerByte
char zsVerByte[32];
And be able to reuse that properly but unsure of how to parse that elsewhere, to use in ifstatments and switches.. would appreciate any small examples just to see diff ways to accomplish this..

*Note zsVerByte ready to store/redefine the verbyte which comes from the config (storing the data to zsVerByte isn't the issue, using it is)


Thx - Vad

MyndFyre

Allright, I'm going to go off on a limb (and granted, I'm sleep-deprived so my English may be a bit off at the moment), but I'm going to suggest that you write in complete sentences and make understandable statements if you want to get help.  I really, honestly, have absolutely no idea what you're asking or what you're trying to do.

Example:

"info: 'c9' as an int is expected and other similar info"

What does that mean, exactly?

Also, the typical Hungarian notation for naming strings is prefacing them with "sz", not "zs."  That's a cosmetic note, but one perhaps worth pointing out to you.  ;)

Also, a version byte is transferred from the BNCS via a DWORD, which is a 32-bit (4-byte) value.  It is defined somewhere as:


typedef unsigned long int DWORD;


Another good point, then, would be to ask why you're allocating 8 times the amount of memory necessary (32 bytes as opposed to 4 bytes) to store the version byte, *unless* you're not trying to store the version byte itself.  If you're trying to convert to a string, I believe the itoa(int, char *, int) function is for you.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

LordVader

#2
Updated original post, and also i'm new to C++ and win32api programming in general. I'm familiar with php/perl/java in web applications.
As for the rest i'm trying to learn so any critique and information is usable and good..

I'm trying to update an old bot from old source to current verbyte and x50/x51 login and replacing the "static" values of star/c9 thru out the code with variables.. basically to learn the source compiles with static values and works fine.

Trying pass the data in different places and to add switches/case matches for say: GAME_VERBYTE (which would be the data from zsVerByte). Where it used to only have static raw text for the values..

I'm learning and reading as much as i can to get my head wrapped around it all.

LordVader

thx for the link btw and quick responce  :P

LordVader

#4
for a direct example..
this put buffer string:
dBuf.add((int)'c9');

how would i convert that to use the data in variable -> zsVerByte
which is char zsVerByte[32]; and contains the data c9

*I'll modify my variable[32] to a more appropriate size, either [4] or [2]

LordVader

That page answered my ?'s was basically needing to compare two strings see if they were the same :)

This page also is a good resource same site:
http://www.cplusplus.com/doc/tutorial/tut3-2.html