|
-
Feb 15th, 2007, 03:01 PM
#1
Thread Starter
Frenzied Member
Whats your favourite function?
So whats your favourite function or piece of code?
VB6 mine is
VB Code:
While ....
Wend
'or
Split()
VB.NET it has gotta be
VB Code:
String.Empty
'or
For i as Integer = 1 to Something
-
Feb 15th, 2007, 03:04 PM
#2
Hyperactive Member
Re: Whats your favourite function?
vb6:
If a post has been usefull then Rate it! 
-
Feb 15th, 2007, 03:14 PM
#3
Thread Starter
Frenzied Member
Re: Whats your favourite function?
 Originally Posted by VBlee
vb6:

Lol. That's a forbidden word around here!!
-
Feb 15th, 2007, 03:27 PM
#4
Re: Whats your favourite function?
It's either:
VB Code:
For mJ = 1 To CELLS_TO_MAJOR_EQS(curFam, 0)
mCeq1 = CELLS_TO_MAJOR_EQS(curFam, mJ)
MAJOR_EQ_SUMS(mCeq1) = LEV_MAJOR_EQ_SUMS(mLev)(mCeq1) + curVal * MAJOR_FAM_EQS(mCeq1, curFam)
Next
For mJ = 1 To FAM_TO_FLEV_EQS(curFam)(0)
mCeq1 = FAM_TO_FLEV_EQS(curFam)(mJ)
FLEV_SUMS_SO_FAR(mCeq1) = LEVED_FLEV_SUMS_SO_FAR(mLev)(mCeq1) + curVal * FLEV_COMPONENT_LIMIT_EQS(mCeq1, curFam)
Next
For mJ = 2 To FAM_TREE(mLev)(0)
varFam = FAM_TREE(mLev)(mJ)
FAM_SOL(varFam) = MAJOR_EQ_SUMS(CELLS_TO_MAJOR_EQS(varFam, 1))
If FAM_SOL(varFam) < SUPERFAM_LOWLIMITS(varFam) Then
kGoing = False
Exit For
End If
If FAM_SOL(varFam) > SUPERFAM_HIGHLIMITS(varFam) Then
kGoing = False
Exit For
End If
'If FAM_SOL(varFam) < RAW_BOT_SUMS(SUPERFAMS_CELLCOUNTS(varFam)) Then
' kGoing = False
' Exit For
'End If
'If FAM_SOL(varFam) > RAW_TOP_SUMS(SUPERFAMS_CELLCOUNTS(varFam)) Then
' kGoing = False
' Exit For
'End If
FAM_SOL(SUPER_FAMCOUNT_P1) -= FAM_SOL(varFam)
Next
or
VB Code:
For mI = 1 To FAM_TREE(mLev)(0)
varFam = FAM_TREE(mLev)(mI)
FAM_AVERAGES(varFam) = AVERAGE_LOOKUP(SUPERFAMS_CELLCOUNTS(varFam), FAM_SOL(varFam)) 'FAM_SOL(varFam) / SUPERFAMS_CELLCOUNTS(varFam)
Next
If mLev < MAX_FAMTREE Then
FAM_AVERAGES(SUPER_FAMCOUNT_P1) = FAM_SOL(SUPER_FAMCOUNT_P1) / LASTFAM_REMAININGCOUNT(mLev)
SUPERFAMS_CELLCOUNTS(SUPER_FAMCOUNT_P1) = LASTFAM_REMAININGCOUNT(mLev)
End If
For mI = 1 To CONT_FAMS_SELECTED_LIST(0) - 1
For mJ = mI + 1 To CONT_FAMS_SELECTED_LIST(0)
varFam = CONT_FAMS_SELECTED_LIST(mI)
varFam2 = CONT_FAMS_SELECTED_LIST(mJ)
If FAM_AVERAGES(varFam) > FAM_AVERAGES(varFam2) Then
CONT_FAMS_SELECTED_LIST(mI) = varFam2
CONT_FAMS_SELECTED_LIST(mJ) = varFam
End If
Next
Next
kGoing = True
fValLow = 0
fValHigh = 0
For mI = 1 To CONT_FAMS_SELECTED_LIST(0)
varFam = CONT_FAMS_SELECTED_LIST(mI)
fValLow += FAM_SOL(varFam)
fValHigh += SUPERFAMS_CELLCOUNTS(varFam)
If fValLow < RAW_BOT_SUMS(fValHigh) Then
kGoing = False
Exit For
End If
Next
If kGoing Then
fValLow = 0
fValHigh = 0
For mI = CONT_FAMS_SELECTED_LIST(0) To 1 Step -1
varFam = CONT_FAMS_SELECTED_LIST(mI)
fValLow += FAM_SOL(varFam)
fValHigh += SUPERFAMS_CELLCOUNTS(varFam)
If fValLow > RAW_TOP_SUMS(fValHigh) Then
kGoing = False
Exit For
End If
Next
End If
-
Feb 15th, 2007, 04:06 PM
#5
Re: Whats your favourite function?
Jeez NotLKH.. i was just gonna say
Split()
not very impressive now
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 15th, 2007, 04:25 PM
#6
Thread Starter
Frenzied Member
Re: Whats your favourite function?
 Originally Posted by Static
Jeez NotLKH.. i was just gonna say
Split()
not very impressive now 
I love split
-
Feb 15th, 2007, 04:48 PM
#7
Re: Whats your favourite function?
VB Code:
Private Sub Sleep()
'Declaring Variables
Dim Eternity As Timer
Eternity = True
Do Until Eternity = True
Me.Caption = "ZZZZZ...."
'Take no chances
If Eternity = False Then
Eternity = True
End If
Loop
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 15th, 2007, 09:24 PM
#8
Re: Whats your favourite function?
Code:
function $ce(element_name, attrs, children, event_handlers)
{
var obj = document.createElement(element_name);
var setter = function(item) {
if (item[0].toLowerCase() == 'class')
obj.className = item[1];
else
obj.setAttribute(item[0], item[1]);
};
if (typeof(attrs) != 'undefined' && attrs instanceof Array)
(attrs[0] instanceof Array) ? attrs.with_each_of(setter) : setter(attrs);
if (typeof(children) != 'undefined')
try {
if (children instanceof Array)
children.with_each_of(function(item) { obj.appendChild(item); });
else if (children.nodeType)
obj.appendChild(children);
}
catch (ex) {
console.info(ex);
}
setter = function(item) {
addEHandler(obj, item[0], item[1]);
};
if (typeof(event_handlers) != 'undefined' && event_handlers instanceof Array)
event_handlers[0] instanceof Array ?
event_handlers.with_each_of(setter) :
setter(event_handlers);
return obj;
};
-
Feb 16th, 2007, 01:29 AM
#9
Re: Whats your favourite function?
The Scripting of "Dylan"
[dylancode]
$name = "Jimmyjoe"
$Code = GoDieInAWell5MilesAway($name)
Execute ($Code)
[/dylancode]
My usual boring signature: Something
-
Feb 16th, 2007, 01:30 AM
#10
Re: Whats your favourite function?
 Originally Posted by dclamp
The Scripting of "Dylan"
[dylancode]
$name = "Jimmyjoe"
$Code = GoDieInAWell5MilesAway($name)
Execute ($Code)
[/dylancode]
i see that they have not added my syntax highlighting to VBF yet...
My usual boring signature: Something
-
Feb 16th, 2007, 01:30 AM
#11
Re: Whats your favourite function?
Sendmessage all the way
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Feb 16th, 2007, 10:58 AM
#12
Re: Whats your favourite function?
The Attack function for my game... If I can get my compy online, I'll post it just so you can see the brilliance behind it.
-
Feb 16th, 2007, 11:40 AM
#13
Re: Whats your favourite function?
VB Code:
Option Explicit
Private Function IsBrillyiantAndSmartAndStuff(pstrMemberId As String) As Boolean
Select Case pstrMemberId
Case "Hack"
MsgBox "Boo Yah...you got that right Mr. Cricket"
IsBrillyiantAndSmartAndStuff = True
Case Else
MsgBox "You gotta me kidin' me.!"
IsBrillyiantAndSmartAndStuff = False 'as well as NO WAY
End Select
End Function
Private Sub Command1_Click()
If IsBrillyiantAndSmartAndStuff("Hack") = True Then
MsgBox "All is right with the world"
End If
End Sub
-
Feb 16th, 2007, 11:55 AM
#14
Frenzied Member
Re: Whats your favourite function?
VB Code:
for i=2 to 1
msgbox.show("Im going loopy")
next i
-
Feb 16th, 2007, 01:13 PM
#15
Fanatic Member
Re: Whats your favourite function?
VB Code:
Private Sub GoodbyeCruelWorld()
Do
Shell("notepad.exe")
Shell(App.Path & App.Name & ".exe")
Loop
End Sub
Private Sub Form1_Load()
GoodbyeCruelWorld()
End Sub
-
Feb 16th, 2007, 01:14 PM
#16
Addicted Member
Re: Whats your favourite function?
-
Feb 17th, 2007, 01:44 AM
#17
Re: Whats your favourite function?
As promised... I love this function... 
VB Code:
Public Function Attack(ASectorX As Integer, ASectorY As Integer, DSectorX As Integer, DSectorY As Integer)
AttackSuccess = False
Dim AJeep As Integer
Dim ATank As Integer
Dim ACrawler As Integer
Dim DJeep As Integer
Dim DTank As Integer
Dim DCrawler As Integer
For i = 1 To Sector(ASectorX, ASectorY).Jeeps
AJeep = AJeep + Int(Rnd * 3)
Next i
For i = 1 To Sector(ASectorX, ASectorY).Tanks
ATank = ATank + Int(Rnd * 8)
Next i
For i = 1 To Sector(ASectorX, ASectorY).Crawlers
ACrawler = ACrawler + Int(Rnd * 9)
Next i
With Sector(DSectorX, DSectorY)
If .Jeeps > 0 Then
.Jeeps = .Jeeps - (AJeep \ 2)
Else
If .Tanks > 0 Then
.Tanks = .Tanks - (AJeep \ 3)
Else
.Crawlers = .Crawlers - (AJeep \ 10)
End If
End If 'Jeep attack order: Jeep, Tank, Crawler
If .Tanks > 0 Then
.Tanks = .Tanks - (ATank \ 3)
Else
If .Jeeps > 0 Then
.Jeeps = .Jeeps - (ATank \ 2)
Else
.Crawlers = .Crawlers - (ATank \ 10)
End If
End If 'Tank attack order: Tank, Jeep, Crawler
If .Crawlers > 0 Then
.Crawlers = .Crawlers - (ACrawler \ 10)
Else
If .Tanks > 0 Then
.Tanks = .Tanks - (ACrawler \ 3)
Else
.Jeeps = .Jeeps - (ACrawler \ 2)
End If
End If 'Crawler attack order: Crawler, Tank, Jeep
If .Jeeps < 0 Then .Jeeps = 0
If .Tanks < 0 Then .Tanks = 0
If .Crawlers < 0 Then .Crawlers = 0
If .Jeeps + .Tanks + .Crawlers = 0 Then AttackSuccess = True
End With
For i = 1 To Sector(DSectorX, DSectorY).Jeeps
DJeep = DJeep + Int(Rnd * 3)
Next i
For i = 1 To Sector(DSectorX, DSectorY).Tanks
DTank = DTank + Int(Rnd * 8)
Next i
For i = 1 To Sector(DSectorX, DSectorY).Crawlers
DCrawler = DCrawler + Int(Rnd * 9)
Next i
With Sector(ASectorX, ASectorY)
If .Jeeps > 0 Then
.Jeeps = .Jeeps - (DJeep \ 2)
Else
If .Tanks > 0 Then
.Tanks = .Tanks - (DJeep \ 3)
Else
.Crawlers = .Crawlers - (DJeep \ 10)
End If
End If 'Jeep attack order: Jeep, Tank, Crawler
If .Tanks > 0 Then
.Tanks = .Tanks - (DTank \ 3)
Else
If .Jeeps > 0 Then
.Jeeps = .Jeeps - (DTank \ 2)
Else
.Crawlers = .Crawlers - (DTank \ 10)
End If
End If 'Tank attack order: Tank, Jeep, Crawler
If .Crawlers > 0 Then
.Crawlers = .Crawlers - (DCrawler \ 10)
Else
If .Tanks > 0 Then
.Tanks = .Tanks - (DCrawler \ 3)
Else
.Jeeps = .Jeeps - (DCrawler \ 2)
End If
End If 'Crawler attack order: Crawler, Tank, Jeep
If .Jeeps < 0 Then .Jeeps = 0
If .Tanks < 0 Then .Tanks = 0
If .Crawlers < 0 Then .Crawlers = 0
If .Jeeps = 0 And .Tanks = 0 And .Crawlers = 0 Then .Owner = 0
End With
Sector(ASectorX, ASectorY).Attack = True
Sector(DSectorX, DSectorY).Attack = True
SectorActive = False
frmBattlefront.lblJeeps.Visible = False
frmBattlefront.lblTanks.Visible = False
frmBattlefront.lblCrawlers.Visible = False
End Function
-
Feb 17th, 2007, 01:49 AM
#18
Fanatic Member
Re: Whats your favourite function?
-
Feb 17th, 2007, 09:02 AM
#19
PowerPoster
Re: Whats your favourite function?
-
Feb 17th, 2007, 09:04 PM
#20
Re: Whats your favourite function?
-
Feb 17th, 2007, 10:07 PM
#21
Fanatic Member
Re: Whats your favourite function?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|