Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Lordrune on June 13, 2005, 03:30 PM

Title: Commands
Post by: Lordrune on June 13, 2005, 03:30 PM
Yo i need help on how to Start command for my bot
Title: Re: Commands
Post by: MyndFyre on June 13, 2005, 05:06 PM
Congratulations!  You've just been awarded the "Most Vague Post of the Year" award!

[edit]warz: To clarify, at least my post *hinted* at what the guy needed to do to get help.[/edit]
Title: Re: Commands
Post by: Warrior on June 13, 2005, 06:15 PM
What language are you programming in?
What kind of help do you need?
Do you have any code that you need help with in specific?
Title: Re: Commands
Post by: CrAz3D on June 13, 2005, 08:21 PM
VB
helpful help
I haven't written it yet


(I figure those are the answers)
Title: Re: Commands
Post by: shout on June 13, 2005, 10:09 PM
(http://cold-chaos.net/stealth/google.gif)

What I think is going on is he wants a one-line segment of code that magically connects to battle.net.

By the way, who says 'yo' anymore?
Title: Re: Commands
Post by: Hdx on June 13, 2005, 10:12 PM
Quote from: Shout on June 13, 2005, 10:09 PM
What I think is going on is he wants a one-line segment of code that magically connects to battle.net.
ws.Connect "USEast.battle.net", 6112
ws.Send Chr(&H3) & chr(&H4) & "anonymous" & vbcrlf & vbcrlf

Wow... 2 lines?
~-~(HDX)~-~
Title: Re: Commands
Post by: Hdx on June 13, 2005, 10:21 PM
That dosent work, RTE: 400067, or w/e
Also thats 2 lines, : is a line delemanator.
Also the 2nd line needs ot be in the Connect sub, so tecnically, it's 6 lines of code.
~-~(HDX)~-~
Title: Re: Commands
Post by: MyndFyre on June 13, 2005, 10:34 PM
Quote from: HdxBmx27 on June 13, 2005, 10:21 PM
That dosent work, RTE: 400067, or w/e
Also thats 2 lines, : is a line delemanator.
Also the 2nd line needs ot be in the Connect sub, so tecnically, it's 6 lines of code.
~-~(HDX)~-~

It's actually a statement delimiter, so it's still just 1 line.
Title: Re: Commands
Post by: CrAz3D on June 14, 2005, 11:26 AM
Command isn't connection.  He is asking how to write a command.
Title: Re: Commands
Post by: shout on June 14, 2005, 11:59 AM
Oh, I misread. I read it as "i need a start command for my bot".
Title: Re: Commands
Post by: MyndFyre on June 14, 2005, 12:01 PM
I think that the original post is ambiguous and indecipherable enough to be either one.
Title: Re: Commands
Post by: Lordrune on June 14, 2005, 01:25 PM
Yuh i meant write a command
Title: Re: Commands
Post by: shout on June 14, 2005, 01:32 PM
That is still pretty vague.

Here is a psudocode example of accepting a command from a user on battle.net:

string command = p0x0E.text
string user = p0x0E.name

if (name == users[any])
if (userspriv[usernum] >= getcmdreq(command))
sendchat(getcmd(command))
Title: Re: Commands
Post by: Hdx on June 14, 2005, 01:59 PM
0x0F not 0x0E
Also Lordrune, You hgave to tell us what you want the dang cvommand to do. If your jsut thinking generics... upon reciving 0x0F with a event ID of either Whisper or emote. Casll a sub that check s if the text from 0x0F is a command (.say, .quit, .imagayfag, .blablabla). If so make the bot do the desirted effect of the command.
~-~(HDX)~-~
Title: Re: Commands
Post by: Warrior on June 14, 2005, 07:39 PM
...what? 0x0E is SID_CHATEVENT ..?

I really have no idea what you just said Hdx..
Title: Re: Commands
Post by: Hdx on June 14, 2005, 07:53 PM
Quote[C>0x0E]        SID_CHATCOMMAND
[S>0x0F]    SID_CHATEVENT
0x0E is C->S only, 0x0F is S->C only.

As for what I said this might be better:
Public Sub OMGOMGOMGPARSE0x0F(strData as string)
   Dim ID as long, UN as string, MSG as string
   ID = GetDWORD(Mid(strData, 5, 4))
   strData = Mid(strData, 25)
   UN = Left(strdata, Instr(StrData, Chr(&H0)) - 1)
   StrData = Mid(StrData, Len(UN) + 2)
   MSG = Left(strdata, Instr(StrData, Chr(&H0)) - 1)
   
   If ID = &H5 or ID = &H4 then
          Call OMGHandelCommands(UN, MSG)
   End If
End Sub

Public Sub OMGHandelCommands(UN as string, MSG as string)
    If Left(MSG, 5) = ".say " then AddQ UN & "says: " & Mid(MSG, 6)
End Sub


:/
Anyways... Like I said, when you recive a whisper of chat text. Call a seprate sub to handleel the diffrent commands.
~-~(HDX)~-~

Title: Re: Commands
Post by: MyndFyre on June 14, 2005, 07:54 PM
Quote from: HdxBmx27 on June 14, 2005, 07:53 PM
Public Sub OMGOMGOMGPARSE0x0F(strData as string)

WTF?
Title: Re: Commands
Post by: Hdx on June 14, 2005, 08:00 PM
Some random sub to Parse incoming 0x0F.

Sorta like mine:
Public Sub Handle0x0F(Index As Integer, EID As Long, Flags As String, Ping As Long, Void As String, _
                    Name As String, Message As String)
    Select Case EID
        Case ID_TALK: Call OnTalk(Index, Name, Flags, Message, Ping)
        Case ID_EMOTE: Call OnEmote(Index, Name, Flags, Message)
        Case ID_CHAN: Call OnChannel(Index, Message)
        Case ID_USER: Call OnUser(Index, Name, Flags, Message, Ping)
        Case ID_JOIN: Call OnJoin(Index, Name, Flags, Message, Ping)
        Case ID_LEAVE: Call OnLeave(Index, Name, Flags)
        Case ID_WHISPTO: Call OnWhisperTo(Index, Name, Flags, Message, Ping)
        Case ID_WHISPFROM: Call OnWhisperFrom(Index, Name, Flags, Message)
        Case ID_INFO: Call OnInfo(Index, Message)
        Case ID_FLAGS: Call OnFlags(Index, Name, Flags, Message, Ping)
        Case ID_BROADCAST: Call OnInfo(Index, Message)
        Case ID_ERROR: Call OnError(Index, Message)
        Case Else: Call OnUnknown(Index, Message)
    End Select
End Sub

...
~-~(HDX)~-~
Title: Re: Commands
Post by: Warrior on June 14, 2005, 08:29 PM
Haha, totally misread what you said. Must be having an off day.
Title: Re: Commands
Post by: Lordrune on June 14, 2005, 09:11 PM
Quote from: HdxBmx27 on June 13, 2005, 10:12 PM
Quote from: Shout on June 13, 2005, 10:09 PM
What I think is going on is he wants a one-line segment of code that magically connects to battle.net.
ws.Connect "USEast.battle.net", 6112
ws.Send Chr(&H3) & chr(&H4) & "anonymous" & vbcrlf & vbcrlf

Wow... 2 lines?
~-~(HDX)~-~
My bot already connnects to bnet..
Im trying to add commands to it
Title: Re: Commands
Post by: Hdx on June 14, 2005, 09:16 PM
*pokes the last few posts of his*
It's not hard, the hard part is figure out what commands to add. :/
~~(HDX)~-~
Title: Re: Commands
Post by: Kp on June 14, 2005, 09:38 PM
Lordrune is either a troll or supremely inept at communicating his intent.  Assuming you all haven't been feeding a troll for the past couple of days:

Lordrune: specify precisely what you want, or you're not going to get any help.
Title: Re: Commands
Post by: R.a.B.B.i.T on June 14, 2005, 09:38 PM
Quote from: Lordrune on June 14, 2005, 09:11 PM
Quote from: HdxBmx27 on June 13, 2005, 10:12 PM
Quote from: Shout on June 13, 2005, 10:09 PM
What I think is going on is he wants a one-line segment of code that magically connects to battle.net.
ws.Connect "USEast.battle.net", 6112
ws.Send Chr(&H3) & chr(&H4) & "anonymous" & vbcrlf & vbcrlf

Wow... 2 lines?
~-~(HDX)~-~
My bot already connnects to bnet..
Im trying to add commands to it
It connects but you can't write a simple command parser?  Tsk.  Tsk.  Sounds like someone isn't doing all the work they say they are...
Title: Re: Commands
Post by: Lordrune on June 14, 2005, 09:48 PM
Iight wuts wrong wit this code cause i keep gettin an error

Public Function StartCommands(Username As String, message As String)
Dim Stuff() As String
Stuff = Split(message, " ")
Command = Stuff(0)
Select Case LCase(Command)
Case ".say"
frmMain.wsBNET.SendData Stuff(2)
End Select
End Function

the error is Command = Stuff(0)
Title: Re: Commands
Post by: MyndFyre on June 14, 2005, 09:52 PM
If there is no message, and therefore no item at index 0 of your array, you'll generate an Index-out-of-Bounds error.

In the future, post the error message you receive and the conditions in which it is received.
Title: Re: Commands
Post by: Lordrune on June 14, 2005, 10:15 PM
ok..
Title: Re: Commands
Post by: Lordrune on June 14, 2005, 10:16 PM
well uh lets see here still doin the same shyt
Title: Re: Commands
Post by: Hdx on June 14, 2005, 11:04 PM

Stuff = Split(message & Space(&H1337), " ")

Should fix your peoblem.

If your next post dosent have more info, I willpersonally do anything to get a mod to trash this.

What we need: (so it's perfectly clear)
The contents of Each vareable, at EVERY stage. And a properly formatted snippit of code incased in the [ code] tags.
~-~(HDX)~-~
Title: Re: Commands
Post by: Blaze on June 14, 2005, 11:32 PM
He also didn't declare "Command".
Title: Re: Commands
Post by: MyndFyre on June 14, 2005, 11:42 PM
We also need an exact error message, conditions for reproducing the error, and when it occurs (compile-time or run-time).
Title: Re: Commands
Post by: Explicit on June 19, 2005, 08:32 PM
Quote from: Lordrune on June 14, 2005, 09:48 PM
Iight wuts wrong wit this code cause i keep gettin an error

Public Function StartCommands(Username As String, message As String)
Dim Stuff() As String
Stuff = Split(message, " ")
Command = Stuff(0)
Select Case LCase(Command)
Case ".say"
frmMain.wsBNET.SendData Stuff(2)
End Select
End Function

the error is Command = Stuff(0)

Use the <code> </code> tags.
Title: Re: Commands
Post by: Blaze on June 19, 2005, 08:36 PM
[ ]**