ZIL Coding

Clearly the ZILF compiler should be written in ZIL.

1 Like

Well, C# is the #6 language on GitHub by number of contributors (higher than C and Ruby), so I’m not worried about a shortage of people willing to work in C#. But if it’s a problem for you, hey, don’t worry, you can still contribute to the project without writing any C#. There’s plenty of work to be done on documentation (English/Sphinx/Python), IDE integration (JS/TypeScript), and of course the game library (ZIL/MDL).

I’d like to hear more about the problems you’ve encountered trying to open the project, though. ZILF is currently developed with the community edition of Visual Studio 2017, so you should be able to load and build it. I think the project even works in VS Code.

Note that you can also file reports in the issue tracker at vaporware.atlassian.net/.

That’s a shame, since as you said, C# really is a very nice language. On top of that, Visual Studio and VS Code are also very nice development environments. I doubt the projects would have gotten this far along if I hadn’t used the tools with which I’m most productive.

I was also a Microsoft basher, many years ago… whatever, I get it. But the reaction some people have to everything .NET-related is over the top. Today, Microsoft’s .NET tools and libraries are all open source, developed under the MIT, BSD, and Apache licenses. You can probably run ZILF with an old version of Mono (from before MS bought Xamarin) if you really don’t want to touch any code that originated in Redmond.

Probably MDL, since ZIL is basically a superset of MDL anyway, and that’s how ZILCH was written.

There’s a modern reimplementation of MDL, Confusion, that works well enough to run Zork, so with some more hacking, it could host a compiler. Or you could fire up a PDP emulator and run a genuine MDL interpreter.

But that’s even more niche.

Of the languages you listed, the only ones I’d consider sensible alternatives would be C/C++ and Python. If you’re considering Java, you may as well use C#. If you’re considering a niche language like Clojure, you may as well use MDL. And if you’re considering Go, you probably work at Google, so you shouldn’t start any project without approval from the lawyercats anyway.

I killed off a whole bunch of my public projects due to lack of public interest. I just restarted Learning ZIL on GitHub and Blogger though if anyone here is interested.

Man, if I did that, I wouldn’t have any projects left.

1 Like

Haha. They all still exist on my laptop. Learning ZIL is the only one I’m actively working on right now so I restarted the public face of that. I may back up the rest as private repositories soon.

I’d love to be able to sort projects on git[hub|lab] into categories… one of which would be “dead projects”.

It’s worth taking another look now, I think. I’ve migrated the projects to .NET Core 2.2 in preparation for the next release, and now running ZILF from a fresh checkout is as easy as cd Zilf; dotnet run whether you’re on Windows, Mac, or Linux. (It also works out of the box with VS 2017 or VS 2019.)

1 Like

Both Github and Gitlab let you archive projects, making them read only. Not sure if that’s really what you mean though.

I’ll see if I can fix that.

EDIT: Didn’t realize that message was from years ago, but I think .zil should be an acceptable file-type to upload now.

image

2 Likes

Thank you! :slightly_smiling_face::+1:

Help, Please
Just getting started in learning ZIL and need to be able to override the “PLAYER” object in the default parser file. Without just amending the parser file (which would be a pain to do for every game) is there any way to replace this existing object with a newly defined one outside of the parser.zil file? (wasn’t sure this was the best place to ask the question but could not find a Q&A section) - Many thanks AG

1 Like

What do you need to change about it? That can affect the answer.

1 Like

Hi Daniel - Thanks for the reply. I want the player to change during the course of the game. For example in one scene the player could be a sailor, in the next a female doctor, in another an animal (cat, dog etc) and in each case verbs like examine, diagnose, etc would return different responses.My first attempt just changed the PLAYER-F action routine to achieve this but this still meant making changes to the Parser File. I was wondering if there was a way to do it without altering the parser file. I tried <REPLACE-DEFINITION PLAYER-F <ROUTINE PLAYER-F() …> But (although it compiled) it still used the PLAYER-F in the parser file.

The best way to do this is probably to make a separate object for each player-character and switch between them, which you can do by replacing the RESET-WINNER section via REPLACE-DEFINITION.

ZIL doesn’t have a notion of “current player” by default. It uses the optimistically-named variable WINNER to keep track of which actor is performing the current action. That’s almost the same as “current player”, except when you’re giving an order: in the command “bear, follow me”, WINNER is set to the bear before performing the “follow me”.

So, the library needs to be able to check whether you’re in the middle of giving an order, and reset WINNER after you’re done giving the order, which it does using two functions in a replaceable section in parser.zil. The default definitions are macros that assume PLAYER is the only player object:

<DEFAULT-DEFINITION RESET-WINNER
    <DEFMAC RESET-WINNER ()
        '<SETG WINNER ,PLAYER>>

    <DEFMAC ORDERING? ()
        '<N=? ,WINNER ,PLAYER>>>

The easy solution would be to add a global variable like CURRENT-PLAYER, set it at the beginning of each scene, and then use CURRENT-PLAYER instead of PLAYER in your replacement section.

1 Like

Or ironically-named, maybe. I always got the impression that “winner” was 1970s-era MIT slang to call someone a “loser” with sarcastic inversion.

Sorry, tangent…

3 Likes

Notably, this is what Zork 1 does, though I’m not sure why: PLAYER is actually a global variable, which is set to the object called ADVENTURER at the start of the game and then never changed.

Their source code agrees with you. (For anyone who doesn’t speak ZIL, this is creating the default player object, and giving it the printed name “cretin”.)

“Cretin” is also a recognized synonym for “me”, and the routine that handles actions with the player as direct object is named CRETIN-FCN. One gets the sense that these descriptions were never meant to be shown to the player, but in some corner cases it can happen (such as ENTER BUCKET. OPEN BUCKET. in some versions of Zork 2, which produces “Opening the bucket reveals a cretin.”).

3 Likes

Thanks for your response Jesse - This works like a charm. I have replaced the Reset Winner definition and created a global variable called current-player which currently only holds my new player defined outside the parser.zil file. This then calls its own new-player-f routine with the logic to print results based on character type (sailor, dog etc…) and all seems to be working perfectly. Really appreciate the responses - keep up the work. Got back into this after seeing that the Infocom source had been released and had the urge to try to “write like an Implementer”. I did try I6 a while back and then had a go at I7 but I am finding I am enjoying learning ZIL (ZILF) much more! /AG

3 Likes

(To clarify, since I just realized this was unclear but now someone else has responded so I don’t want to edit: there are two “player” objects in Zork 1. One of them, ADVENTURER, is the person who goes around performing actions. The other, ME, is always in scope and is used as a direct object for verbs. The global variable ,PLAYER is set to the ADVENTURER when the game begins, and then never reset or changed later; all code that cares about player-vs-others compares ,WINNER against ,PLAYER rather than ADVENTURER.)

(The use of a ,PLAYER global was imitated by Inform, though separating out ADVENTURER and ME was not.)

3 Likes

Seems likely. I’ve been assuming it’s a direct reference to “loser” and an indirect reference to “user” (i.e. luser).

Edit: Although, as long as I’m looking at the Jargon File… it seems winner had non-ironic usage too.

2 Likes
>ENJOY LEARNING ZIL

I can't see any "enjoyment" here.
2 Likes