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

27
LINES

< > BotCompany Repo | #1001964 // newFindBot

JavaX fragment (include)

1  
static int newFindBot_botVM;
2  
3  
static synchronized DialogIO newFindBot(S name) {
4  
  if (newFindBot_botVM == 0) {
5  
    print("Looking for Bot VM.");
6  
    L<ProgramScan.Program> botVMs = quickBotScan("This is a JavaX VM. Bot VM.");
7  
    if (!botVMs.isEmpty()) {
8  
      newFindBot_botVM = botVMs.get(0).port;
9  
      print("Bot VM is at port " + newFindBot_botVM + ".");
10  
    }
11  
  }
12  
  
13  
  if (newFindBot_botVM != 0) {
14  
    DialogIO io = talkTo(newFindBot_botVM);
15  
    S q = format("has bot *", name);
16  
    S s = io.ask(q);
17  
    //print(format("Answer of Bot VM to *: *", q, s));
18  
    
19  
    if (match("yes", s)) {
20  
      io = talkToSubBot(name, io);
21  
      call(io, "pushback", "?"); // put some hello string in (yes, this should be improved.)
22  
      ret io;
23  
    }
24  
  }
25  
  
26  
  ret findBot(name);
27  
}

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