I removed the old SourceForge repo and created a new repo on Github called Zifmia. This has the latest C# code and extensions for Inform 7. The solution is in VS 2013, but the code can be pulled into any project. There is an exception for WinRT/WinPhone. There is one small change in the Engine class I’ll add later as an optional compile block.
Github Repo: github.com/ChicagoDave/Zifmia
There isn’t any documentation at the moment, but it’s pretty simple. In the Zifmia Support.i7x extension you will find channel definition information like this:
Inform 6 code…
Constant FYC_MAIN = (‘M’ * $1000000) + (‘A’ * $10000) + (‘I’ * $100) + ‘N’; ! MAIN
Constant FYC_PROMPT = (‘P’ * $1000000) + (‘R’ * $10000) + (‘P’ * $100) + ‘T’; ! PRPT
Constant FYC_LOCATION = (‘L’ * $1000000) + (‘O’ * $10000) + (‘C’ * $100) + ‘N’; ! LOCN
Constant FYC_SCORE = (‘S’ * $1000000) + (‘C’ * $10000) + (‘O’ * $100) + ‘R’; ! SCOR
Constant FYC_TIME = (‘T’ * $1000000) + (‘I’ * $10000) + (‘M’ * $100) + ‘E’; ! TIME
Constant FYC_DEATH = (‘D’ * $1000000) + (‘E’ * $10000) + (‘A’ * $100) + ‘D’; ! DEAD
Constant FYC_ENDGAME = (‘E’ * $1000000) + (‘N’ * $10000) + (‘D’ * $100) + ‘G’; ! ENDG
Note: You can add your own channels…like this:
Constant FYC_MYCHANNEL = (‘M’ * $1000000) + (‘C’ * $10000) + (‘H’ * $100) + ‘N’; ! MCHN
and later in the extension…
Inform 7 code…
Chapter 4 - Channel Rules
Section 1 - Required Channels
To Select the Main Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_MAIN); -).
To Select the Prompt Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_PROMPT); -).
To Change the Prompt to (T - text):
Select the Prompt Channel;
say T;
Select the Main Channel.
To Select the Location Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_LOCATION); -).
To Select the Score Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_SCORE); -).
To Select the Time Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_TIME); -).
To Select the Death Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_DEATH); -);
[Adding my own channel]
To Select My Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_MYCHANNEL); -);
In your game file, include the extension…you can direct output to any channel (and you can create new channels as you wish)
EXAMPLE:
To send info on mychannel:
select my channel;
say “This text will appear in my channel.”;
select the main channel. [always change output back to the main channel]
There are three ways to use the library code.
-
You can use FyreVM directly and hook up the five events:
LineWanted, KeyWanted, SaveRequested, LoadRequested, and OutputReady. -
You can use the Zifmia wrapper which handles all of the events, automatically saves “blindly” every turn and exposes the results in a couple of properties.
FromHash() returns a Dictionary<string,string> with all of the channels as keys (“MAIN”, “TURN”, “HELP”, etc). The value is whatever content you wrote to that channel.
SaveFile is a byte array of the Quetzal file. This can be used with the SendCommand method to restart the VM, process a command, and have the new results ready. -
Zifmia on a web server. There are two sets of code in the wrapper for creating XML or JSON output. If you want to use the library in a browser, you’d probably uncomment the JSON creation code and use that to return to the client. You could theoretically setup a web service that will run a game. (I’ve done this so I know it works).
If you have any questions, feel free to ask.
Note: The code is still Textfyre copyrighted and corporate commercial use requires a license. Hobbyist use and individual commercial use is freely allowed.
David C.
www.textfyre.com