Automatic place char. into keyboard buffer?

Blitz3D Forums/Blitz3D Beginners Area/Automatic place char. into keyboard buffer?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

There is no use in this situation, that's what we've been trying to tell you...

Please study this example:

If DemoMode = True
    Command$ = ReadCommandFromFile() ;Get the next command
    PushKeyboardBuffer( Command$ ) ;Put data into the keyboard buffer
Endif

If KeyDown( KEY_UP )
        Player\Y = Player\Y -1
Endif
...


A much better way to do it would be like this:

If DemoMode = True
    Command$ = ReadCommandFromFile() ;Get the next command.
    Select Command$
        Case "KEY_UP" : PlayerMoveUp() ;Interpret command.
        ...
    End Select
else
    If KeyDown( KEY_UP )
        PlayerMoveUp() ;interpret command.
    Endif
    ...
endif

Function PlayerMoveUp()
        Player\Y = Player\Y -1
End Function
...


Another problem you'll run into if you want to use the keyboard buffer to automate the demo, is that the user can still press keys on the keyboard, and they'll still get put in the buffer along with all your data.