Mirage Source

Free ORPG making software.
It is currently Wed Jun 05, 2024 10:50 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Redundant?
PostPosted: Thu Jan 01, 2009 2:15 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Code:
Private Sub chkServerLog_Click()
    ' if its not 0, then its true
    If Not chkServerLog.Value Then
        ServerLog = True
    Else
        ServerLog = False
    End If
End Sub


Wouldn't it be simpler to just see if it's checked, rather than toggle a boolean when it's checked? Rather than seeing if the ServerLog = True or false, why not just have it as

Code:
 If frmserver.chkserverlog.value = 1 Then
DoCode


Am I missing something obvious?

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: Redundant?
PostPosted: Thu Jan 01, 2009 4:06 pm 
It's less code in the long run, if you think about it. I'd rather just check a single boolean (I prefer to use a byte..) than have to type all that out each time.


Top
  
 
 Post subject: Re: Redundant?
PostPosted: Thu Jan 01, 2009 4:16 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
Less code in vb6 doesn't actually mean its faster. But really, it will make such an insignificant difference. Just ignore it.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
 Post subject: Re: Redundant?
PostPosted: Thu Jan 01, 2009 7:08 pm 
Who said anything about speed? I'm just lazy. Lol.


Top
  
 
 Post subject: Re: Redundant?
PostPosted: Thu Jan 01, 2009 7:45 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Hmmm. Alright, just trying to learn good habits for programming. Figured, I'd ask you guys. Thanks!

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: Redundant?
PostPosted: Thu Jan 01, 2009 8:42 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
You know to reduce that to a single line?

Code:
Private Sub chkServerLog_Click()
    ' if its not 0, then its true
    ServerLog = Not chkServerLog.Value
End Sub

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group