ديسكورس فوترز 🧙

واو، إضافة جديدة! :tada: هذه الإضافة أقل جدية قليلاً. :video_game:

Discourse Frotz


\u003csup\u003eلم يعد من الضروري ذكر البوت (@mention) في كل خطوة. بمجرد بدء اللعب، ما عليك سوى الرد عليه.

مستودع Git: GitHub - merefield/discourse-frotz: A plugin that uses Frotz to give you an interactive fiction experience on your Discourse forum · GitHub

ما هي هذه الإضافة؟

إنها ‘بوت’ يتيح لك لعب القصص التفاعلية (أي ألعاب المغامرات النصية الكلاسيكية) على منتدى Discourse الخاص بك، وهي في الأساس أداة ربط لمفسر Z-machine القياسي والمذهل المسمى ‘frotz’ الموجود في David Griffith / frotz · GitLab

كيفية الاستخدام

تضيف الإعدادات لعبتين، ويمكنك إضافة المزيد من خلال الإعدادات.

تحتوي كل إدخال على عنوان واسم ملف القصة.

لبدء التفاعل، تحتاج إلى ذكر البوت المحدد في الإعدادات (@mention). بعد ذلك، يكفي الرد على منشور من منشورات البوت.

للعرض قائمة بالألعاب المتاحة، يجب عليك أولاً ذكر البوت وطرح السؤال التالي:

@mybot list games

سيظهر لك هذا مجموعة الخيارات المتاحة.

لبدء لعبة، اكتب:

start game x مع استبدال x برقم الخيار.

إذا أردت التبديل إلى لعبة أخرى، يمكنك ذلك؛ حيث تحفظ الإضافة تقدمك في كل حركة، مما يسمح لك بالعودة إلى القصة الأولى في أي وقت. تحتفظ الإضافة بحفظ لكل قصة لكل مستخدم يجربها.

لمتابعة لعبة قائمة، اكتب:

continue game x مع استبدال x برقم الخيار.

ملاحظة: إعادة البناء الكاملة ستدمر جميع ملفات الحفظ. هذا حل وسط ضروري.

كيف ألعب لعبة قصص تفاعلية (IF)؟

كثير من “الميتات” (Meta’s) نشأوا مع هذه الألعاب. لأولئك الأقل دراية بها، تحقق من هذه ورقة الغش: Play Some Interactive Fiction

الإعداد

إنشاء مستخدم البوت

(عذراً، أتمتة هذا الإجراء مدرجة في قائمتي!)

في جلسة SSH، أدخل الحاوية الخاصة بك وافتح وحدة تحكم Rails:

\n./launcher enter app\nrails c\n\n

ثم قم بما يلي:

\nu = User.create!(username: "Frotz", name: "FrotzBot", id:-5, email: "not@really.valid")\nu.activate\n\n

سيصبح البوت الجديد متاحاً للإعداد من خلال واجهة المستخدم. انتقل إلى إعدادات المستخدم في الواجهة عبر زر المسؤول وقم بإيقاف جميع عمليات الإرسال عبر البريد الإلكتروني. قم بتحديث الصورة الرمزية حسب رغبتك.

تثبيت Discourse Frotz

تحديث ملف app.yml الخاص بك

هذا الإجراء أكثر تدخلاً من الإضافات المعتادة.

أضف التالي إلى ملف app.yml:

\nhooks:\n after_code:\n - exec:\n cd: $home\n cmd:\n - git clone https://gitlab.com/DavidGriffith/frotz\n - exec:\n cd: $home/frotz\n cmd:\n - make dfrotz\n - exec:\n cd: $home/frotz\n cmd:\n - mkdir savegames\n - exec:\n cd: $home/frotz\n cmd:\n - mkdir stories\n - exec:\n cd: $home/frotz/stories\n cmd:\n - wget -O zork1.z3 https://eblong.com/infocom/gamefiles/zork1-r119-s880429.z3\n - exec:\n cd: $home/frotz/stories\n cmd:\n - wget --no-check-certificate http://www.douglasadams.com/creations/hhgg.z3\n - exec:\n cd: $home/plugins\n cmd:\n - git clone https://github.com/merefield/discourse-frotz\n\n

قبل إدخالات الإضافات الأخرى الخاصة بك.

ستحتاج أيضاً إلى إضافة إضافة Discourse BBCode!!

أعد البناء باستخدام الأمر المعتاد ./launcher rebuild app

الآن انتقل إلى إعدادات الإضافة واختر مستخدم البوت الذي أضفته سابقاً:

image

القصص

ستلاحظ أنني أضفت بضع قصص. يمكنك العثور على المزيد في https://ifdb.tads.org/.
ومع ذلك، انتبه لحدود المعدل هنا! قد يؤدي الحصول على عدد كبير جداً من القصص من نفس الموقع إلى حدوث خطأ.

لاحظ أيضاً أن القصص ليست مستضافة على خوادم محمية بـ HTTPS (توت توت).

إذا أصررت على تحميل المزيد، أضفها إلى ملف app.yml. يمكنك أيضاً إضافتها يدوياً من موجه الأوامر، لكن اعلم أن هذه ستُحذف عند إعادة البناء الكاملة التالية.

تمكين FrotzBot للرسائل الخاصة (يُنصح بالحذر)

يسمح للمستخدمين باللعب بشكل خاص، لكن الاستخدام سيكون أقل شفافية. إذا كان لديك خادم كبير بما يكفي، فقد لا يكون هذا مشكلة بالنسبة لك. في أي حال، كن على دراية بتأثير ذلك على السعة. كبديل، شجع المستخدمين على اللعب في فئة مخصصة.

image
الافتراضي: OFF

إذا لم يكن البوت مفعلًا هناك، فسيحصل المستخدم على رسالة مهذبة:

تقييد FrotzBot حسب الفئة

يمكنك تقييد البوت على (قائمة) فئة لتجنب ملء المناطق الأخرى:

اختصارات لوحة المفاتيح!

هذا أمر بالغ الأهمية لتحسين تجربة “اللعب”. وفي الواقع، ما عليك سوى تذكر اختصارين:

  • \u003ckbd\u003eShift\u003c/kbd\u003e-\u003ckbd\u003eR\u003c/kbd\u003e للرد على البوت

  • \u003ckbd\u003eCtrl\u003c/kbd\u003e-\u003ckbd\u003eEnter\u003c/kbd\u003e لتقديم حركتك التالية

القيود والاعتبارات

لا يتم دعم جميع صيغ القصص والألعاب بعد، ومن غير المرجح أن يتم دعمها. هناك العديد من الألعاب التي لا تعمل بسبب طبيعة بروتوكولات الاستدعاء والاستجابة الخاصة بها. وبسبب الطريقة التي نتفاعل بها عبر المنشورات، يجب أن نطلب من Frotz حفظ الحالة بعد كل حركة. إذا لم تؤدي إحدى خطوات اللعبة إلى موجه يمكن للنظام عندها الحفظ (مع تجاهل موجهات “اضغط أي مفتاح” أو “المزيد” التي يجب معالجتها)، فلن تعمل القصة. على سبيل المثال، في لعبة “Act of Murder” (لعبة رائعة!)، تسأل السيدة عند الباب عما إذا كنت شرطيًا. للأسف، هذه حالة في اللعبة لا يمكن حفظها، وبالتالي تفشل في هذا الشرط، ولا أرى طريقة لجعل ذلك يعمل.

ملاحظة: وضع قائمة البريد الإلكتروني هو كارثة مع هذا، لذا تأكد من عدم استخدامه قبل محاولة استخدام هذه الإضافة!

يمكن القول إنها تهدر موارد المنتدى قليلاً لأنها تتطلب منشورين على الأقل لكل “حركة”. من الواضح أنه غالباً ما يكون أكثر ملاءمة للعب هذه الأنواع من الألعاب باستخدام واجهة دردشة بدلاً من منتدى، لكن يمكنك القول إن هذا يمكن استخدامه لإنشاء أدلة الحل (Walkthroughs)؟ :wink:

لحل أقل تدخلاً، ضع في اعتبارك: Turning a topic into interactive fiction ;)

التعليقات

كل التعليقات موضع ترحيب!

الاعتمادات

تستغل هذه الإضافة David Griffith / frotz · GitLab وهو مفسر Z الخاص بـ Frotz والذي يتم نسخه وإنشاؤه بواسطة برنامج الإعداد.

شكراً لـ @P16 على السماح لي باستخدام مقتطفات من كود لبوت دردشة مغلق المصدر عملنا عليه معاً.

45 إعجابًا

Wooah, back again!

New Feature-rettes

Enable FrotzBot for private messages (at your peril! :wink: )

Allows users to play in private, but usage will be less transparent. If you have a big enough server this may not be an issue for you.

image
default: OFF

If (s)he is not enabled there, the user will get a polite message:

Restrict to a list of Categories, or allow all:


default: ON for all Categories

10 إعجابات

Hi Robert! Thank you, I really like this plugin !
I tried to install it on dev environment (without docker) and my system asked for the ncursesw lib when making dfrotz, after installing that it worked, will it be the case with a prod env with docker?

إعجاب واحد (1)

I tested on Production and building on Docker (to my surpirse) worked out of the box. Feel free to deploy to a Production instance and let me know how you get on.

Glad you like it!!

إعجابَين (2)

For those like me, who might loose their last few hairs about that:

hhgg.z3,9,7,3
that’s :

  story_header_lines = 9
  story_load_lines = 7
  story_save_lines = 3

and now, how to adapt it… :sweat_smile:, that’s an adventure inside an adventure…!

إعجاب واحد (1)

I’m currently working with the maintainer of Frotz to see if we can do away with those. It’s an approach I ported from restful-Frotz but hardly perfect :slight_smile:

إعجاب واحد (1)

Yes ! found it !
kheper.z8,20,15,4 almost works
for this one :

:smiley:

it’s nothing, but there is something weird

) Line-type display OFF
Compression mode MAX, hiding top 0 lines

is displayed once by Pause() with

[Pause notNeeded;
@read_char 1 notNeeded;
rtrue;
];

إعجاب واحد (1)

Ha, yeah, there are lots of quirks and a considerable amount of variety in the stories. I cannot promise to support all.

Right now my focus is on:

  1. simplifying code
  2. making the code more secure
  3. adding formatting where pragmatic.

#3 is surprisingly hard.

إعجاب واحد (1)

I’ve pushed some improvements to a feature branch:

This does away with the silly suppression settings, introduces translation to BBCode to support formatting and colour, leverages the Dumb Frotz command line options better, obviates the need to write to a text stream and squashes a vulnerability.

This branch requires the official BBCode plugin to be installed.

I’m still experimenting with it. Feel free to do so too.

I’ll probably merge after some significant trials.

إعجاب واحد (1)

Does the plugin need the whole frotz repo clone or does it just need $home/frotz/dfrotz to exist? Because I’d rather just compile it once and save the binary between rebuilds.

Not sure why you would care? The resources we are talking about are comparatively tiny. (6MB for the entire repo post make versus Gigabytes for the forum?). It clones the whole repo, then just makes dfrotz. Perhaps that is slightly wasteful, but the simplicity and repeatability is more important I feel. I could go into greater detail and perform a sparse clone, but that would make the build script more complex and less robust. Would it be worth it? Feel free to suggest an optimisation. This is all building inside the container, so will get cleaned whenever the container does.

I’m just trying to optimize for my tiny server, not asking you to change the general install.

إعجاب واحد (1)

This is a really cool plugin! This reminds me of a “classic” computer game that was created years ago(I forgot the name).

3 إعجابات

It’s a great suggestion for a future optimisation if I can keep it simple and robust. Thanks!

إعجاب واحد (1)

Yes there are many playable classics. More via the link in the OP.

إعجابَين (2)

BIG update: :tada: :kiwi_fruit:

(this has taken months of occasional background work and coordination with Frotz team).

Introducing full colour and monospaced formatting for stories

This big update comes with a bunch of improvements:

  • ADDED colour formatting and monospaced text support
  • IMPROVED simplified settings: no longer requires calibration of header and footer, just the desired title and story file, whoop!
  • IMPROVED uses Open3 gem for system commands, reducing risk of abuse/vulnerabilities.
  • IMPROVED internal interaction with command line to remove need for stream files, now copes with more/press any key prompts

Now REQUIRES the Discourse BBCode plugin!!

This required the collaboration of the maintainer of Frotz, David Griffiths and one of the very active members of that community, Borg323 who wrote the BBCode extensions against the BBCode Discourse standard. Many many thanks to them! We had to get a bit creative to get the monospaced text stuff to work, but the solution is really great!

Some examples of the new formatting (I’ve not fully tested these stories, these are just examples of formatting)

and notice the coloured compass here:

KNOWN ISSUES: There are loads of games that don’t work because of the nature of their call and response protocols. If one step of the game doesn’t lead you to a prompt at which you can save (ignoring press any key or More prompts which should be handled), then the story won’t work. e.g. in Act of Murder (great game!) the lady at the door asks if you are a policeman. Unfortunately this is a state of the game that’s unsaveable so fails this requirement and I can’t see a way we would get that to work.

There are probably games that are now compatible with Discourse Frotz that weren’t before … please experiment but note the limitation above!

Let me know if you have any issues getting this to work and I’ll refine the instructions as required.

8 إعجابات

A reminder that you can use keyboard shortcuts to improve your experience with this plugin:

  • Shift-R to reply to the bot

  • Ctrl-Enter to submit your next move

(Standard out of the box keyboard shortcuts).

5 إعجابات

Hi Robert !
finally had time to go further, so far so good, it worked right out of the box in prod env :+1:

Weirdly frotz is not able to respond in private messages unless I also set it in any category :thinking:
Next step : to play :grinning_face_with_smiling_eyes:

إعجاب واحد (1)

Thanks for the report!

I’ve gone ahead and fixed that: FIX: behaviour of private messages playing permission setting · merefield/discourse-frotz@34b022e · GitHub

NTS: must add some unit tests!

إعجابَين (2)

I tried to add :grin: in a source,

it’s going to be fun !

إعجاب واحد (1)