Hi Enrico,
Does your paradigm really allow multiple responses on a single stimulus? Your script checks the value of the latest response, which would be over-complicated in case the maximum number of allowed responses is 1. Also, if there are no responses, your script will fail because it tries to read the value of the last element of the response array, which will not exist if there are no elements! So, to simplify the script you should use TResp.RESP instead of TResp.Responses(TResp.Responses.count).resp.
Also be aware that comparison will be case sensitive. And instead of using if-then, you could use Select-Case. Combining it all together:
Select Case UCase$(TResp.RESP)
Case "S"
Trisp=1
Case "L"
Trisp=2
Case ""
Trisp=3
Otherwise
Debug.Print "Unexpected reponse: " & TResp.RESP
End Select
Or combining the other lines as well:
Dim code as Integer
Select Case UCase$(TResp.RESP)
Case "S"
code = 51
Case "L"
code = 52
Case ""
Otherwise
Debug.Print "Unexpected reponse: " & TResp.RESP
code = 0
End Select
if code>0 then