• Welcome to Valhalla Legends Archive.
 

adding winamp to bot

Started by LizArD, July 11, 2004, 03:15 AM

Previous topic - Next topic

Lobo

since your using a function you need to declare it, as which data type that fits your needs, of course the way it looks you might just want to do


Public sub command(byval text As String)
'winamp code here
End Sub
Look it's a signature.

LizArD

Public Sub command(ByVal text As String)
Dim commandstr() As String
commandstr = Split(text, " ", 2)
   Select Case (LCase(commandstr(0)))
       Case "vol"
           ret = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
       Case "volume"
           ret = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
       Case "next"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0)
       Case "play"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
       Case "stop"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0)
       Case "pause"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0)
       Case "back"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0)
       Case Else
   End Select
End Sub


this is my code now, it continues to tell me "Ambiguous name detected: command"

Public Sub command(ByVal text As String)

LizArD

#17
btw does anyone know if im donig this right? for example

Case "next"
           ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0)


i should be using ret = "                "                       "               "                etc.. right??

Lobo

You might want to Change Command to WinAmpCommand
Look it's a signature.

LizArD

the bot seemed to compile soon, however when i tested on bnet didn't actually play the songs or change what could possibly be wrong?

Lobo

#20
On the SendMessages Call's insted of doing

ret = SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)


try:

Call SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0)
Look it's a signature.

LizArD

Public Sub WinAmpcommand(ByVal text As String)
   Dim commandstr() As String
   commandstr = Split(text, " ")
   Select Case (LCase(commandstr(0)))
       Case "vol", "volume"
           If UBound(commandstr) > 0 Then
               If IsNumeric(commandstr(1)) = True Then
                   SendMessage hwnd_winamp, WM_WA_IPC, commandstr(1), IPC_SETVOLUME
               End If
           End If
       Case "next"
           SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON5, 0
           Send "Winamp: Skipped forwards."
       Case "play"
           SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0
           Send "Winamp: Play started."
       Case "stop"
           SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON4, 0
           Send "Winamp: Play stopped."
       Case "pause"
           SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON3, 0
           Send "Winamp: Play paused."
       Case "back"
           SendMessage hwnd_winamp, WM_COMMAND, WINAMP_BUTTON1, 0
           Send "Winamp: Skipped backwards."
   End Select
End Sub


This is what i have, everything compiles good, just.. doesn't work on bnet. Any susgestions?

Adron

Quote from: LizArD on July 18, 2004, 12:49 AM
This is what i have, everything compiles good, just.. doesn't work on bnet. Any susgestions?

You get the messages displayed, so you know the code executes? Set a breakpoint and verify that hwnd_winamp is ok. Also check for errors from sendmessage (return value + lastdllerror or something like that in VB).

Post your current definition of SendMessage too, maybe something's wrong with that.

LizArD

#23
When I try to use .play on the bot, along with all of the other commands, it never sends text to battlenet. (my key is not muted I have checked) winamp never starts playing. My friend told me to do that checkpoint thing, i know how to set them just how do I check?


what do you mean by definition of sendmessage? i thought everything was in the code i gave =\

Adron

There should be a Declare Function SendMessage somewhere at the top of your program.

If you don't see the 'Send "Winamp: Play started." ', then the problem could quite probably be outside this code.

Set a breakpoint by moving the cursor to the line you want it on and hitting F9.


Start by setting a breakpoint on 'commandstr = Split(text, " ")'. Run the program, do .play, see if the breakpoint triggers. If it does, hit F8 to execute one line at a time and see where it goes.

If it goes out of the sub instead of down to the 'Case "play" ', hit F5 and do .play again. This time, point your mouse at 'text' and see what's in there. If that looks ok, execute a few lines down and check commandstr(0).

LizArD

#25
Quote from: Adron on July 18, 2004, 04:38 AM
There should be a Declare Function SendMessage somewhere at the top of your program.

I dont see it at the top of my source on that page, possibly located somewhere else? i'll do the checkpoint thing now ;]

I checked the 'checkpoint' and it never trigger when i accessed the command.

DarkLord

i Just finished adding some winamp commands to my bot(loadwinamp, play, stop, next, back, mp3)
if you want i can go dig it up for you(if you havent already figered it out that is)
PM me if you want it

Eli_1

Quote from: DarkLord on July 18, 2004, 08:09 AM
i Just finished adding some winamp commands to my bot(loadwinamp, play, stop, next, back, mp3)
if you want i can go dig it up for you(if you havent already figered it out that is)
PM me if you want it

The whole reason we're all doing all this is because we want him to actually do it on his own. Don't just hand people code. He's doing fine, let him figure it out.

LizArD

Quote from: Adron on July 18, 2004, 04:38 AM
There should be a Declare Function SendMessage somewhere at the top of your program.

I ran the checkpoints and they never lit up or anything, how should I declare the function SendMessage

Adron

Quote from: LizArD on July 18, 2004, 02:45 PM
I ran the checkpoints and they never lit up or anything, how should I declare the function SendMessage

Don't worry about it until the breakpoints trigger. Find out where you're calling your WinAmpcommand function from and set some breakpoints around there, or post the code for that function.

|