• Welcome to Valhalla Legends Archive.
 

Need Help On Code

Started by Dayclone, April 07, 2003, 09:09 PM

Previous topic - Next topic

Dayclone

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

Camel

well first of all, don't ever type out the function name for an event; use the drop down boxes at the top

Banana fanna fo fanna

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.

PaiD


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

Banana fanna fo fanna

* St0rm.iD adds Dayclone to THE LIST.

Grok

Since nobody else mentioned it, that's really crappy VB code.  Just a little unconstructive criticism.  :)

Zakath

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?!
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

tA-Kane

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!
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Grok

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.

Stealth

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
- Stealth
Author of StealthBot