intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Jan 19, 2019 4:55 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 82 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9  Next
Author Message
 Post subject: Re: Dialog
PostPosted: Thu Jan 10, 2019 8:13 am 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
Mikawa wrote:
Is it possible in Dialog to let the player type his name and then store the input in a $Variable to print it out later?


Yes, this can be done with (get raw input $). This gets you a list of single-character words, but at the moment there is no library predicate for printing it back. I should add that. Meanwhile, you can use this:

Code:
(print chars [])

(print chars [$First | $Rest])
        $First
        (exhaust) {
                *($Char is one of $Rest)
                (no space)
                $Char
        }


Here's how you could use it from within a predicate:

Code:
(intro) 
        What's your name? > (get raw input $Name)
        Hello, (uppercase) (print chars $Name)!


But you presumably want to print it from a different predicate. Then you also need to store it in a global variable, which is slightly cumbersome. You need to specify a maximum length, which is 63 characters in the example below (+1 for the list itself).

Code:
(current player #me)
(room #room)
(#me is #in #room)

(global variable (current name $) 64)
(player's name)
        (current name $Name)
        (uppercase)
        (print chars $Name)

(intro)
        What's your name? > (get raw input $Name)
        (now) (current name $Name)
        Hello, (player's name)!

(descr #me)
        You are (player's name), as good looking as ever.


Currently, '(uppercase)' only affects a single letter, i.e. the first letter of the name. It would be possible to modify the '(print chars $)' routine to capitalize each word, by detecting space characters.

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Thu Jan 10, 2019 9:46 am 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
Oops, it turns out that in version 0c/04, '(uppercase)' doesn't work properly with dictionary words. That's coming soon, though.

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Thu Jan 10, 2019 11:47 am 
Offline

Joined: Mon May 10, 2010 7:32 am
Posts: 66
Thanks for the quick response. In the meantime I came up with the same solution as proposed, but then got stuck at trying to print it out with first letter in capital.
BTW: it's me who's looking into a german translation of Dialog and I would estimate it as 90% done. There weren't any serious obstacles in the way, as far as I can tell. One additional feature might be a built in predicate to replace certain letters in input before parsing. Speaking for german this would be e.g. replacing all 'ß' with 'ss' or replacing 'ä' with 'ae'.
This could be handsome for some lazy typing germans who don't know the difference between 'ß' and 'ss' or for some german dialects like swiss-german who have other conventions concerning 'ß' or for some german speaking guys in foreign countries who don't have a german keyboard handy and therefore have troubles in typing 'ä'.

:-)


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Thu Jan 10, 2019 5:18 pm 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
Version 0c/05 library 0.17 is out now (download link).

This is a minor update based on feedback. Thanks for voicing your opinions!

  • Support for .z5 output format.
  • Bugfix: '(uppercase)' now works properly with dictionary words.
  • Library: Better default messages when trying to look in a direction with no exit.
  • Library: Added a plural variant of the "That's part of ..." message.
  • Library: Minor performance tweak.
  • Library: Default '(intro)' also tries to look around in the initial room.
  • Docs: Some small corrections, and information about using the .z5 format.

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Fri Jan 11, 2019 12:45 am 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
And here's an extra update for the library: Version 0.18.

I've added a predicate for printing back raw input, like we discussed a few posts back. It's called '(print raw input $)' now.

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Sat Jan 12, 2019 7:05 am 
Offline

Joined: Mon May 10, 2010 7:32 am
Posts: 66
Thanks, it works fine! :-)


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Sat Jan 12, 2019 11:47 am 
Offline

Joined: Mon May 10, 2010 7:32 am
Posts: 66
In case you wanna eat an object which is edible but not an item you get no answer.
I'll suggest to make all edibles also items (item $Obj) *(edible $Obj).

Edit: you *do* get an answer it was my fault, but making all edibles also items is nonetheless an option.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Mon Jan 14, 2019 3:53 pm 
Offline
User avatar

Joined: Fri Jul 11, 2014 12:50 pm
Posts: 125
Regarding the translation of Dialog. One would have to copy the entire standard library? And if the library is updated, one would have to copy back the modifications in the translation? Or is there a system like Inform 7's responses?

Thanks!

_________________
Maintainer of the Inform 7 French extension


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Tue Jan 15, 2019 2:39 am 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
Yes, one would have to maintain a translated version of the library, and keep it up to date.

Inserting an extra layer of indirection into the design would make the library code less readable for authors. Consider the following pair of rules:

Code:
(understand [wave | $Words] as [wave $Obj])
        *(understand $Words as object $Obj preferably held)
 
(perform [wave $Obj])
        You wave (the $Obj) in the air, with no apparent consequences.


The word "wave" appears as user input, as the internal name of an action, and inside the response text.

In order to separate the logic from the response message, one could move the message into a secondary rule. It could be called (default message for waving $Obj), or (narrate waving $Obj). But this attempt to disentangle the library code from the English language fails, rather spectacularly, because now we've added the English word "waving" to the mix.

The narration predicates for the 18 core actions do represent such a layer of indirection. Here it makes sense because the logic of those actions is sufficiently complex. But in a translated library, the internal action names would probably also be expressed in the target language, and so would the core actions, and the names of their narration predicates.

Translation is an inherently complex task. Translating a work-in-development is even more heroic. I strongly recommend working with diff-tools such as meld, which would take care of the non-texty bits of code automatically. Even so, there will be lots of manual maintenance work involved, and there will always be subtle differences between the various translations and the original. As in any translated work.

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Dialog
PostPosted: Tue Jan 15, 2019 6:39 am 
Offline

Joined: Mon May 10, 2010 7:32 am
Posts: 66
Natrium729 wrote:
Regarding the translation of Dialog. One would have to copy the entire standard library? And if the library is updated, one would have to copy back the modifications in the translation? Or is there a system like Inform 7's responses?


Speaking for german I can say that a german translation is far more complex than just to translate the standard answers to actions. I had to adjust parsing and dictionary rules as well and this can only be done be replacing queries. So it could be a point worth discussing whether the english standard answers could be moved to another file maybe called "responses.dg", but this would not prevent the work in the main file, which has to be updated when the english pendant is updated too. But this seems to contradict the concept of simplicity which makes "dialog" really interesting.

For now, I used Visual Studio Code, I compared the old english lib with the new one every time it was updated, so I could relatively easy find out the changes and implement them into my translation.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 82 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group