Valhalla Legends Forums Archive | Battle.net Bot Development | Need Help On Code

AuthorMessageTime
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
April 8, 2003, 2:09 AM
Camel
well first of all, don't ever type out the function name for an event; use the drop down boxes at the top
April 8, 2003, 2:17 AM
St0rm.iD
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.
April 9, 2003, 12:14 AM
PaiD
[code]
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
[/code] that is the
'StealthBot 11/5/02
'Source Code Version: 1.1.4
that stealth released
April 9, 2003, 12:46 AM
St0rm.iD
[me=St0rm.iD]adds Dayclone to THE LIST.[/me]
April 9, 2003, 12:51 AM
Grok
Since nobody else mentioned it, that's really crappy VB code. Just a little unconstructive criticism. :)
April 9, 2003, 11:51 AM
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?!
April 9, 2003, 3:39 PM
tA-Kane
[quote author=Zakath link=board=17;threadid=984;start=0#msg7404 date=1049902751]Does VB honestly say "Variable not defined" and then not tell you what variable it's talking about?![/quote]

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!
April 9, 2003, 4:15 PM
Grok
[quote author=Zakath link=board=17;threadid=984;start=0#msg7404 date=1049902751]
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]

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.
April 9, 2003, 5:45 PM
Stealth
[quote author=Grok link=board=17;threadid=984;start=0#msg7390 date=1049889083]
Since nobody else mentioned it, that's really crappy VB code. Just a little unconstructive criticism. :)
[/quote]

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:
[code]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[/code]
April 9, 2003, 10:49 PM

Search