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)

  static new L<S> history;
   
  p {
    S hello = null;
    
    if (args.length != 0 && args[0].equals("nogfx"))
      setOpt(getMainClass(), "showPicture", false);
    
    try {
      history.add("*");
      //hello = answer("*", history);
      if (hello == null) hello = "hallo";
    } catch (Throwable e) {
      e.printStackTrace();
      return;
    }

    say(hello);
    callOpt(getMainClass(), "happy");
  }
  
  static void handleText(S s) {
    print("< " + s);

    // TODO: fix the java strings umlaut problem
     
    final boolean goodbye = match3("goodbye", s) || match3("bye", s) || match3("tsch\u00fcss", s) || match3("tsch\u00fcss ...", s);
    
    // get answer
    
    history.add(s);
    
    S answer;
    try {
      answer = goodbye ? "tsch\u00fcss" : answer(s, history);
    } catch (Throwable e) {
      e.printStackTrace();
      answer = "Fehler";
    }
    
    if (answer != null)
      say(answer);
      
    if (goodbye) {
      print("\nGOODBYE!");
      callOpt(getMainClass(), "disappear");
    }
  }
    
  static void say(S s) {
    print("> " + s);
    history.add(s);
    // TODO: speak?
  }

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: 603 / 754
Referenced in: [show references]