I'm trying to find the best way to auto-scroll text at a speed that's suitable for the user. I don't think using my own experience is the right way to go about it because of some of the same reasons you need an editor when you write - you think you know what you wrote and you skim it without actually reading it in real time.
So the problem is how long to delay text before the next thing is added.
What I landed on is letting the user enter a number in milliseconds (per character of text) that the text is displayed.
Also, important things have a built-in pause that happens no matter what.
So if you get a point then it pauses for a second PLUS whatever time the user has entered.
Because the text-length can vary and changes get made that make the text longer or shorter, whatever I think is an appropriate pause may be way too long or way too short for any given user.
In the below, you can ignore it all to the very end where this is implemented. I think it's a good system but if there's a better way I'd love to hear about it.
So how it works is that it's ms/character.
If the setting is 2 and the length of the text is 100 characters then it will pause for 200 ms before the next thing.
Make sense?
This is the code:
Code:Public Sub AddPlayerMessage(ByRef TextToAdd As String, Optional ByRef AdditionalPauseInMS As Long = 0, Optional ByRef ShowInAuxWindow As Boolean = False) Dim m_CallStacker As New cCallStacker Dim nDieSides As Long m_CallStacker.Add NAME & ".AddPlayerMessage(Public Sub)" If fLoading Then Exit Sub If SeeMoreDieRolls Then nDieSides = 10000 Else nDieSides = 2000 End If If Int(Rnd * nDieSides) + 1 = 1 Then Flicker frmCallstackGame.txtMessage, Int(Rnd * 2000) + 1 If (ShowInAuxWindow Or fGamePaused) And frmAuxilliaryMessage.Visible Then frmAuxilliaryMessage.AddPlayerMessage TextToAdd Exit Sub End If If fGamePaused Then Exit Sub With frmCallstackGame.txtMessage If Len(.Text) >= 30000 Then .Text = Right$(.Text, 500) End If .SelStart = Len(.Text) .SelText = vbCrLf & TextToAdd .SelStart = Len(.Text) End With If GameDelay + AdditionalPauseInMS > 0 Then Sleep (GameDelay * Len(TextToAdd)) + AdditionalPauseInMS End If End Sub




Reply With Quote