Sorry about that, I did want to wrap it in code tags, but I wasn't sure how to do it.
As for the code itself, I didn't post all of it on purpose, I just though it's irrelevant and makes it quite cluttered. Where you see "........." it's all code that produces output, but I'm not sure if it'll make any sense to people because it's mostly prodecures I've created. Here is the whole thing anyway:
The timer (and I was hoping the loop as well) is activates after a key press:
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then
Dim bytEscape As Byte
bytEscape = MsgBox("Exit?", 1, "Esc Command")
If bytEscape = 1 Then
Unload Me
End If
ElseIf KeyAscii = 44 Then
Tmr1.Enabled = True
Tmr1.Interval = 1
End If
End Sub
There is a loop coded within the Timer event to make it cycle and change the values of the specific variables (A, B, C...) for each cycle:
Code:
Private Sub Tmr1_Timer()
Do While Block1 < 4
Select Case Block1
Case 1
strTrial = "0156789 !"
A = vbRed
B = vbGreen
C = vbYellow
D = vbWhite
E = Purple
F = vbCyan
G = vbBlue
P = x5
O = y5
Q = x
R = y
Call Timer
Case 2
strTrial = "0256789 !"
A = Purple
B = vbRed
C = vbYellow
D = vbBlue
E = vbCyan
F = vbWhite
G = vbGreen
P = x
O = y
Q = x2
R = y2
Call Timer
Case 3
strTrial = "0356789 !"
A = vbRed
B = Purple
C = vbYellow
D = vbBlue
E = vbCyan
F = vbWhite
G = Purple
P = x
O = y
Q = x2
R = y2
Call Timer
End Select
Block1 = Block1 + 1
Loop
End Sub
This is the code for the Timer procedure, which is called after setting the variable values. It contains another loop to make it read through each letter of the string and do the associated events before moving to the next set of variables (from the first loop):
Code:
Public Sub Timer()
Static bytCounter As Byte
If bytCounter = 0 Then
bytCounter = 1
End If
Do
strStage = Mid(strTrial, bytCounter, 1)
Select Case strStage
Case "0"
Gap.Visible = True
Tmr1.Interval = 1000
Case "1"
Gap.Visible = False
Segmented.Visible = False
Amodal.Visible = False
Modal.Visible = False
Whole.Visible = True
Tmr1.Interval = 1500
Case "2"
Gap.Visible = False
Whole.Visible = False
Modal.Visible = False
Amodal.Visible = False
Segmented.Visible = True
Tmr1.Interval = 1500
Case "3"
Gap.Visible = False
Whole.Visible = False
Amodal.Visible = False
Segmented.Visible = False
Modal.Visible = True
Tmr1.Interval = 1500
Case "4"
Gap.Visible = False
Whole.Visible = False
Modal.Visible = False
Segmented.Visible = False
Amodal.Visible = True
Tmr1.Interval = 1500
Case "5"
Call Cue
Tmr1.Interval = 50
Case "6"
Call CueOff
Tmr1.Interval = 50
Case "7"
Call ColourChange
Tmr1.Interval = 100
Case "8"
Fixation.Visible = True
Tmr1.Interval = 900
Case "9"
Static Press As Integer
Fixation.Visible = False
Tmr1.Interval = 1
Case " "
Call ColourChange
Call Probe
Tmr1.Interval = 2000
Case "!"
Gap.Visible = True
Tmr1.Interval = 1
End Select
If bytCounter >= Len(strTrial) Then
bytCounter = 0
Tmr1.Enabled = False
End If
bytCounter = bytCounter + 1
Loop Until bytCounter >= Len(strTrial)
End Sub
That's it. It loops through everything as it's supposed to, but as you said, there is no output. When I run it in step mode it seems like the problem is in the timer intervals, it goes through them but doesn't seem to execute them. If there is no loop it works fine, which made me think it's something to do with the loop itself
In worst case scenario I'll do it without a loop and variables will change based on keyboard input, but ideally I wanted it to loop by itself without waiting for the user to respond.