• Log in or sign up for an account here: https://www.sythe.org/login

Broken/buggy Vb6 Functions

Darthatron

Massive Troll

Retired Sectional Moderator
Visual Basic Programmers
Joined
May 22, 2006
Sythe Gold
0
Messages
1,612
Age
35
Location
The internet.
Browsing through the code bin on Cruels.Net, I came across some function that had some bugs, or didn't work. They were easy enough to fix, but for all you lazy people out there I thought I may as well post the fixed versions.

-----------------

Function: Cruel's MoveMouseCC Function.

Problem: It moves to 0, 0 before it starts the actual movement of the mouse.

How to fix: Simply starts the last "For" loop at 1, instead of 0.

Fixed Version:
Code:
Public Function MoveMouseCC(ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal range As Long, ByVal segments As Long, ByVal pcount As Long, ByVal delay As Long)
    If pcount < 3 Then pcount = 3
    Dim u As Double, nc1 As Double, nc2 As Double, nc3 As Double, nc4 As Double
    Dim dummyp As POINTAPI, p1() As POINTAPI, p2() As POINTAPI
    Dim r As RECT, i As Long
    ReDim p2(0)
    ReDim p1(pcount + 2)
    
    If segments < 15 Then segments = 50
    segments = segments + Rand(-12, 12)
    GetCursorPos dummyp
    GetWindowRect hWnd, r
    X = X + Rand(-range, range) + r.Left
    Y = Y + Rand(-range, range) + r.Top
    If (Abs(dummyp.X - X) + Abs(dummyp.Y - Y)) < 150 Then
        pcount = 3
        segments = 15
    End If
    
    For i = 0 To pcount + 2
        Select Case i
            Case Is < 2: p1(i) = dummyp
            Case Is >= pcount: p1(i).X = X: p1(i).Y = Y
            Case Else
                p1(i).X = Min(dummyp.X, X) + Rnd() * Abs(dummyp.X - X)
                p1(i).Y = Min(dummyp.Y, Y) + Rnd() * Abs(dummyp.Y - Y)
        End Select
    Next i
    For i = 1 To pcount
        For u = 0 To 1 Step (1 / segments)
            nc1 = -(u ^ 3) / 6 + (u * u) / 2 - u / 2 + 1 / 6
            nc2 = (u ^ 3) / 2 - (u * u) + 2 / 3
            nc3 = (-(u ^ 3) + u * u + u) / 2 + 1 / 6
            nc4 = (u ^ 3) / 6
            dummyp.X = nc1 * p1(i - 1).X + nc2 * p1(i).X + nc3 * p1(i + 1).X + nc4 * p1(i + 2).X
            dummyp.Y = nc1 * p1(i - 1).Y + nc2 * p1(i).Y + nc3 * p1(i + 1).Y + nc4 * p1(i + 2).Y
            ReDim Preserve p2(UBound(p2) + 1)
            p2(UBound(p2)) = dummyp
        Next u
    Next i
    For i = 1 To UBound(p2) - 1
        SetCursorPos p2(i).X, p2(i).Y
        Wait (delay)
    Next i
End Function

-----------------

Function: Stuart's 'Unbreakable' New Steal RS

Problem: It's broken. :D

How to fix: Change all the "app" text into "GameFrame". Also, sometimes you need to capitalize the W and H in "width" and "height".

Fixed Version:
Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    WebBrowser1.Document.body.innerHTML = WebBrowser1.Document.All.Item("GameFrame").outerHTML
    WebBrowser1.Width = Val(WebBrowser1.Document.All.Item("GameFrame").getAttribute("Width")) + 4
    WebBrowser1.Height = Val(WebBrowser1.Document.All.Item("GameFrame").getAttribute("Height")) + 4
End Sub

Those are the only 2 problems I've found thus far. If I find more I'll update this post.
 
Nice thanks waiting for more:P.
 
Runescape Gamblingrunescape gambling
Back
Top