vbGore Free Online RPG Engine

Revolutionizing Visual Basic ORPG Development
It is currently Mon May 20, 2013 1:14 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Creating objects
PostPosted: Fri Jun 19, 2009 11:53 am 
Newbie

Joined: Fri Jun 19, 2009 11:48 am
Posts: 5
I noticed that when you look at the vbgore client/server source code there is a new object called GOREsockClient, im curious , how did they make that? ive been looking for 2 months now , how to make objects , with their own properties . and events , and user friendly so i dont have to enter the same code each time i want to use it. it would be awsome if somone could help me out with this as i have been stuck for quite a while and it is putting my game off quite a bit at least 2 months now.

Thank you for your time
-Ovhan


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Fri Jun 19, 2009 12:50 pm 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
All the code for the GOREsock is in the download, under the Code (or is it Source?) directory I believe it is called.


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Fri Jun 19, 2009 3:09 pm 
Newbie

Joined: Fri Jun 19, 2009 11:48 am
Posts: 5
Alright im gonna go look into that
TY


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Fri Jun 19, 2009 3:38 pm 
Newbie

Joined: Fri Jun 19, 2009 11:48 am
Posts: 5
ok i get the basic idea , but the syntax slips past me a bit , like for example what does

Code:
#If False Then
Private soxSERVER, soxCLIENT
#End If


mean?
can you please give me a simple example? i think a winsock app like the goresock is a little bit advanced for me.

Thank you for your time
-Ovhan


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Fri Jun 19, 2009 7:22 pm 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
An #if/#end if block is a compiler conditional. If the conditional passes (is true), it will be part of the code that gets compiled. If it is false, it won't. Having it always false, like that block does, is basically as if the code was never there. Why it is there, I am not sure.


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Sat Jun 20, 2009 5:09 am 
Aleron Coder

Joined: Fri Jan 05, 2007 5:36 am
Posts: 2964
Location: Germany
Debug purposes? @_@


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Sat Jun 20, 2009 5:37 am 
Newbie

Joined: Fri Jun 19, 2009 11:48 am
Posts: 5
but whats true and whats false? theres no condition in there , only False


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Sat Jun 20, 2009 7:58 am 
Aleron Coder

Joined: Fri Jan 05, 2007 5:36 am
Posts: 2964
Location: Germany
well in a normal if, the result of the check always returns true OR false,
depending on the condition.

if false then: always false, will NEVER execute
if true then : always true, will ALWAYS execute


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Sun Jun 21, 2009 10:12 pm 
Newbie

Joined: Fri Jun 19, 2009 11:48 am
Posts: 5
but whats false? for example

Code:
dim k as integer
k = 2
if k = 1 then
       ' does this code if it is true
       ' but it isnt , k = 1 is the condition
elseif k = 2 then
       ' does this code if it is true
       ' it does happend because k does = 2
end if


see? but in the code

Code:
#If False Then
Private soxSERVER, soxCLIENT
#End If


there is no condition , what is it checking is false?
and what does
Code:
#if
mean? is that because it is in general? and why does it only declare
those 2 if the non existing statement is false? and what data type are they?

this code is in the GOREsock source code

Thank you for your time
-Ovhan


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Sun Jun 21, 2009 11:51 pm 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
ALL if/then statements break down to booleans. This is the case in every single major programming language as far as I know. For example, with the code you posted, the it checks if k = 1. If k does = 1, then the result is True. If not, the result is False. So you can have "If False Then"... and it is a perfectly acceptable piece of code.

So in the precompiler conditional, "#if False then", its not checking against anything. You don't have to check against something for an if/then statement. Doing so is often pointless, but its perfectly acceptable. Similarly, you can write if/then statements with just constants.

Code:
If 1 = 2 Then


This is the same as if you were to write:

Code:
If False Then


or

Code:
If Not True Then


Top
 Profile  
 
 Post subject: Re: Creating objects
PostPosted: Wed Jun 24, 2009 9:30 pm 
Fresh Meat

Joined: Fri Jun 05, 2009 4:57 pm
Posts: 12
ovhan wrote:
I noticed that when you look at the vbgore client/server source code there is a new object called GOREsockClient, im curious , how did they make that? ive been looking for 2 months now , how to make objects , with their own properties . and events , and user friendly so i dont have to enter the same code each time i want to use it. it would be awsome if somone could help me out with this as i have been stuck for quite a while and it is putting my game off quite a bit at least 2 months now.


To the original post, if I understand your question: You want to create your own libraries?

Visual Basic 6 supports different ways to do that. At the most basic level, within your program code you'll want to add a file of type class. (The GORESockClient is a control, which would get more complicated to explain.) That adds a Class1.cls file to the project, which you can save to whatever friendly name you want. Then you can add things like Get and Set properties and subs and functions as much as you want. Just make them a Public function, etc. to see them when you reference it from elsewhere. In the server program code, UserStats.cls is a good example.

If you just want your own functions, it is simpler to add a .bas code module and make public functions.

If none of what I typed made any sense, then you may want to give yourself a crash course in VB programming before you dive in any further.


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

All times are UTC - 8 hours


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

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group