Uses 911K of libraries. Click here for Pure Java version (11455L/64K).
1 | !7 |
2 | |
3 | sclass ICallYou > CruddieScript { |
4 | swappable void setBotName(S name) {} |
5 | swappable S getBotName() { null; } |
6 | |
7 | S answer(S s) null { |
8 | new Matches m; |
9 | |
10 | if "I call you $name" { // fancy dollar var syntax with automatic declaration of S $name |
11 | assume("\*$name*/ is a name"); |
12 | setBotName($name); |
13 | ret "OK, my name is now \*$name*/"; |
14 | } |
15 | |
16 | if "What is your name" |
17 | ret or2(getBotName(), "I don't know"); |
18 | } |
19 | } |
20 | |
21 | sclass SafeEvaluator > CruddieScript { |
22 | S answer(S s) null { |
23 | new Matches m; |
24 | |
25 | if "what is $expression" { |
26 | if (!isSafeCodeFragment($expression)) { |
27 | assume("\*$expression*/ is not a safe JavaX expression"); |
28 | null; |
29 | } |
30 | |
31 | assume("\*$expression*/ is a safe JavaX expression"); |
32 | S result = strOrNull(dm_javaEvalOrInterpret($expression)); |
33 | ret "Result: " + or(result, "nothing"); |
34 | } |
35 | } |
36 | } |
37 | |
38 | cmodule SomeCruddieScripts { |
39 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027663 |
Snippet name: | Some Cruddie Scripts |
Eternal ID of this version: | #1027663/5 |
Text MD5: | 73fadd5422b2fc3e7dc8072c62ca49f5 |
Transpilation MD5: | f83862f4dee6b04d0adb812c2cdef510 |
Author: | stefan |
Category: | javax / chat bots |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-01 13:33:13 |
Source code size: | 961 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 218 / 54894 |
Version history: | 4 change(s) |
Referenced in: | [show references] |