• Welcome to Valhalla Legends Archive.
 

Another moderation bot...

Started by GSX, May 15, 2006, 07:12 PM

Previous topic - Next topic

Eric

Quote from: HeRo on May 16, 2006, 08:41 PM
Quote from: Networks on May 16, 2006, 07:28 PM
Quote from: HeRo on May 16, 2006, 01:13 AM
Doesn't a collection take up more memory?

If your computer can't handle a couple mb's of memory, sell it.
I never said it couldn't, I was just wondering if it did, and as rabbit confirmed, it does, good day sir :).

The difference would be nominal and even moreso if you were to factor in the ease of management that a collection would provide.

GSX

Woooo I'm back already...

This question is about loading profiles, I got them going ok...

But here's the issue I'm faced with, currently I'm loading all of them from 1 Configuration.ini.

The code looks like this:


Public Function GetProfileCount()
Dim x As Integer, xString As String, CheckFor As String

x = 1

Check:
xString = x

CheckFor = GetStuff(xString, "Username")

    If CheckFor = "#FINAL" Then
        ProfileCount = x
        Exit Function
    Else
        x = x + 1
        GoTo Check
    End If


End Function


So basically, I'm not sure how to have the program know how many profiles there are. This current method works all right, assuming the user is smart enough to know that when they alter Configuration.ini, they must change the last profile's number... And keep them in the correct order, as currently it would read them like this:


'Example of Configuration.ini
[0] 'Known as Bot(0), or master, not counted by this...
Username=UserA
Password=PassA
Server=ServerA
'Etc

[1] 'Bot(1)
Username=UserB
Password=PassB
Server=ServerB
'Etc

[2]
Username=UserC
Password=PassC
Server=ServerC
'Etc

[3]
Username=#FINAL 'Tells _ProfileCount_ function that there are 2 WORKING profiles...


Any suggestions on how to fix this/other methods of loading profile data from the .ini?

Eric

You can either:

1.) Include a section in your configuration file that would allow users to select which profiles (or how many profiles) they would like the bot to load.
2.) Scan for or attempt to load each profile.

rabbit

A beauty of ini files: order doesn't matter.  As long as all the fields are in the right section, everything should be just fine.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

GSX

Agh, I'm an idiot and I want to sleep, but I want to finish this one last thing before I drop dead...

I am used to using _Private Sub Socket_Connect()_ for my bot's outgoing connection, how do I do this with a winsock control array? Lol, I've even tried Socket(i)_Connect()... Like a complete idiot, that's how tired I am.

warz

Quote from: rabbit on May 16, 2006, 10:19 PM
A beauty of ini files: order doesn't matter.  As long as all the fields are in the right section, everything should be just fine.

Note that "order not mattering" is not a property of "ini" files. This all depends on how your file reading function handles the file data.

raylu

#21
OK, to split hairs, "order not mattering" is a great feature of the API that most people use to read INI files...

Quote from: GSXI am used to using _Private Sub Socket_Connect()_ for my bot's outgoing connection, how do I do this with a winsock control array? Lol, I've even tried Socket(i)_Connect()... Like a complete idiot, that's how tired I am.
Cut your code in the Socket_Connect() sub. Delete the sub. Double click on the socket object and choose Connect. Poof, Index as Integer!
Pie?

topaz

Socket(Index as Integer) is what you should have
RLY...?

FrOzeN

#23
Quote from: GSX on May 16, 2006, 10:29 PM
Agh, I'm an idiot and I want to sleep, but I want to finish this one last thing before I drop dead...

I am used to using _Private Sub Socket_Connect()_ for my bot's outgoing connection, how do I do this with a winsock control array? Lol, I've even tried Socket(i)_Connect()... Like a complete idiot, that's how tired I am.
Private Sub Socket_Connect(Index As Integer)
Also, to get all the sections of a .ini file. You'll need to go through open the file and process it to find them all.

This is how I did it just recently with a bot I'm working on:
Dim strLine As String, intConfig As Integer, strPath As String
If Right$(App.Path, 1) = Chr$(47) Then strPath = App.Path Else strPath = App.Path & Chr$(47)
intConfig = FreeFile
Open strPath & "Config.ini" For Input As intConfig
    While Not EOF(intConfig)
        Line Input #intConfig, strLine
        If Left$(strLine, 1) = Chr$(91) Then
            lstProfiles.AddItem Left$(Mid$(strLine, 2), Len(strLine) - 2)
        End If
    Wend
Close intConfig

That would add them all to a ListBox named "lstProfiles". :)
~ FrOzeN

rabbit

That's horrid.  Have a section for profile names.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Warrior

Oh my god.
And like I've said on other forums many times, the amount of memory it takes to use a collection is slightly bigger but it's outweighed by the functionality and organization you get.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

warz

configuration file handling is one of the more trivial aspects of a bot, in my opinion. grab the data bu whatever means, and store it. just avoid reading the config file more than needed.