• Welcome to Valhalla Legends Archive.
 

Uh.... WTF

Started by brew, June 26, 2007, 09:07 PM

Previous topic - Next topic

brew

So i'm working on my bot and all of a sudden a function that worked absolutely FINE a few minutes ago is screwing up:
Quote
Public Function ScanUsers(User As String, strArray() As String) As Long
    Dim i As Long
    For i = 0 To UBound(strArray)
        If User = Left$(strArray(i), InStr(strArray(i), " ") - 1) Then
            ScanUsers = i
            AddChat vbWhite, "yay"
            GoTo Done
        End If
    Next i
    ScanUsers = -1
Done:
MsgBox "im here"
End Function
Uh... it enters the if statement, then addchats, but the value of i isn't set to ScanUsers. Then it goes to Done, messageboxes Im here, then (i set a breakpoint on Scanusers = -1) executes ScanUsers = -1, then goes back to Im Done. .....god help me.....
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

Quote from: brew on June 26, 2007, 09:07 PM
So i'm working on my bot and all of a sudden a function that worked absolutely FINE a few minutes ago is screwing up:
Quote
Public Function ScanUsers(User As String, strArray() As String) As Long
    Dim i As Long
    For i = 0 To UBound(strArray)
        If User = Left$(strArray(i), InStr(strArray(i), " ") - 1) Then
            ScanUsers = i
            AddChat vbWhite, "yay"
            GoTo Done
        End If
    Next i
    ScanUsers = -1
Done:
MsgBox "im here"
End Function
Uh... it enters the if statement, then addchats, but the value of i isn't set to ScanUsers. Then it goes to Done, messageboxes Im here, then (i set a breakpoint on Scanusers = -1) executes ScanUsers = -1, then goes back to Im Done. .....god help me.....

Try to avoid using GoTo at any cost possible.


Public Function ScanUsers(User As String, strArray() As String) As Long
    Dim i As Long
    ScanUsers = -1
    For i = 0 To UBound(strArray)
        If User = Left$(strArray(i), InStr(strArray(i), " ") - 1) Then
            ScanUsers = i
            AddChat vbWhite, "yay"
            Exit For
        End If
    Next i
End Function
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

I originally just had Exit function where i had goto, but i changed to demonstrate how (il) logical the vb6 compiler was. Executing a line, then going back up one, executing that one, then going back to the bottom one is perfectly logical. right? /me sighs
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

well it's simply a bug in the compilation of the asm, places a bad jmp or doesn't place one.. either way i just tested it with the latest service pack for vs6 and it worked ok, make sure you are using it.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

MyndFyre

Quote from: brew on June 26, 2007, 09:17 PM
I originally just had Exit function where i had goto, but i changed to demonstrate how (il) logical the vb6 compiler was. Executing a line, then going back up one, executing that one, then going back to the bottom one is perfectly logical. right? /me sighs
Incidentally this may be due to the fact that modern processors are able to execute instrutions so fast that they can actually execute some instructions in parallel.  It doesn't matter if ScanUsers is set to -1 when the message box that says "im here" is displayed, and so they can be executed out of order.  This is done as an optimization sometimes.  Maybe you should examine disassembly of this function.
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.