Is it possible to save inputs in game?and use for ai

i want to make an ai system that depends on inputs i provide when i play the game manually, i mean when i play the game or give inputs manually game saves those inputs with reference to actor location…say i press key at location when i play manually so how can i make the game to remember my input at that location …so that ai can use that input as example so ai character is at the same location ,x, it will provide that , h, input,

You have to make an array of objects that store the location of the input and the input itself, then when replaying ask the AI to go to that location and when there, perform the same action.

HTH