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

36
LINES

< > BotCompany Repo | #1014071 // botEditMechList

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5857L/40K).

1  
static S botEditMechList(S name, S text) {
2  
  bool change = true;
3  
  try {
4  
    S answer = botEditMechList_impl(name, text);
5  
    change = !eqic(answer, "no change");
6  
    ret answer;
7  
  } finally {
8  
    if (change)
9  
      mechList_clearCache(name);
10  
  }
11  
}
12  
13  
static S botEditMechList_impl(S name, S text) {
14  
  ifclass VirtualMechLists
15  
    O writeMode = mechMode().writeMode;
16  
    if (writeMode cast VirtualMechLists) {
17  
      writeMode.setText(name, text);
18  
      ret name + ": Changed";
19  
    }
20  
  endif
21  
22  
  if (mechPlaying()) {
23  
    if (eq(mechList_raw(name), text)) ret "No change";
24  
    print("Setting mech list " + name + ":");
25  
    printIndent(text);
26  
    ret "Would change";
27  
  }
28  
  
29  
  S answer = postPageSilently("https://www.botcompany.de/mech/raw/bot-list-edit", arrayPlus(muricaCredentials(), +name, +text));
30  
  print(name + ": " + answer);
31  
  ret answer;
32  
}
33  
34  
static S botEditMechList(S name, Collection<S> lines) {
35  
  ret botEditMechList(name, lines(lines));
36  
}

Author comment

Began life as a copy of #1014030

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014071
Snippet name: botEditMechList
Eternal ID of this version: #1014071/14
Text MD5: 350911b70b5602b32fd8ad36431997ef
Transpilation MD5: c664614547ca2e1193e50bff5dace161
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-17 13:42:50
Source code size: 979 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 526
Version history: 13 change(s)
Referenced in: [show references]