• Welcome to Valhalla Legends Archive.
 

Whats wrong with this....?

Started by OuTLawZGoSu, January 09, 2004, 05:49 PM

Previous topic - Next topic

OuTLawZGoSu


'Volume Set
'
If username = LoadMaster Then
If Left((LCase(message)), 7) = (LoadTrigger & "setvol") Then
WindowTitle = GetWindowTitle("Winamp v1.x")
If WindowTitle = "" Then
CmdQueue " ::.. Winamp not Loaded"
Else
WinAMP_SetVolume (Mid(message, 7, Len(message) - 1))
CmdQueue " ..:: Volume set to: [ "
End If
End If
End If


When I type " .setvol 20 " ( or wat ever number) the command doese'nt even respond. I got this to work with a Inputbox, but can't get it as a remote command.

Help?

Adron

Add some debug output or set some breakpoints. Do you ever get to those lines? What's LoadMaster set to? That kind of things...

OuTLawZGoSu

Quote from: Adron on January 09, 2004, 06:07 PM
Add some debug output or set some breakpoints. Do you ever get to those lines? What's LoadMaster set to? That kind of things...

- Not sure what you mean by debug output, breakpoints.
- What you mean by, "Do you ever get to those lines?"
- Loadmaster = Getstuff("Config","Master")

UserLoser.

Quote from: OuTLawZGoSu on January 10, 2004, 06:47 PM
Quote from: Adron on January 09, 2004, 06:07 PM
Add some debug output or set some breakpoints. Do you ever get to those lines? What's LoadMaster set to? That kind of things...

- Not sure what you mean by debug output, breakpoints.
- What you mean by, "Do you ever get to those lines?"
- Loadmaster = Getstuff("Config","Master")

Getstuff()?

Crypticflare

I believe thats a similar function to Ickis's read/write INI procedure.

OuTLawZGoSu

GetStuff gets specific text from a INI file.


OuTLawZGoSu

Fixed  ;D


'Volume Set
'
If username = wLoadMaster Then
If Left((LCase(message)), 7) = (wLoadTrigger & "setvol") Then
WindowTitle = GetWindowTitle("Winamp v1.x")
If WindowTitle = "" Then
CmdQueue " ::.. Winamp not Loaded"
Else
WinAMP_SetVolume ((Mid(message, 8, Len(message) - 2)))
CmdQueue  " ..:: Volume set to: [" & (Mid(message, 8, Len(message) - 2)) & " ] "
End If
End If
End If


Looks sloppy :/

Adron

Quote from: OuTLawZGoSu on January 10, 2004, 06:47 PM

- Not sure what you mean by debug output, breakpoints.
- What you mean by, "Do you ever get to those lines?"
- Loadmaster = Getstuff("Config","Master")

I meant something like this:


'Volume Set
'
Debug.Print "username: """ & username & """, LoadMaster: """ & LoadMaster & """"
If username = LoadMaster Then
Debug.Print "message: """ & message & """, trigger: """ & LoadTrigger & "setvol"""
If Left((LCase(message)), 7) = (LoadTrigger & "setvol") Then
WindowTitle = GetWindowTitle("Winamp v1.x")
If WindowTitle = "" Then
CmdQueue " ::.. Winamp not Loaded"
Else
WinAMP_SetVolume (Mid(message, 7, Len(message) - 1))
CmdQueue " ..:: Volume set to: [ "
End If
End If
End If



Add to that some breakpoints so you can step through the code and check all values, and finding the problem should be a piece of cake.

Now, since you already found the problem, what was it? A case of using uninitialized, undeclared variables without Option Explicit, so you loaded the values into one set of variables and used another?

OuTLawZGoSu

The problem was this " WinAMP_SetVolume ((Mid(message, 8, Len(message) - 2))) "

I set the numbers wrong. Thats why when Type in , Setvol 20 , the bot read it as, "etvol 20" . Thats why the command wouldnt execute right.

And thx for the debug thing.

Mesiah / haiseM

for future info, when your in the vb6 ide, before you test your program or run it, you can click on the left hand side of the code, to create a red dot, which highlights that line of code in red, then when you execute the program, it will pause on that line of code, and you will be able to hover your mouse over variables, and do other tests to help you figure out what is actually happening, and what is going wrong. this is called setting a breakpoint and stepping through the code. quite useful..
]HighBrow Innovations
Coming soon...

AIM Online Status: 

Newby

Quote from: MesiaH on January 11, 2004, 02:26 PM
for future info, when your in the vb6 ide, before you test your program or run it, you can click on the left hand side of the code, to create a red dot, which highlights that line of code in red, then when you execute the program, it will pause on that line of code, and you will be able to hover your mouse over variables, and do other tests to help you figure out what is actually happening, and what is going wrong. this is called setting a breakpoint and stepping through the code. quite useful..

Hotkey: F9 :)
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

R.a.B.B.i.T

Quote from: OuTLawZGoSu on January 09, 2004, 05:49 PM

'Volume Set
'
If username = LoadMaster Then
If Left((LCase(message)), 7) = (LoadTrigger & "setvol") Then
WindowTitle = GetWindowTitle("Winamp v1.x")
If WindowTitle = "" Then
CmdQueue " ::.. Winamp not Loaded"
Else
WinAMP_SetVolume (Mid(message, 7, Len(message) - 1))
CmdQueue " ..:: Volume set to: [ "
End If
End If
End If


When I type " .setvol 20 " ( or wat ever number) the command doese'nt even respond. I got this to work with a Inputbox, but can't get it as a remote command.

Help?

You need to use 'If FindWinamp = 1 Then' for it to work.

ObsidianWolf

Quote from: OuTLawZGoSu on January 10, 2004, 08:39 PM
GetStuff gets specific text from a INI file.



GetStuff is a function which references to the GetPrivateProfileString API.  Ive seen in a dozen sources. It by far not the most efficent way of doing things.

DarkMinion

QuoteGetStuff is a function which references to the GetPrivateProfileString API.  Ive seen in a dozen sources. It by far not the most efficent way of doing things.

In other words, it gets specific text from an INI file.