Uses 911K of libraries. Click here for Pure Java version (2885L/15K).
1 | !7 |
2 | |
3 | cmodule GDialogRunner > DynPrintLog { |
4 | GModuleInfo gInfo; |
5 | |
6 | LS dialog = tlft([[ |
7 | can you add numbers? |
8 | sure. which numbers would you like to add? |
9 | 5 |
10 | ok, and? |
11 | 3 |
12 | that makes 8 |
13 | thanks |
14 | ]]); |
15 | |
16 | int index = 1; // first line is trigger |
17 | |
18 | S answer(S s) { |
19 | if (nextLineIsBotLine()) |
20 | ret nextLine(); |
21 | S line = nextLine(); |
22 | if (match(line, ai_dropLeadingPhrases_one(s, "ok"))) |
23 | ret nextLine(); |
24 | else { |
25 | --index; |
26 | ret "Nah dude. You are supposed to say: " + line; |
27 | } |
28 | } |
29 | |
30 | S initialAnswer(O... _) { |
31 | ret nextLine(); |
32 | } |
33 | |
34 | bool nextLineIsBotLine() { ret odd(index); } |
35 | |
36 | S nextLine() { |
37 | S line = get(dialog, index); |
38 | if (line == null) |
39 | ret null with gazelle_stop(); |
40 | ++index; |
41 | ret line; |
42 | } |
43 | } |
Began life as a copy of #1022077
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022220 |
Snippet name: | Gazelle Dialog Runner [Demo] |
Eternal ID of this version: | #1022220/8 |
Text MD5: | 556d6d959b55053228234965d69a9b43 |
Transpilation MD5: | 324e58454baf36ca4ff75f7cde4a2960 |
Author: | stefan |
Category: | javax / gazelle |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-11 12:54:43 |
Source code size: | 823 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 283 / 3056 |
Version history: | 7 change(s) |
Referenced in: | [show references] |