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

27
LINES

< > BotCompany Repo | #1001964 // newFindBot

JavaX fragment (include)

static int newFindBot_botVM;

static synchronized DialogIO newFindBot(S name) {
  if (newFindBot_botVM == 0) {
    print("Looking for Bot VM.");
    L<ProgramScan.Program> botVMs = quickBotScan("This is a JavaX VM. Bot VM.");
    if (!botVMs.isEmpty()) {
      newFindBot_botVM = botVMs.get(0).port;
      print("Bot VM is at port " + newFindBot_botVM + ".");
    }
  }
  
  if (newFindBot_botVM != 0) {
    DialogIO io = talkTo(newFindBot_botVM);
    S q = format("has bot *", name);
    S s = io.ask(q);
    //print(format("Answer of Bot VM to *: *", q, s));
    
    if (match("yes", s)) {
      io = talkToSubBot(name, io);
      call(io, "pushback", "?"); // put some hello string in (yes, this should be improved.)
      ret io;
    }
  }
  
  ret findBot(name);
}

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: #1001964
Snippet name: newFindBot
Eternal ID of this version: #1001964/1
Text MD5: 40fde2ff01bb96f863e5d946941ac1f6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-03 01:04:30
Source code size: 796 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 620 / 2157
Referenced in: [show references]