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

40
LINES

< > BotCompany Repo | #1022077 // Gazelle Things Lister [Demo]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (4474L/24K).

!7

cmodule GThingsLister > DynPrintLog {
  GModuleInfo gInfo;
  
  S ruleID = 'invcwuqfdjvuloyv; // take fulfillments from there
  S varName = "toes";
  
  LS thingsNotYetSaid, thingsSaid = syncList();
  
  start {
    if (thingsNotYetSaid == null)
      thingsNotYetSaid = asSyncList(gazelle_varFulfillments(varName, ruleID));
  }
  
  S giveMeOne() {
    if (empty(thingsNotYetSaid)) {
      dm_gazelle_stopThisModule();
      ret "I don't know any more body parts...";
    }
    S s = removeRandom(thingsNotYetSaid);
    thingsSaid.add(s);
    ret s + "!";
  }
  
  S answer(S s) {
    if "ok|cool|yes|good|next one please|yo|ack"
      ret giveMeOne();
    null;
  }
  
  S initialAnswer(O... _) {
    S s = [[I'll list body parts for you. Say "done" or "stop" to quit.]] + "\n";
    if (empty(thingsNotYetSaid)) {
      s += "Sadly, I don't know any body parts";
      dm_gazelle_stopThisModule();
    } else s += "Here is one: " + giveMeOne();
    ret s;
  }
}

Author comment

Began life as a copy of #1021930

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022077
Snippet name: Gazelle Things Lister [Demo]
Eternal ID of this version: #1022077/25
Text MD5: 8c2c2490c93d699dc68039e72a03d072
Transpilation MD5: d18f42d0f1e871327dd2f60453bbe36f
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:32:25
Source code size: 1006 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 306 / 923
Version history: 24 change(s)
Referenced in: #1022078 - gazelle_startThingsListerForUser
#1022220 - Gazelle Dialog Runner [Demo]