• Welcome to Valhalla Legends Archive.
 

To Any Newbies Or Critics

Started by ChR0NiC, August 16, 2004, 02:29 PM

Previous topic - Next topic

Blaze

#30
Thats a pretty nice looking machine... Can I get the specs?
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

MindArchon

Add Profiles and it will make me happy :)

ChR0NiC

Quote from: MindArchon on August 22, 2004, 08:51 AM
Add Profiles and it will make me happy :)

Right, I totally spaced about profiles ha ha. It'll be done very soon, I'll post here when it's been updated.

Edit: I have just been informed that, the way CSB handles profile is a little too complex for newbs, so if anyone has any suggestions of a way I could present the profile keys to you and it be newby friendly, let me know.

tA-Kane

#33
.getProfile(Username As String, Game As Integer) gets the normal stuff (age, sex, location, description) for the username, plus the record for the game provided (or no record if game is zero), and Keys is an array of custom keys to use. No messing with any sort of keys to remember or anything.

and then use function overloading for the "more advanced" function:

.getProfile(Username As String, Keys() As String) gets the profile using the keys provided (dunno if VB allows passing arrays or not, but Keys is supposed to be an array).

Something like that.

On result, you use something like so:

Class Profile
 Username As String
 Values(-1) As String
 Keys(-1) As String
End Class


You fill Username with the username requested, keys with the array of keys used, and values with the returned values for the corresponding keys (so Values(1234) would be the value for Keys(1234))

etc etc

simple & easy enough


Be sure that using the first of the two will result in listing the keys in the result, so that the user can see what keys got what result, if they wanted to learn.

Also, be sure to provide documentation as to which array indice is what key for each game, so that if people don't want to check keys, but only check values, they will know what array indice to look at.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

ChR0NiC

Pending no objections, I think I got myself a way to do it, thanks Kane :)

shadypalm88

#35
A possible other way to do this would be using a Collection, with the profile field names as the keys.  Then you could just do:Dim C As Collection
Set C = Bot.GetProfile(Username)
txtAge = C("Age")
'etc ...
Also, you might want to have a function for getting account stats, e.g. account created.

[edit]Typo.[/edit]

tA-Kane

#36
Quote from: ChR0NiC on August 22, 2004, 04:48 PM
Pending no objections, I think I got myself a way to do it, thanks Kane :)
Have fun  ;)

Quote from: shadypalm88 on August 22, 2004, 04:52 PMAlso, you might want to have a function for getting account stats, e.g. account created.
Assuming he uses the way I presented, it would be quite simple using the "advanced" function rather than the generic function. That is, provide your own key ("System\Account Created"). Like so:

Sub GetAccountCreated(Username As String)
 Dim Key(0) As String
 Key(0) = "System\Account Created"
 WhateverYourObjectIsNamed.GetProfile(Username, Key)
End Sub
Then you simply wait for Battle.net to reply and then check the resulting data.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

shadypalm88

#37
Quote from: tA-Kane on August 22, 2004, 05:42 PMAssuming he uses the way I presented, it would be quite simple using the "advanced" function rather than the generic function.

Quote from: ChR0NiC on August 22, 2004, 02:34 PMI have just been informed that, the way CSB handles profile is a little too complex for newbs, so if anyone has any suggestions [...]
Just trying to make it simple.  ;)

R.a.B.B.i.T

I thought that you could only access the System\ keys for your own account?  It would be easier to use, say, GetAccountInfo() as opposed to requiring the user to find and then request the System keys.

ChR0NiC

Quote from: R.a.B.B.i.T on August 23, 2004, 12:36 AM
I thought that you could only access the System\ keys for your own account?  It would be easier to use, say, GetAccountInfo() as opposed to requiring the user to find and then request the System keys.

True, maybe I could just do .GetAccountInfo() being that you can only request your own keys. Good point rabbit.

MindArchon

I suggest that you allow .send to only work when your connected. Or else you get wrong protocol errors

MyndFyre

Quote from: ChR0NiC on August 22, 2004, 04:48 PM
Pending no objections, I think I got myself a way to do it, thanks Kane :)

Yes, user profiles were somewhat tough to implement in a way that was intuitive for a library.  I think I came up with something along these lines --

The ArmaBot.Bncs.UserProfile class has a bunch of different constant strings.  The strings are the profile keys "profile\age", etc.

Different constructors on the class set up the request differently.  Essentially a user creates an instance of UserProfile with a specified constructor, and then can add keys to request if so desired (but the keys should be the constant fields).  The user then passes the instance of the UserProfile class to the connection manager, which creates the appropriate packet to send.  The connection manager can support up to ten profile requests at one time, and when profile request responses are returned, the appropriate instance is taken from an internal collection (based on the cookie) and parsed.  Parsing is possible because the UserProfile instance maintains a list of the requested keys and the order in which they were requested, and since some keys return strings, while others return numeric data, the incoming data stream has the appropriate function called based on the current key.  The key collection is looped over.

The UserProfile class then acts like an associative array.  Say I have a user profile instance called "myProfile":

C#:

// the as <type> operator is COOL!
string szAge = myProfile[UserProfile.PROFILE_AGE_KEY] as string;

VB.NET:

Dim szAge As String
szAge = CType(myProfile[UserProfile.PROFILE_AGE_KEY], String)


Keys that were not requested but are known to be valid return an empty string.  Keys that are not valid cause an ArgumentOutOfRangeException to be thrown.

NOTE: This is all as I remember.  It's been a long time since I've worked on my profile code, and I don't have it in front of me.

That said, this is generally how I settled on doing things.  Don't know if you've finished up yet, but maybe it will help you out. :)
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.

ChR0NiC

I had to release a fix version, because there were a few reported bugs, for more details visit here

DarkSoldier

Ok, i've got a little problem with your login control: everytime i want to login, i get disconnected and banned from battle.net... i don't get an error only: bnls disconnected...
Maybe you know why i get this....and i thought with that control i can't do anything wrong >_>

this little problem happens if i try to connect with wc3, tft, d2, lod (never tried sc)
i use original keys (what else...) and the gameshortvuts are ok....key seems to be ok, too (i can connect to battle.net, but after i am connected to it i get diconnected).
my account already exists, pw is also right.

Soul Taker

Quote from: DarkSoldier on August 24, 2004, 04:29 AM
key seems to be ok, too (i can connect to battle.net, but after i am connected to it i get diconnected).
If you use an invalid key, you will connect, then be IP banned after sending said invalid key.

|