|
-
Dec 1st, 2001, 09:36 AM
#1
Thread Starter
Hyperactive Member
Loops Sort of....
Hey just me again with my slight problem
I need a loop to do something like this
word 0x00000000 ;material index Triangle 0
word 0x00000000, 0x00000001, 0x00000002 ;vertex indices
word 0x00000000 ;material index Triangle 1
word 0x00000000, 0x00000002, 0x00000003 ;vertex indices
word 0x00000000 ;material index Triangle 2
word 0x00000004, 0x00000005, 0x00000006 ;vertex indices
word 0x00000000 ;material index Triangle 3
word 0x00000004 0x00000006, 0x00000007 ;vertex indices
my code is this so far
VB Code:
Private Sub MakeTriangles()
Dim Counter3 As Integer
Dim Tri As Integer
Dim TriNumber As Integer
Tri = (txtFaces.Text * 2) 'Do Mathmatics
Tri = (Tri - 1)
TriangleNumber = 0
For Counter3 = 0 To Tri ' Set up 10 repetitions.
txtoutput.Text = txtoutput.Text & vbCrLf + "word 0x00000000 ;material index Triangle " & TriangleNumber
txtoutput.Text = txtoutput.Text & vbCrLf + "word 0x00000000, 0x00000001, 0x00000002 ;vertex indices" & vbCrLf
TriangleNumber = TriangleNumber + 1
Next Counter3
End Sub
Which results in.....
word 0x00000000 ;material index Triangle 0
word 0x00000000, 0x00000001, 0x00000002 ;vertex indices
word 0x00000000 ;material index Triangle 1
word 0x00000000, 0x00000001, 0x00000002 ;vertex indices
word 0x00000000 ;material index Triangle 2
word 0x00000000, 0x00000001, 0x00000002 ;vertex indices
word 0x00000000 ;material index Triangle 3
word 0x00000000, 0x00000001, 0x00000002 ;vertex indices
as you can see from the top segment of triangles
but how can i go about implementing it so it does it this way
so that it does the Values
like in the top one
so it can count up them
i dont know how to make the first one only change after its done 2 of the same
its hard to explain
basicaly i need my program to replacate whats in the top lot
we have got the formatting sorted so it can count in normal numbers
then i can change it for when it prints the results
as i say its hard to explain....
-
Dec 1st, 2001, 10:30 AM
#2
Hyperactive Member
What line does the yellow bar lan on in debug?
-
Dec 1st, 2001, 10:37 AM
#3
Thread Starter
Hyperactive Member
VB Code:
Ahex = "0x" & String(8 - Len(Hex(Ahex)), "0") & Hex(A)
-
Dec 1st, 2001, 11:31 AM
#4
Thread Starter
Hyperactive Member
-
Dec 1st, 2001, 11:48 AM
#5
Thread Starter
Hyperactive Member
Hmm
Is it because i add something it dosent like the new numbers ?
so it wont convert them ?
hmm *Ponders*
can you help
-
Dec 1st, 2001, 01:17 PM
#6
Frenzied Member
I think you're taking the wrong approach. What is the purpose if this code?
You just proved that sig advertisements work.
-
Dec 1st, 2001, 01:39 PM
#7
Thread Starter
Hyperactive Member
The Code should work fine but its just that error
it does what i have abouve it
prints the triangle things and Should keep going but it dosent it goes through the thing once and on the second try it stops i just need to know why and how to fix it
VB Code:
Private Sub MakeTriangles()
Tri = (txtFaces.Text * 1) 'Do Mathmatics
Tri = (Tri - 1)
TriangleNumber = 0
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
Dim F As Integer
A = 0
B = 1
C = 2
D = 0
E = 2
F = 3
For Counter3 = 0 To Tri
Debug.Print Ahex
Ahex = "0x" & String(8 - Len(Hex(Ahex)), "0") & Hex(A)
Bhex = "0x" & String(8 - Len(Hex(Bhex)), "0") & Hex(B)
Chex = "0x" & String(8 - Len(Hex(Chex)), "0") & Hex(C)
Dhex = "0x" & String(8 - Len(Hex(Dhex)), "0") & Hex(D)
Ehex = "0x" & String(8 - Len(Hex(Ehex)), "0") & Hex(E)
Fhex = "0x" & String(8 - Len(Hex(Fhex)), "0") & Hex(F)
txtoutput.Text = txtoutput.Text & vbCrLf + " word 0x00000000 ;material index Triangle " & TriangleNumber
txtoutput.Text = txtoutput.Text & vbCrLf + " word " & Ahex & ", " & Bhex & ", " & Chex & ", " & " ;vertex indices" & vbCrLf
TriangleNumber = TriangleNumber + 1
txtoutput.Text = txtoutput.Text & vbCrLf + " word 0x00000000 ;material index Triangle " & TriangleNumber
txtoutput.Text = txtoutput.Text & vbCrLf + " word " & Dhex & ", " & Ehex & ", " & Fhex & ", " & " ;vertex indices" & vbCrLf
A = (A + 4)
B = (B + 4)
C = (C + 4)
D = (D + 4)
E = (E + 4)
F = (F + 4)
Next Counter3
End Sub
-
Dec 1st, 2001, 02:01 PM
#8
Thread Starter
Hyperactive Member
Right still no Luck here i need your expertise hehe
it does one loop then crashes on this line
VB Code:
Ahex = "0x" & String(8 - Len(Hex(Ahex)), "0") & Hex(A)
It does it the first time around but the second run time error 13 type mismatch.........
and i cant for the life of me see why
-
Dec 1st, 2001, 02:09 PM
#9
Thread Starter
Hyperactive Member
Bugger Bugger Bugger!
i found the problem but now it just starts fresh every loop
-
Dec 1st, 2001, 02:12 PM
#10
Thread Starter
Hyperactive Member
Im so stupid
it starts fresh because i put my clearing code over my Friggen loop code that adds numbers to the values each time!
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
|