• 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!

C++IO?-(With evil,conspirant smile)

Capt. Daniel Wolf

Freebooter
Storm Modder
<img src="style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> Im not gonna reveal the true purpose of my questions, but...:
In the C++ system of POTC... :
Are you able to IO (open, and read in) plain text, or other files in RUNTIME?

Im sure about you can WRITE files like this, because modders made hell lot type of text logging,
even in the first builds. So..... for the dumbest example... Can i somehow open, and display a text files
content ingame? (at runtime) and then modify its content, or create a new one? (with the correct c++ coding of course)

The.... Next level of my question is: as you pretty simple CAN in borland C++ or in any builder:
Does it may possible, to read in a txt format, or other, TYPED file, and write variable values into it, or read them back into memory?(at runtime again)

int my.Ships.Speed = 0.1 , string (or char[n]) my.Favourite.Monkeys.Name = "Jack", etc... lol..
????

I still wont going to reveal my TRUE goals (BWAHAHAHAHAHAAAAAAA!) (Too superstitius yet)
But Im just thinking..... And thats can be lethal sometimes.
 
It is possible to read text from a file, of course, but not to write as far as I know. The only exception being the log files in the main PotC folder, but these can't be READ from the game. So either you read from a file which you cannot write to or you write to a file from which you cannot read. It is, of course, possible to write ingame (like character and ship name), but these are stored as attributes of the character and then saved into the savegame, not in any external file. And I don't think the savegames make much sense if opened in Notepad. So I don't know what to do about this. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
So basically the C++ compiler in POTC are got stripped from some of its main functions... <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> that bad news. Can you tell me who is the absolute expert in Potc c++ here? Maybe we just need to dig deeper-

(the basic goal is: I want to smuggle out data from the game in runtime, and smuggle some back, to modify some variables- I think you starting to get the ridiculous dream of mine... )
 
From the "currently active" modders, I'm afraid Pirate_KK, Maximus and me are the experts. It is a sad thing to have to count myself amongst the experts, because I very much am not an expert whatsoever. But perhaps Pirate_KK or Maximus knows more. Although it has been quite a while since I heard from Maximus; it seems his internet connection has been getting even worse over the last few months, but what I heard from him, he's still working on PotC.
 
Please! Anyone who have a clue about how IO works in POTC C++, write here <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> It would be real nice, to make it happen to put certain variables data into a file, saving it ingame, then load back a file with variables data with maybe... ANother copy of the game... Im sure, u all starting to get, what Im thinking of.... That would be the start of the Unstoppable, Ever-young Potc, If we could make it happen...
 
I got what you were talking about on your first post. It suddenly reminded me of a mod project for morrowind.

I don't really know anything about inputs and outputs in C. As far as I know the only output files we get from the game are the logs.
Just a thery but would it be possible with cleverly named trace calls. A third party program would then copy filtered lines into another persons .c file, which is autoexecuted by the game. Not ideal but it could work. Thing is I don't know what you can but in traces. Is it just text.
 
If POTC C++ still has some stock C++ features, then reading variable data from plain text would bve simple as hell <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" /> Just "find" a line, which is a variables name, then an if, or switch case system founds the variable for that name, then the reading of the file is continues: the data after the variable name text, until a certain "end variable data" caharcter will be converted into float/int/bool/string, and added as a data of the found variable. Eeeee..... : whats a trace call? <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> sounds interesting. gives a little hope
 
I'm talking about trace()
I don't really know how to use them myself. From what I can remember (I used them once) you put something in the () and when it reaches this line its added to one of the log files. I was guessing that you may be able to use it to pass variables to a log file.
 
Well,

the theoretical possibility of saving some data to a text file and reading them later exists, but it would be a hack rather than feature. Of course, we would need a volunteer who would program that in some usable way. That came to my mind a couple of weeks (or rather months) ago when I modified menu interface to include support for Polish language into a game.

I'll explain what I'm thinking about: the games saves current state of options settings (such as keyboard mapping, language setting, wheter to use arcade or reallistic sailing and so on) in <b>options</b> file from main game directory. In fact, that file is simply a dump from ref object. Interface is capable of writing that onto hard disk, reading it back into ref variable, and what's most important, set name and location of the file in respect to main directory.

Imagine that we want to write text <i>Some text</i> into file <b>note.txt</b> on hard disk and then read it back:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void fprintf(string filename, string text)
{
  object rtext;

  rtext.text = text;
  SendMessage(&GameInterface, "lsa", MSG_INTERFACE_SAVEOPTIONS, filename, rtext);
}

string fgettext(string filename)
{
  ref rtext;
  string ret = "";
  SendMessage(&GameInterface, "lsa", MSG_INTERFACE_LOADOPTIONS, filename, rtext);
  if (CheckAttribute(rtext, "text")) ret = rtext.text;
  return ret;
}<!--c2--></div><!--ec2-->

Now, if we use following call:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->fprintf("note.txt", "Some text");<!--c2--></div><!--ec2-->

file <b>note.txt</b> placed in directory with <b>engine.exe</b> would have following content:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->text=Some text<!--c2--></div><!--ec2-->

Later, we would extract that back by using function:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->string t = fgettext("note.txt");<!--c2--></div><!--ec2-->

After that value of <i>t</i> variable would be: <i>Some text</i>.

Of course, I only described here some idea - someone need to code it properly. I'd be more than glad do that, and I hope I'll code it in the future, but I need time for it...

pirate_kk
 
Wonderful news! Anyway, v**agec**turyonline is using the "borrowed" storm engine... They simply copied potc, using the same engine with less detailed models, and simplified sailing and sea battle interface, but they managed to build an MMORPG....... Imagine if we can make a semi-syncronized multiplayer world for two PC.

(No matter, if theres 1691 in one PC, and 1800 in another, or day here, night there, or one completed quest here is never started yet there, just place the same encounter while fighting together, same NPC-s, when being on the same cell, etc.)

Even thats gonna be a revolution: aiding eachother in certain seabattles, fighting together in land. Not as far away as it seems. In the worst case it can be done like they did it in Multi Oblivion: by injecting variables into certain memory blocks via third party program in runtime... And thats the hardest way to do it. Using variable saving, then a third party program which copies files between two network computers can start an interesting experiment. The lame simple battle multiplayer in AOP is not enough for me. This world, this engine is capable for mutch more fun. And that mentioned MMORPG lacks all the good features of POTC. The realism, the detailed ships, the feeling of the sea battle....

Im just starting to learn C++ builder- This year we learned basic DOS based borland C++ ... Next year we going to learn C++ builder all year long. But Im sure It can be done- Sooner or later If im going to be experienced enough, I start to dig up what I can-
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->And that mentioned MMORPG lacks all the good features of POTC. The realism, the detailed ships, the feeling of the sea battle....<!--QuoteEnd--></div><!--QuoteEEnd-->
Our good build...

I agree. Although I fell I have no where near the expertise to attempt this myself I will watch this protect with interest.
 
While I have little idea about any of this, it sounds interesting, and could show much potential. However, my question is, do we (or you rather since I am only good for nothing in this sense) have the manpower and/or experience to fuel such an endeavor?

Then again, what do I know?
 
The first answer is: Its possible. There are at least two ways to do it.
But we need a person who start to play with the code, test, experiment.

At the coming year Im going to learn C++ builder all year long. Which is exactly POTC language, just
the POTC engine is a very basic version, as I see. So full scale network coding, sessions, etc. Is not possible,
but we can start to play with the avaliable text file I/O, and maybe with some third party program which injects data directly into
memory adresses, which the game exe uses, to transfer variables, (data) between the two PC. Like the modders made the Multiplayer for Elder Scrolls IV: Oblivion..... But THATS a hard way <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />.
If someone, me or anyone going to succeed in some primitive data sharing between two copies of POTC in the next school year, then we can think about building up a team to make an enjoyable multi mod. Now its just a theory, but theoretically possible.
 
Back
Top