• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

A `quick-and`-dirty console for POTC

Aronion asked about doing things to a currently running game.
With the amount of screwing up I've done when adding stuff, I've had to do this a lot. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

So here's my method.

POTC doesn't have a console per se, but you can _make_ one. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
I.e. change one of the added keypress functions in seadogs.c
I usually either modify the N or T lines.
Frex:
find
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    if(ControlName == "NK_NameChange")    { ChangeName(GetMainCharacter()); } // NK<!--c2--></div><!--ec2-->
and remove the last brace.
Then, add the new code below.
Then, add the final closing brace } at the end.

save the file, run POTC, load your save, hit n, save, quit, and remove the extra stuff from seadogs.c
(probably best to make a backup of seadogs.c first and then just restore it.)
-----


Now, IIRC AlexusB had a method for doing this even neater:
What he did was, taking advantage of POTC's ability to read new code you can have POTC open in a window and notepad/your IDE in another, and add the code, save the file, then press a key to have POTC read the file and execute the code, then _unload_ the file and be ready for the next time.

example follows:
add key define to controls, "executeconsole" and assign to a key.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->CI_CreateAndSetControls( "", "executeconsole", CI_GetKeyCode("VK_F12"), 0, false );<!--c2--></div><!--ec2-->
Add in one of the Switch(controlname) blocks in seadogs.c (say, the one used for always run and toggle logs):
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->  case "executeconsole":

     if(LoadSegment("console.c"))

     {

   ExecuteConsole();

   UnloadSegment("console.c");

     }

 break;<!--c2--></div><!--ec2-->

and create a file in the PROGRAM folder called console.c that looks like this:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// `Jerry-rigged` console file.

//put code under ExecuteConsole() below.

//NK `04-08`-28



void ExecuteConsole()

{

    Log_SetStringToLog("Executing Console");

}<!--c2--></div><!--ec2-->

Then, add whatever code you want to run above the Log_ line, and you have your own `jerry-rigged` console.

Then, you can have POTC open in a window and console.c in your IDE, and just add the code and save on the fly, then hit F12 in POTC to execute it.
Rinse and repeat.
 
Back
Top