File IO

Using the File IO function pack you can write and read from the text-files on your virtual Hack Wars computer. These functions were released along with powerful new functions for editing the content of your web-site, you can now dynamically replace page-content. An example of the File IO functionality follows.

replaceContent(String key,String Content): Replaces the content represented by key in your HTML page with the new content, e.g.,

Test.txt on HD

Some Content<br />
Some More Content

Your Web Page:

<html>
<body>
<?key1?>
<?any_string?>
</body>
</html>

Your HTTP Script:

replaceContent("key1",readLine("Test.txt",0));
replaceContent("any_string",readLine("Test.txt",1));

Output for Visitor To Page:

Some Content
Some More Content

This new functionality is made much more powerful when combined with the file IO functions allowing you to store sections of your in-game website to disk.

string fetchGetVariable(string key): Using this function you can extract variables from the get string of a web-site request, e.g.,

someone types in: 192.168.2.002?var1=hello&var2=goodbye

HTTP Script:

fetchGetVariable("var1"): Returns "hello"
fetchGetVariable("var2"): Returns "goodbye"

For a full function listing see the API section of the manual under the section File IO.

Note that you can do some pretty powerful things with File IO, some ideas:

  • Text-based adventure games.
  • CMS system for your website.
  • A system for remotely administrating your computer.
  • The file IO pack costs a one-time payment of $5, look for both in the new 'Shop' section of the web-site, and enjoy.