Go Back   BWHacks > Development > Programming

Programming General non-hacking related programming.

Reply
 
LinkBack Thread Tools

Old 09-18-2005, 07:57 PM   #1 (permalink)
LCSBSSRHXXX
The Sexy Penguin
Senior Member
Retired Staff Member

Prophet
 
LCSBSSRHXXX's Avatar
 
Join Date: Feb 2005
Location: MOTHA ****IN BOULDER COLORADO
Posts: 7,198
LCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond repute
Send a message via AIM to LCSBSSRHXXX
Default Basic VB Stuff - String Manipulation, Variables, If Statments, For Statments.

This is a tutorial I wrote a while ago to teach some basic things about VB, this doesn't have any info about hacking but it has some things you can learn from, if you need me to post an example for one of the things in this tutorial just ask.

Code:
String Manipulation :

	Val(str1)				Returns the str1 as a value, this is used only for math
	Len(strSource)				Returns the legnth of a strSource
	Left$(strSource, #)			Returns the value at # (Starting from left)
	Right$(strSource, #)			Returns the value at # (starting from right)
	Mid$(String1, #, #)			Returns the value betweem # and #
	InStr(#, strSource, strInput)		Starts at # in strSource and looks for strInput
	Replace(strSource,OldString,NewString)	Replaces an OldString with a NewString, in strSource
	LCase$(strSource)			Returns strSource in lowercase
	UCase$(strSource)			Returns strSource in uppercase
	StrReverse(strSource)			Returns strSource reversed
	StrCompare(str1, str2)			Compares two strings ASCII values
	LTrim$(strSource)			Returns strSource with the spaces cut off of the left side of the string
	RTrim$(strSource)			Returns strSource with the spaces cut off of the right side of the string
	Trim$(strSource)			Returns strSource with the spaces cut off of the string
	Split(strSource, Chr(#))		Returns strSource split into an array with the specified character
	Join(strSource, Chr(#))			Returns strSource with it's array joined with the specified character
	IsNumeric(strSource)			Returns if strSource is numeric
	Space$(#)				Returns # of spaces


Combining Strings :

	To combine strings you might think you would use "+", you can use "+" to combine strings
	but the best way to combine strings is by using "&"
	
	VbCrLf	-	Makes the text go to a new line..
	VbTab	-	Adds a tab to the text.
	Time	-	Returns your computer's time 
	Date	-	Returns your computer's date
	
	Example :

		Public Sub Form_Load()
			MsgBox "Time " & Time & vbCrLf & "Date " & Date 	
		End Sub

Option Explicit :

	Option Explicit makes the form your working on check for undeclared variables, and stop 
	the program an alert you if there is an undeclared variable.

Declaring Variables :

	Dim	-	Declaring a variable.
	Public	-	Makes the variable useable anywhere in your project.
	Private	-	Makes the variable useable only on the form you declare it on.
	Static	-	Remebers the last value assigned to the variable.

Variable Types:

	String	-	stores a string of text.
	Integer	-	An integer between 32768 and -32768.
	Byte	-	An integer between 0 and 255.
	Long	-	An integer extending to billions.
	Single	-	Stores large numbers.
	Double	-	Stores large numbers and decimals.
	Boolean	-	True or False value.
	Variant -	Any value listed above, memory intensive.

If Statments :

	If		If ... Then (#1, #2, #3)	
	If Not		If Not ... Then (#5)
	Or		An Or can be added to the if statement after the first condition as an alternate. (example #7)
	And		An And can be added to the if statement after the first condition. (example #8)
	ElseIf		ElseIf ... Then (if you are going to put an elseif in, it always fallows an if statement (example #6))
	Then		Then always fallows an If, If Not, or an ElseIf (example #1 - 8)
	Else		Else is the oppisite of If (example #4)
	End If		End If ends an If statement (unless it is a one line If (example #2)) if there is an ElseIf then put the End If after the ElseIf (example #6) 

Examples :

#1
	If ... Then
		...
	End If
#2
	If ... Then ...
#3
	If ... Then
		...
		...
		...
	End If
#4	
	If ... Then
		...
	Else
		...
	End If
#5
	If Not ... Then
		...
	End If
#6
	If ... Then
		...
	ElseIf ... Then
		...
	End If
#7
	If ... Or ... Then
		...
	End If
#8
	If ... And ... Then
		...
	End If

For Statements :

	For (varable)	A For statement starts with For then a variable = #(LBound(...)) to #(UBound(...)) with out setting a Step, a for statement increases by 1. (Example #1-3)
	Step		A Step can be used to make a For statement that increases by (+,-)# a Step can be used to make a For statement decrease by # or increase #, without setting a Step a For will increase by 1.(Example #2)		
	Next (varable)	Next (varable) makes the varable increase by the indicated Step or the default 1 and then it will loop back up to the begining of the For statement. (Example #1-3) 


Examples :

#1
	For i = ... to ...
		...
	Next i
#2
	For i = ... to ... step ...
		...
	Next i
#3
	for i = LBound(...) to UBound(...)
		...
	Next i
Update by: indulgence [since no one will probably check page 13 or whatever :P]
Code:
The If statements area is grossly inadequate...
If Statments [append] :

	IIf		IIf(Evaluator, ValueIfTrue, ValueIfFalse)
			' This is comparable to the ? : expressions in C, C++, JS, etc
			' Example:  
			' Dim sValue As String = IIf( 0 > 1, "Never gonna return me", "Always will return me")
	OrElse		If ... OrElse ... Then
	AndAlso		If ... AndAlso ... Then

The 'With' Statement :
	The With statement allows you to set a control context for referencing multiple properties more simply...
	' Example :
	'    Dim sExample As String = "Jeebus save me"
	'    Dim iLength, iLength2 As Integer
	'    With sExample
	'       iLength = .Length
	'       iLength2 = .Length
	'    End With
	Obviously you can get more complicated than this ;)

Further list that needs commenting on.... but I don't have time to do at the moment.
- The "For" Statement needs a ForEach description
- More to come later
__________________
Quote:
Originally Posted by 707 View Post
Gotta throw the magnums down on the counter, and be like yeeeeah bitch.
we pop bitchez wit r gatz klub:
LCS, 707, BELPHEGOR

YEEEEEEEH BITCH

Quote:
Gorgy: so whats the new klub
Gorgy: poppin bitchez wit ur gat
707: WE GOT DICKS LIKE JESUS, SO WE GOTTA SPORT THE MAGS, AND BE LIKE YEEEEH BITCH
LCSBSSRHXXX 15 0FF11|\|3   Reply With Quote
Advertisement
 
Advertisement
Advertisement Sponsored links


Old 09-18-2005, 10:11 PM   #2 (permalink)
punture
Senior Member

Saint
 
punture's Avatar
 
Join Date: Jul 2004
Location: Vancouver, B.C. Canada
Posts: 6,127
punture has much to be proud ofpunture has much to be proud ofpunture has much to be proud ofpunture has much to be proud ofpunture has much to be proud ofpunture has much to be proud of
Send a message via AIM to punture Send a message via MSN to punture
Default

nice LCS!
__________________
punture 15 0FF11|\|3   Reply With Quote

Old 09-19-2005, 03:40 AM   #3 (permalink)
TheTempest
Arbiter
Senior Member
Retired Staff Member

Blessed
 
TheTempest's Avatar
 
Join Date: Apr 2004
Posts: 2,092
TheTempest is a glorious beacon of lightTheTempest is a glorious beacon of lightTheTempest is a glorious beacon of light
Default

Roar!!! =) Way to go!
__________________

My signature is back!! Hell YES!

Click the link, I DEMAND YOU! :-D
http://www.bwhacks.com/forums/showthread.php?t=24873
TheTempest 15 0FF11|\|3   Reply With Quote

Old 09-20-2005, 07:54 PM   #4 (permalink)
Jett

Heretic
 
Join Date: May 2005
Posts: 37
Jett is an unknown quantity at this point
Default

Nice guide. Too bad I already know everything in there, though :]
Jett 15 0FF11|\|3   Reply With Quote

Old 09-20-2005, 10:13 PM   #5 (permalink)
K? Pŕo?ćtiόnŹ
=)
Senior Member
Retired Staff Member

Messiah
 
K? Pŕo?ćtiόnŹ's Avatar
 
Join Date: Oct 2004
Location: Okinawa
Posts: 9,347
K? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond repute
Send a message via AIM to K? Pŕo?ćtiόnŹ
Default

You decided to post this becuase?
__________________
K? Pŕo?ćtiόnŹ 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 12:14 AM   #6 (permalink)
LCSBSSRHXXX
The Sexy Penguin
Senior Member
Retired Staff Member

Prophet
 
LCSBSSRHXXX's Avatar
 
Join Date: Feb 2005
Location: MOTHA ****IN BOULDER COLORADO
Posts: 7,198
LCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond repute
Send a message via AIM to LCSBSSRHXXX
Default

Because it's helpful to newbs.
__________________
Quote:
Originally Posted by 707 View Post
Gotta throw the magnums down on the counter, and be like yeeeeah bitch.
we pop bitchez wit r gatz klub:
LCS, 707, BELPHEGOR

YEEEEEEEH BITCH

Quote:
Gorgy: so whats the new klub
Gorgy: poppin bitchez wit ur gat
707: WE GOT DICKS LIKE JESUS, SO WE GOTTA SPORT THE MAGS, AND BE LIKE YEEEEH BITCH
LCSBSSRHXXX 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 12:46 AM   #7 (permalink)
c0ke
What ever it takes!
Retired Staff Member

Blessed
 
c0ke's Avatar
 
Join Date: Jan 1970
Location: New Jersey
Posts: 2,297
c0ke is a splendid one to beholdc0ke is a splendid one to beholdc0ke is a splendid one to beholdc0ke is a splendid one to beholdc0ke is a splendid one to beholdc0ke is a splendid one to behold
Send a message via AIM to c0ke
Default

Either way their home is pscode.com.
__________________
Because she's hot.

Proud member of the Fair Lawn Fire Department.Badge: A-1

“I have no ambition in this world but one, and that is to be a fireman. The position may, in the eyes of some, appear to be a lowly one; but we who know the work which the fireman has to do believe that his is a noble calling. Our proudest moment is to save lives. Under the impulse of such thoughts, the nobility of the occupation thrills us and stimulates us to deeds of daring, even of supreme sacrifice.”
" And let no man say, My training let me down."
-- Edward F. Croker
Chief of Department
F.D.N.Y.
1899-1911
c0ke 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 12:49 AM   #8 (permalink)
Uniquely_Defined
Senior Member

Crusader
 
Uniquely_Defined's Avatar
 
Join Date: Dec 2004
Posts: 3,374
Uniquely_Defined has much to be proud ofUniquely_Defined has much to be proud ofUniquely_Defined has much to be proud ofUniquely_Defined has much to be proud ofUniquely_Defined has much to be proud ofUniquely_Defined has much to be proud of
Send a message via AIM to Uniquely_Defined Send a message via MSN to Uniquely_Defined Send a message via Skype™ to Uniquely_Defined
Default

@Coke: LCS got banned from pscode.com. =p(Unless he got unbanned previously? But since you pissed off one of their mods I highly doubt it.)

@LCS: So, you finally finished up that ole' thing ehh?
__________________
Don't mess with my wiggle.

ZyZ (11:05:48 PM): I'm
ZyZ (11:05:49 PM): ****ing
ZyZ (11:05:49 PM): bi
Uniquely_Defined 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 12:51 AM   #9 (permalink)
K? Pŕo?ćtiόnŹ
=)
Senior Member
Retired Staff Member

Messiah
 
K? Pŕo?ćtiόnŹ's Avatar
 
Join Date: Oct 2004
Location: Okinawa
Posts: 9,347
K? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond reputeK? Pŕo?ćtiόnŹ has a reputation beyond repute
Send a message via AIM to K? Pŕo?ćtiόnŹ
Default

Quote:
Originally Posted by LCSBSSRHXXX
Because it's helpful to newbs.
>_<, not you! To the stupid **** who was trying to show off.
__________________
K? Pŕo?ćtiόnŹ 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 01:21 AM   #10 (permalink)
LCSBSSRHXXX
The Sexy Penguin
Senior Member
Retired Staff Member

Prophet
 
LCSBSSRHXXX's Avatar
 
Join Date: Feb 2005
Location: MOTHA ****IN BOULDER COLORADO
Posts: 7,198
LCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond repute
Send a message via AIM to LCSBSSRHXXX
Default

Quote:
Originally Posted by Uniquely_Defined
@Coke: LCS got banned from pscode.com. =p(Unless he got unbanned previously? But since you pissed off one of their mods I highly doubt it.)

@LCS: So, you finally finished up that ole' thing ehh?
I'm still banned.
__________________
Quote:
Originally Posted by 707 View Post
Gotta throw the magnums down on the counter, and be like yeeeeah bitch.
we pop bitchez wit r gatz klub:
LCS, 707, BELPHEGOR

YEEEEEEEH BITCH

Quote:
Gorgy: so whats the new klub
Gorgy: poppin bitchez wit ur gat
707: WE GOT DICKS LIKE JESUS, SO WE GOTTA SPORT THE MAGS, AND BE LIKE YEEEEH BITCH
LCSBSSRHXXX 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 01:24 AM   #11 (permalink)
The_Pinkness

Deviant
 
The_Pinkness's Avatar
 
Join Date: Apr 2005
Location: Utah!
Posts: 68
The_Pinkness is on a distinguished road
Default

omg did u block me LCS!?
__________________
The_Pinkness 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 01:26 AM   #12 (permalink)
LCSBSSRHXXX
The Sexy Penguin
Senior Member
Retired Staff Member

Prophet
 
LCSBSSRHXXX's Avatar
 
Join Date: Feb 2005
Location: MOTHA ****IN BOULDER COLORADO
Posts: 7,198
LCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond repute
Send a message via AIM to LCSBSSRHXXX
Default

No, I'm not online, I was making a Top Ramen and I spilled boiling water on my hand an it hurts, also I have to memorize a paper I wrote for German...
__________________
Quote:
Originally Posted by 707 View Post
Gotta throw the magnums down on the counter, and be like yeeeeah bitch.
we pop bitchez wit r gatz klub:
LCS, 707, BELPHEGOR

YEEEEEEEH BITCH

Quote:
Gorgy: so whats the new klub
Gorgy: poppin bitchez wit ur gat
707: WE GOT DICKS LIKE JESUS, SO WE GOTTA SPORT THE MAGS, AND BE LIKE YEEEEH BITCH
LCSBSSRHXXX 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 01:26 AM   #13 (permalink)
The_Pinkness

Deviant
 
The_Pinkness's Avatar
 
Join Date: Apr 2005
Location: Utah!
Posts: 68
The_Pinkness is on a distinguished road
Default

uh huh whatever....good luck with that:( :(
__________________
The_Pinkness 15 0FF11|\|3   Reply With Quote

Old 09-21-2005, 01:28 AM   #14 (permalink)
Uniquely_Defined
Senior Member

Crusader
 
Uniquely_Defined's Avatar
 
Join Date: Dec 2004
Posts: 3,374
Uniquely_Defined has much to be proud ofUniquely_Defined has much to be proud of