Dialog

Dialog is a domain-specific language for creating works
of interactive
fiction. It is heavily inspired by Inform 7 (Graham Nelson et al. 2006) and Prolog (Alain Colmerauer et al.
1972).

An optimizing compiler, dialogc, translates high-level Dialog code
into Z-code, a
platform-independent runtime format originally created by Infocom in 1979. Since
Dialog version 0d/01, there's also an interactive debugger.

Notable works

Discuss this page

Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.

This is odd. I get the same error when running the first example in chapter 5. I'm running the win32 version of dialogc on Windows 10, in case that matters.

EleasBjörn PaulsenFri 14-Dec-2018 12:44

I've now checked each release of the compiler, and found that moving between rooms only works under release 0b/01. Later than that leads to the fatal error described above.

AnonymousFri 14-Dec-2018 13:18

Eleas wrote:

I've now checked each release of the compiler, and found that moving between rooms only works under release 0b/01. Later than that leads to the fatal error described above.

Not sure if it's related but I only get the error when using Gargoyle. Frotz doesn't give the error. (latest versions Windows 10)

EleasBjörn PaulsenFri 14-Dec-2018 13:54

Not sure if it's related but I only get the error when using Gargoyle. Frotz doesn't give the error. (latest versions Windows 10)

Thank you. Can verify. Does anyone know the best way to pass a bug report to one of the maintainers?

lftLinus ÅkessonFri 14-Dec-2018 14:47

This looks like a Dialog bug. Thanks for reporting; I'm on it!

lftLinus ÅkessonFri 14-Dec-2018 15:36

Fixed in 0c/04.

AnonymousTue 18-Dec-2018 13:05

Can I reference an object variable from within the scoring options?(increase score by (#object variable))

lftLinus ÅkessonTue 18-Dec-2018 14:14

Can I reference an object variable from within the scoring options?(increase score by (#object variable))

As a general rule, queries can't be nested; they don't even have return values.

(Confusingly, rule heads may contain nested expressions, but that is a special case of syntactic sugar.)

But output can be communicated using ordinary parameters. To take the output from one query, and use it as input in another, you would write the queries one after the other. Then you'd use a variable to carry the value.

Assuming you have a predicate ($ has score $) that assigns a score to every object:

(#object has score $X) %% Here, $X becomes bound (i.e. to the output). (increase score by $X) %% Use the value of $X as input.

mstramSun 3-Feb-2019 08:01

The following code crashes the compiler

If I substitute the (else) with (if), I get a more reasonable message : "Error (if) without (then).

** The comment editor seems to strip away the indentation ... does it accept some kind of 'markup' ? (I.e. the second line (else) *was* indented.

Also I had much more in the source file, I isolated the crash down to these two lines.

Assertion failed!

Program: c:\bats\dialogc.exeFile: backend_z.c, Line 3348

Expression: call_lab

--------------------(story title) (else)

mstramSun 3-Feb-2019 08:15

The actual 'realistic' use case for the above was that I had accidentally "not-escaped" the title i.e.(story title) ( Else) test fileinstead of

(story title) \(Else \) test file

lftLinus ÅkessonSun 3-Feb-2019 08:54

Thanks! I'll fix that.

There's currently no tag to retain formatting in the comments; sorry for that. I've been using hardspaces to get around it. I suppose I'll fix that too.

mstramSun 3-Feb-2019 09:39

Are global flags (or maybe it's the (now) predicate) designed to work in "open code" (like global variables?

If I put :

(now)(a-global-flag) in "open code", I get :

"Special syntax cannot be redefined"

Mike

lftLinus ÅkessonSun 3-Feb-2019 21:54

mstram wrote:

Are global flags (or maybe it's the (now) predicate) designed to work in "open code" (like global variables?

If I put :

(now)(a-global-flag) in "open code", I get :

"Special syntax cannot be redefined"

Mike

Anything that starts in the very first column of a line is interpreted as a rule definition, so the compiler thinks you're trying to define a rule for a predicate called '(now)'. But that's special syntax, so its behaviour can't be modified.

If you would like the global flag to be initially set, define a rule with an empty rule body:

(a-global-flag)

This is analogous to how the initial values of other kinds of dynamic properties are defined. For instance:

(#box is #heldby #player)(#box is open)(current player #player)

mstramMon 4-Feb-2019 00:24

Ok, thanks, that works ... but ...

The "first-column-global" (fcg ? :)) is not showing up in the debugger's @dynamic output.

The flag *does* work though (of course),if I enter(a-global-flag), giving the expected "Query succeeded:(a-global-flag)

The @dy(namic) cmd seems to be only finding global flags that are referenced inside a rule :

(test)__ (now)(a-global-flag)

Mike

lftLinus ÅkessonMon 4-Feb-2019 15:02

mstram wrote:

The @dy(namic) cmd seems to be only finding global flags that are referenced inside a rule

That is correct. A predicate is only considered dynamic if it appears in a (now)-statement somewhere. So, if there's a (now) (a-global-flag) somewhere, then (a-global-flag) is regarded as a boolean variable that can be toggled at runtime. And its initial value is determined by the rule definitions for it. Otherwise, it behaves more like a boolean-valued function, and the rule definitions make up its function body.

It's a matter of terminology. Something that can change is dynamic, but something that cannot possibly change is not.

mstramWed 6-Feb-2019 11:12

This crashes both the windows and linux-64 compilers, version 0d02_0_19, and 0e01_0_20,but NOT the 0c05_0_17 version

#gnue(name *) gnue(dict *) plane(vehicle *)

Again it's only a code fragment, but I was trying to split a larger program into multiple files.

Mike

lftLinus ÅkessonWed 6-Feb-2019 20:10

Thank you! I can reproduce it. Amusingly, I can get the program to compile by adding a room:

(room #x)

But it's still a compiler bug, of course, and I'll fix it as soon as possible.