Here's what I am doing: I have a picture with keys on it, with filled-regions over them for buttons. On a mouse button down on one of these, it sets a variable assign to a value representing the key. I have another actor 'Assigning' which has a keydown event->any key, with the following code:
- Code: Select all
switch (assign)
{
case 1:
controlconfig[1] = getLastKey();
break;
case 2:
controlconfig[2] = getLastKey();
break;
case 3:
controlconfig[3] = getLastKey();
break;
case 4:
controlconfig[4] = getLastKey();
break;
case 5:
controlconfig[5] = getLastKey();
break;
case 6:
controlconfig[6] = getLastKey();
break;
}
controlconfig[0] = 1;
assign = 0;
saveVars("config.stp", "config");
controlconfig[0] is used to find if the file config.stp exists. I have a text actor displaying the text of the keys (strcpy(text, getKeyText(controlconfig[1]));) and it displays it fine. But when I click on the play button where it should remap the keys, it obviously does something, because the default keys don't work - neither do the ones I set them to. But if I set any keys back to the default keys, those ones work fine.