Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Dayclone on April 07, 2003, 09:09 PM

Title: Need Help On Code
Post by: Dayclone on April 07, 2003, 09:09 PM
ok i'm trying to make it display a splash screen when i start a bot but i'm stummped at the part of the code which says Compile Error: Variable Not Defined.

->  Private Sub form_load()   (Highlighted yellow)
Dim y As String, c As String
On Error GoTo error
   Label1.ForeColor = &H8000000D
               y = Dir$(App.Path & "\config.ini")
           If y = "" Then
               Exit Sub
           End If
   c = ReadINI("Main", "ShowSplash", "config.ini")
   If c = "Y" Then
       Close #1
       Exit Sub
   Else
       Close #1
       frmChat.Show
       Unload Me
   End If
error:
   Close #1
End Sub

Someone help me thanks
Title: Re:Need Help On Code
Post by: Camel on April 07, 2003, 09:17 PM
well first of all, don't ever type out the function name for an event; use the drop down boxes at the top
Title: Re:Need Help On Code
Post by: Banana fanna fo fanna on April 08, 2003, 07:14 PM
Where did you steal that code from?

I didn't even read it, but I mean, I'm pretty sure you stole that from somewhere. And if you did and put it in your bot, it's likely it won't work because it requires a different module/form from the project.
Title: Re:Need Help On Code
Post by: PaiD on April 08, 2003, 07:46 PM

Private Sub form_load()
Dim y As String, c As String
On Error GoTo error
   Label1.ForeColor = &H8000000D
               y = Dir$(App.Path & "\config.ini")
           If y = "" Then
               Exit Sub
           End If
   c = ReadINI("Main", "ShowSplash", "config.ini")
   If c = "Y" Then
       Close #1
       Exit Sub
   Else
       Close #1
       frmChat.Show
       Unload Me
   End If
error:
   Close #1
End Sub
that is the
'StealthBot 11/5/02
'Source Code Version: 1.1.4
that stealth released
Title: Re:Need Help On Code
Post by: Banana fanna fo fanna on April 08, 2003, 07:51 PM
/me adds Dayclone to THE LIST.
Title: Re:Need Help On Code
Post by: Grok on April 09, 2003, 06:51 AM
Since nobody else mentioned it, that's really crappy VB code.  Just a little unconstructive criticism.  :)
Title: Re:Need Help On Code
Post by: Zakath on April 09, 2003, 10:39 AM
Just out of curiosity, does VB give horrendously ambiguous error messages or are people just not smart enough to interpret them?

i.e. MSVC will say something like "undeclared identifier 'blah'" if you have a variable that was never created. Does VB honestly say "Variable not defined" and then not tell you what variable it's talking about?!
Title: Re:Need Help On Code
Post by: tA-Kane on April 09, 2003, 11:15 AM
Quote from: Zakath on April 09, 2003, 10:39 AMDoes VB honestly say "Variable not defined" and then not tell you what variable it's talking about?!

Don't know about VB, but on RB 4.5, it does almost exactly that... "Undefined identifier", and then points to the erroneous line. Very confusing if you have 2 undefined identifiers on the same line, makes you think the fix you added didn't work!
Title: Re:Need Help On Code
Post by: Grok on April 09, 2003, 12:45 PM
Quote from: Zakath on April 09, 2003, 10:39 AM
Just out of curiosity, does VB give horrendously ambiguous error messages or are people just not smart enough to interpret them?

i.e. MSVC will say something like "undeclared identifier 'blah'" if you have a variable that was never created. Does VB honestly say "Variable not defined" and then not tell you what variable it's talking about?!

The error is "Variable Not Defined" and the variable is highlighted.  Not the whole line, just the variable you forgot to define.  Kinda hard to not figure that out.
Title: Re:Need Help On Code
Post by: Stealth on April 09, 2003, 05:49 PM
Quote from: Grok on April 09, 2003, 06:51 AM
Since nobody else mentioned it, that's really crappy VB code.  Just a little unconstructive criticism.  :)

Yeah it is. I wrote that most likely right around the time when I learned how to make my own functions. I've had to re-code probably 2/3 of StealthBot to mesh with new, more efficient, easier-to-read ways of writing code I've learned in the last 3-4 months.. It's been fun.


As it's written today:
Private Sub Form_Load()
   Me.Icon = frmChat.Icon

   If Dir$(App.Path & "\config.ini") = "" Then Exit Sub
   
   If ReadINI("Main", "ShowSplash", "config.ini") <> "Y" Then
       frmChat.Show
       Unload Me
   End If
End Sub