I’ve managed to built the apps from the GitHub repo and having pretty good success to this point, mostly. I’ve got wrappers for Python and .NET (for use in an experimental Unity 3D project), and it really works great. I’ve read the “Calling Inform From C” section in the manual, and have implemented most of the functions.
BUT, and this is driving me nuts, I can’t seem to find the right combo to get the actual LOCATION/ROOM of an instance/person, for example, “i7_I_Somebody”, using either “i7_read_prop_value” or even combinations of “i7_read_variable”. I can get values of defined properties of i7_I_Somebody, just not their location, and I’m not sure what I’m missing. (I know it must be simple.)
That’s accomplished by the location of phrase which you can see in the Standard Rules is defined with inline I6 as LocationOf. It looks like this isn’t in the documentation, and I haven’t tried it personally, but looking at compiled C output, it seems like the names of I6 functions from Kits get transformed by prepending I7_fn_ (but now the first parameter is a pointer to an i7process_t) so it would be I7_fn_LocationOf.
OK, if you use inform7 -format=C/symbols-header you get an inform7_symbols.h file that lets you see what symbols are available. And if you include that in your C program, it will be the case that you have access to Inform 7 phrases with the names transformed per Calling Inform from Cexcept for things defined as inline I6, like location of, where you have no choice but to look up the inline I6 and do as I described above. The docs do tell you that phrases defined with inline I6 won’t work, but doesn’t tell you what to do about it. This was probably deliberate: the I6 layer has always been defined to be subject to change without notice.
Zed, thanks ! I SAW that function down there in the file, but was leery of straying initially from the docs :). I’ll give it a try tomorrow and let you know. If it works, now I know what to do with all of those other functions listed around it !.
I definitely will. My plan is to get a simple example workflow up on GitHub in the next couple of weeks.
I do go back to the early days of IF (yes, I’m THAT old.) I used to play around with TADS, and it is extremely powerful, but as a developer, it was TOO LITTLE like C++ and TOO MUCH like C++, if that makes any sense, and I eventually got frustrated. A few months ago, I started digging into Inform and fell in love with the natural language aspect of it.
I have an autistic teenager and so while he’s a whiz at Xbox/Switch etc, reading comprehension is usually a challenge for kids like him, and I wanted to create something that bridged those 2 worlds. And when I saw Graham’s big announcement, and read “It enables entirely new developments, from peephole optimisation and other compilery recreations to the ability to have Inform compile its natural-language source down to C code: this in turn can then be compiled by clang or gcc to a stand-alone executable, or to code which can be linked into Unity projects, iOS apps or similar. It thus becomes possible, and we hope even convenient, for choice-based games for console, mobile or desktop to use Inform, if they wish, purely for world-modelling, conversation, or dynamic text generation.”, the light bulb went off.
So I’m deep-diving Inform7 from the official docs, this forum, the Handbook from Jim Aikin, and even the 2011 Inform for Programmers from Ron Newcomb. I’m not an expert in I6 at all, but I have a feeling I’m going to need to be.
Just to add, so far, wrapping the basic functions in “Calling Inform from C” seems to be going well, and Instance IDs, Enumerations, Kind IDs, Action IDs, and Property IDs, and for the most part, Variable IDs, it’s where I get to the Function IDs that I’m starting to struggle a bit, but I just started that part.