You used to be a cadet officer.
Grats mate!
Thanks very much. I'm now a qualified officer. In real life.
Indeed, if we can program a key and have this key say whatever "this is a new key" then we can really put different functions into it. :mm
Let me give you the code that, in PotC, makes the console function work.
PROGRAM\CONTROLS\init_pc.c add a line:
Code:
CI_CreateAndSetControls( "", "executeconsole", CI_GetKeyCode("VK_F12"), 0, false ); // Activate the console function (hidden from control settings)
PROGRAM\seadogs.c add a line:
Code:
extern void ExecuteConsole(); // NK
In PROGRAM\seadogs.c, find a
void ProcessControls() function with a switch therein.
Add this case:
Code:
case "executeconsole":
if(LoadSegment("console.c"))
{
ExecuteConsole();
UnloadSegment("console.c");
}
break;
Create a new file called console.c and add this code in it:
Code:
void ExecuteConsole()
{
ref pchar = GetMainCharacter();
if (!bSeaActive) ref lcn = &Locations[FindLocation(pchar.location)];
ref ch;
int i;
int limit;
LogIt("Executed Console"); // I'm not sure if CoAS accepts this function call
Log_SetStringToLog("Executed Console"); // If not, try this one
}
If you manage this, you should be able to get the text "Executed Console" to display on your screen by pressing F12.
This is insanely useful, because you can add any code in this file (even in mid-game with windowed mode) and execute it.
Useful for cheating and modding.
The same needs to be repeated for the reinit function,
except there's a whole bunch of other additional stuff you need to do.
So that's for another day.
If you have the PotC Build Mod files, search for "reinit" in the PROGRAM folder.
Pay particular note of PROGRAM\Reinit.c.