Results 1 to 8 of 8

Thread: [VB6] Run time error '13' Type mismatch

  1. #1

    Joined
    Dec 2011
    Posts
    843
    Pronouns
    she/her
    Userbars
    3
    Thanks
    313
    Thanked
    346/213
    DL/UL
    34/2
    Mentioned
    179 times
    Time Online
    1d 19h 11m
    Avg. Time Online
    N/A

    [VB6] Run time error '13' Type mismatch

    Probably something stupid, but I'm tired and I want to get this shit done. So...


    Code:
    Private Sub Command1_Click()
        Dim strhtml As String
    
    
        a = 0
        If Text1 > 10 Then
            Log.AddItem "The Max. # of eggs"
            Log.AddItem " can select is 10."
        ElseIf Text3 > Label6 Then
            Log.AddItem "You cannot bet more than"
            Log.AddItem Label6 & "neopoints!"
        Else
            Log.AddItem "Started Gambling"
            c = 0
    
            endnp = 0
            endnp = (GetStringBetween(strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>"))
    
    
    
            Do Until c = Text
    
    
                '(my secret stuffs xD)
    
    
            Loop
            np = (GetStringBetween(strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>"))
            NPOH1 = np & " Neopoints On Hand"
    
            Log.AddItem "Total Profit: " & np - endnp & " Neopoints."  'I am being told that endnp has no value ""  But the green part should give it value
            Log.AddItem "Done Gambling"
        End If
    End Sub

    Help me, I'm about to fall asleep at the computer and have nightmares about the code. :/

    +REP

    PS: I just decided to remove everything in the loop for the sake of not being copied and I still have to add human-like qualities, plus it looks a bit sad. If you need to see it, PM me please.

  2. #2

    Joined
    Dec 2011
    Posts
    843
    Pronouns
    she/her
    Userbars
    3
    Thanks
    313
    Thanked
    346/213
    DL/UL
    34/2
    Mentioned
    179 times
    Time Online
    1d 19h 11m
    Avg. Time Online
    N/A
    @(you need an account to see links)

    now it highlights
    Code:
    endnp = CInt(GetStringBetween(strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>"))
    And when I put my cursor over endnp it just says "endnp = Empty"

    And btw, endnp is just the beginning number of neopoints (I know it says end but it was just a name) np is the ending number.

  3. #3

    Joined
    Dec 2011
    Posts
    843
    Pronouns
    she/her
    Userbars
    3
    Thanks
    313
    Thanked
    346/213
    DL/UL
    34/2
    Mentioned
    179 times
    Time Online
    1d 19h 11m
    Avg. Time Online
    N/A
    np and endnp are both strings... I probably should have mentioned that...

  4. #4
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,722
    Userbars
    166
    Thanks
    5,907
    Thanked
    33,078/6,609
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 5h 38m
    Avg. Time Online
    3h 13m
    Are you taking the commas out of the NP?

    endnp = replace(endnp, "," , "")

    before you do any number stuff with it
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


  5. The Following User Says Thank You to j03 For This Useful Post:

    Miguel (09-03-2012)

  6. #5

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    Use a long a ints max value is 327627 .

  7. #6

    Joined
    Dec 2011
    Posts
    77
    Userbars
    3
    Thanks
    3
    Thanked
    32/22
    DL/UL
    30/0
    Mentioned
    24 times
    Time Online
    18d 20h 37m
    Avg. Time Online
    6m
    Quote Originally Posted by raredaredevil View Post
    Use a long a ints max value is 327627 .
    is it not even smaller than that? i always thought it was around 32k.

  8. #7

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    It is i probly added a number lol had issues with it before when making a aber, would not buy anything over 32k

  9. #8
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by Hexx View Post
    is it not even smaller than that? i always thought it was around 32k.
    An Integer (in vb6) is 2 bytes, ranging from -32768 to 32767. Longs can go up to (2^31-1) which is slightly over 2.147 billion.


    Code:
    Private Sub Command1_Click()
        Dim strhtml As String
    
    
        a = 0
        If Text1 > 10 Then 'Specify you are comparing Text1.Text (also convert .Text to an integer)
            Log.AddItem "The Max. # of eggs"
            Log.AddItem " can select is 10."
        ElseIf Text3 > Label6 Then 'Specify you are comparing .Text and .Caption respectively. Convert both to integers
            Log.AddItem "You cannot bet more than"
            Log.AddItem Label6 & "neopoints!" '.Text
        Else
            Log.AddItem "Started Gambling"
            c = 0
    
     '       endnp = 0
            endnp = CInt(Replace(GetStringBetween(strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>"), ",", vbNullString)) 'assuming endnp is an integer
    
    
    
            Do Until c = Text 'Try using c >= Text 
    
    
                '(my secret stuffs xD)
    
    
            Loop
            np = CInt(Replace(GetStringBetween(strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>"), ",", vbNullString)) 'assuming np is an integer
            NPOH1 = np & " Neopoints On Hand" '.Caption
    
            Log.AddItem "Total Profit: " & (np - endnp) & " Neopoints."  
            Log.AddItem "Done Gambling"
        End If
    End Sub
    Read the comments I included.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •