Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

54
LINES

< > BotCompany Repo | #1001312 // Desktop: Leopold (include)

JavaX fragment (include)

1  
  static new L<S> history;
2  
   
3  
  p {
4  
    S hello = null;
5  
    
6  
    if (args.length != 0 && args[0].equals("nogfx"))
7  
      setOpt(getMainClass(), "showPicture", false);
8  
    
9  
    try {
10  
      history.add("*");
11  
      //hello = answer("*", history);
12  
      if (hello == null) hello = "hallo";
13  
    } catch (Throwable e) {
14  
      e.printStackTrace();
15  
      return;
16  
    }
17  
18  
    say(hello);
19  
    callOpt(getMainClass(), "happy");
20  
  }
21  
  
22  
  static void handleText(S s) {
23  
    print("< " + s);
24  
25  
    // TODO: fix the java strings umlaut problem
26  
     
27  
    final boolean goodbye = match3("goodbye", s) || match3("bye", s) || match3("tsch\u00fcss", s) || match3("tsch\u00fcss ...", s);
28  
    
29  
    // get answer
30  
    
31  
    history.add(s);
32  
    
33  
    S answer;
34  
    try {
35  
      answer = goodbye ? "tsch\u00fcss" : answer(s, history);
36  
    } catch (Throwable e) {
37  
      e.printStackTrace();
38  
      answer = "Fehler";
39  
    }
40  
    
41  
    if (answer != null)
42  
      say(answer);
43  
      
44  
    if (goodbye) {
45  
      print("\nGOODBYE!");
46  
      callOpt(getMainClass(), "disappear");
47  
    }
48  
  }
49  
    
50  
  static void say(S s) {
51  
    print("> " + s);
52  
    history.add(s);
53  
    // TODO: speak?
54  
  }

Author comment

Began life as a copy of #1001279

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001312
Snippet name: Desktop: Leopold (include)
Eternal ID of this version: #1001312/1
Text MD5: d099d25665c12b47a77cc9e76e39b694
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-09 17:21:17
Source code size: 1193 bytes / 54 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 544 / 693
Referenced in: [show references]