• Welcome to Valhalla Legends Archive.
 

Help with a command...

Started by FaDeS, January 31, 2005, 06:32 PM

Previous topic - Next topic

FaDeS

Well, I am sort of new to VB, so I decided just to tamper someone else's source a bit to try and get my bearings. I am also in a clan, and want to optimize a Flawed Bot source (No I am not slapping in my bot's name in the Ver command, just adding some useful features.) One feature I wanted to add, but I can't seem to figure out is something like Guard`Bot's "Crisis Mode"...

For those of you who don't know what that is, it is a command that sets the bot to automatically clear it's que every 10 or so seconds. I thought this would be useful alongside the "Own" command, so you don't have to Scq after every one.

Anyways, I am afraid that the bot automatically clearing it's que after a number of seconds might also clear it of this command, causing it to have no effect, and acting the same as a basic Scq...

Also, I would like to know how I could change it so that the user could set the number of seconds between each Scq, so the command would go something like ".acq 1 10", which would mean Auto Clear Que, Activated, every 10 seconds...

Any suggestions other than, "Learn VB", "Use CSB newb", or "Stfu and leave the forums newb"...

Thanks!

MyndFyre

Quote from: FaDeS on January 31, 2005, 06:32 PM
Any suggestions other than, "Learn VB", "Use CSB newb", or "Stfu and leave the forums newb"...

"Queue" is spelled with two "ue"s, and is pronounced like the letter Q.  "Que" is a Spanish preposition meaning "what" or "that," as well as the occasional "who(m);" it is pronounced like the letter K, but much more tersely.

If you add a variable to wherever the timer is (given that I don't know anything about this source code that you acquired) and check to see if its value indicates that you're using the special clear-queue command rather than the standard clear-queue command, and then make it not behave like the standard command if that is the case, you'll be okay.  (This is when actually understanding programming -- not just the language -- and being able to think prevents you from having to say, "ohhhh, that was a really easy solution to a really simple question.")

Perhaps the "special value" the I indicated can be just an integer, and you can specify that the timer you use to repeatedly clear the queue would have its interval set by the number of seconds specified in the special value.  If the "special value" is 0, then you know auto-clear-queue is off.

I have worked hard to ensure that my response has fallen within the parameters that you set.  I hope it was helpful.
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.

FaDeS

That helped, in an angry, newb hating, rather intimidating way... Thank you for showing me the way of the programmer, which is pretty useless to me, being a 'programmer in training', as it were... But other than that, I sort of understand... And aside from giving me the source (which I don't want), is there any way to slightly clarify this to a, oh say, "Creating This Command for Dummies" extent...? Thanks!

MyndFyre

#3
Quote from: FaDeS on January 31, 2005, 06:49 PM
That helped, in an angry, newb hating, rather intimidating way... Thank you for showing me the way of the programmer, which is pretty useless to me, being a 'programmer in training', as it were... But other than that, I sort of understand... And aside from giving me the source (which I don't want), is there any way to slightly clarify this to a, oh say, "Creating This Command for Dummies" extent...? Thanks!

But see....  If you learn the "way of the programmer," as you so called it, now, then when you want to move on to more advanced things, it won't be so difficult to train you then.  :P  So you shouldn't look at it as "useless."

Unfortunately, because I'm not familiar (and I would bet that most others here are also unfamiliar) with the structure of the program to which you're referring, I can't specifically come up with a way to add a new command to it.  Generally --

1.) You need to know when the command is coming in.  There's probably a command parser, which is probably characterized by a Select Case and then a lot of Case "somecommand"...End Case statements.
2.) You need a timer object.
3.) You need to tell the timer object to check a variable.
4.) If the variable meets a certain condition (say, it's not 0), you make it clear its queue.

Since you're adamant about not wanting code, I can't give you sample code.  That's a rather high-level type of pseudocode, though, and it should give you some hints about what to look for.

My ultimate recommendation is: don't be lazy.  I have a friend who's familiar with VB6 and trying to learn VB.NET.  I keep telling him, "You need to learn object-oriented programming to work in VB.NET."  He just finished something and was happy, until he realized he needed to do the same thing twice (just slightly different), but the way he had structured his application prevented him from doing it.  Learn how to program first.  Learn the "programmer's way," so-to-speak.  It will continue to frustrate you, and frustrate the rest of us.  Unfortunately, this is equivalent to the "stfu newb and leave the forums" that you had asked not to hear, but it's the truth, and it's the most helpful suggest I can offer at this point.  *shrug*
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.

FaDeS

#4
As I sit here, reading your posts with that dumb look that people get when you are speaking  different language to them, I find myself asking for a sample code... I didn't want to, but I figure things out better when I have something to look at... And if you really want to preview the code I am looking at, it is located at Pianka.net, or Bnetweb.net... 

Oh yeah, I have given up on the custom delay venture on this command, I just want it to repeat the *Queue* Clear command until  ".acq 0" is sent, canceling the command... (I presume you like the correct spelling MyndFyre... Que?)

shout

It seems to me like your not really trying. The "code" i gave you is not anything, it is just a more visual way of explaining what I said. I don't know what you are trying to acomplish by replying to all the posts like that, but if you want help, don't do that.

MyndFyre

hehe.  Well unfortunately I don't have VB6 so I can't give you specifics about how a Timer object works.  You'll need to add one to Form1, I believe, and I'm sure one is already there.  It'll be easiest to make one for this by itself.

This is the code he used to process the "cq" command.  It's in module3.bas (I opened it in Notepad and did a search ;))

'### ClearQueue
If ChkStr = Trigg & "cq" Then
UA (Username)
If UserP >= 50 Then Form1.lstAutoUnIp.Clear: ClearQue: Form1.txtQT.Text = "": Form1.AQ "†±ownend±†": Form1.AQ "Queue is cleared": RunData
End If '### ClearQueue

I'm not sure what ALL of that does, but:

If ChkStr = Trigg & "cq" then

This checks to make sure the command being checked is the trigger plus the "cq" command.  Thus if the trigger is ".", and the user sends ".cq", this If statement will evaluate as true.  Then the code block below it will execute.
I assume UA(username) is some kind of User Authorization check.
Then you have:

Then Form1.lstAutoUnIp.Clear

It looks like right there is the command that clears the list.

So perhaps in all of this, you could do something like...

'inside Module3.bas perhaps?
' this is that "special value"
Private Dim numAutoClearValue as Integer

Sub tmrAutoCQ_Tick
' this is added when you add that timer.
 
 If (numAutoClearValue <> 0) Then
   Form1.lstAutoUnIp.Clear
 End If
End Sub


Then you can add the .acq command somewhere in the command parser code in module3.bas.... perhaps next to the .cq command?  There has been extensive discussion about adding commands like this -- do a forum search.

Flawed bot's source sucks.  And I noticed that Fleet ALSO spells "queue" correctly about 50% of the time.  But yeah....  I prefer the correct spelling because I speak Spanish and seeing "que" throws me off.
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.

FaDeS

MyndFyre... Thank you! I understood that to an extent where I may be able to make this all pull together... And as I noticed, Flawed Bot is pretty messy... Do you have any suggestions as to what bot source I could look into to sort of get all the concepts implemented in a Battle.net Chat Client? That would probably help me a bit better than Fleet-'s source, because it is sort of sketchy in areas...

MyndFyre

Unfortunately I do not at this time.  You might check out JavaOp, which is open-source and highly customizable.  It's in Java, though.
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.

Mephisto

Quote from: MyndFyre on January 31, 2005, 07:00 PM
Quote from: FaDeS on January 31, 2005, 06:49 PM
That helped, in an angry, newb hating, rather intimidating way... Thank you for showing me the way of the programmer, which is pretty useless to me, being a 'programmer in training', as it were... But other than that, I sort of understand... And aside from giving me the source (which I don't want), is there any way to slightly clarify this to a, oh say, "Creating This Command for Dummies" extent...? Thanks!

But see....  If you learn the "way of the programmer," as you so called it, now, then when you want to move on to more advanced things, it won't be so difficult to train you then.  :P  So you shouldn't look at it as "useless."

Unfortunately, because I'm not familiar (and I would bet that most others here are also unfamiliar) with the structure of the program to which you're referring, I can't specifically come up with a way to add a new command to it.  Generally --

1.) You need to know when the command is coming in.  There's probably a command parser, which is probably characterized by a Select Case and then a lot of Case "somecommand"...End Case statements.
2.) You need a timer object.
3.) You need to tell the timer object to check a variable.
4.) If the variable meets a certain condition (say, it's not 0), you make it clear its queue.

Since you're adamant about not wanting code, I can't give you sample code.  That's a rather high-level type of pseudocode, though, and it should give you some hints about what to look for.

My ultimate recommendation is: don't be lazy.  I have a friend who's familiar with VB6 and trying to learn VB.NET.  I keep telling him, "You need to learn object-oriented programming to work in VB.NET."  He just finished something and was happy, until he realized he needed to do the same thing twice (just slightly different), but the way he had structured his application prevented him from doing it.  Learn how to program first.  Learn the "programmer's way," so-to-speak.  It will continue to frustrate you, and frustrate the rest of us.  Unfortunately, this is equivalent to the "stfu newb and leave the forums" that you had asked not to hear, but it's the truth, and it's the most helpful suggest I can offer at this point.  *shrug*

que = that
qu`e = what
qui`en = who

FaDeS

Hmm... Your code sample throws me off a bit... With the line:
Sub tmrAutoCQ_Tick()
The whole Module3 is just one giant Sub, that particular line throws off the whole rest of the original Sub, causing numerous errors... I understand what this does, but I think I may not have understood it's placement... If I understand this a little, which I forwarn you, I most likely don't,  I would create an 'If' statement for my "acq" command... Then work in the code, but then I don't know, here is my source.

'### Auto Clear Queue
If ChkStr = Trigg & "acq " Then
UA (Username)
  If vFlagB > 0 And UserP >= 200 Then
    Message = Mid(Message, 8, 1): If Message <> "1" And Message <> "0" Then Exit Sub
  If Message = 0 Then Form1.AQ "Auto Clear Que - Disabled"
    End If
    If Message = 1 Or 2 Or 3 Or 4 Or 5 Or 6 Or 7 Or 8 Or 9 Or 10 Or 11 Or 12 Or 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Then Form1.lstAutoUnIp.Clear: ClearQue: Form1.AQ "†±ownend±†"
                   Form1.AQ "Auto Clear Que - Enabled": RunData
   
   
    'no idea what to do with this code... =/
    Sub tmrAutoCQ_Tick()

    If (numAutoClearValue <> 0) Then
        Form1.lstAutoUnIp.Clear
     End If
End If '### Auto Clear Queue


Basically, what I *think* this code is doing, is when a use types ".acq number_0-20",  it will check the integer, and set it as the number of seconds between Queue clearings, and if it is 0, will not function... I know I don't understand this well, but is this correct? And if there are errors please alert me because this could take me a long time to fix without actual programmer input =X.

MyndFyre

Quote from: Mephisto on January 31, 2005, 08:20 PM
que = that
qu`e = what
qui`en = who

Uh, no.
Correct English grammar dictates (by the way, split these two posts and put them somewhere like the Trash can), that you should use the pronoun "who" when referring to a personal object.  For example:
I don't know who won the Nobel Prize.
Spanish: No sé que ganó el premio Nobel.
Note the use of the personal "que".  You don't use "quien."  I argued with my professor about it last semester.  I lost.
You also use "que" (without the accent) to indicate "what" in conjuctive statements, for example:
I don't know what you're talking about.
Spanish: No sé de que hablas (or de que estás hablando).

Qué and quién (with accents) are used in questions about the pronoun (¿Quién habla el español?  ¿Qué quieres?) only; the accent doesn't indicate a different meaning, just a different context.
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.

FaDeS

Heh, I know you two are the experts around here, but can you please help me with my issue THEN debate the Spanish language. Thanks, and my source is posted up there to anyone who only reads the last posts... Which is pretty much nobody.

shout

I think you should look at the JavaOps code. It is not really that hard to figure out what it is doing, and it is well commented and nicely orginaized.

Btw, try putting a breakpoint in and following the values. Then you can see excactly what your code is doing.

Off topic: What does the '<>' do in vB?

FaDeS

Basically, it means not... (In this sense, it means anything but.)