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).

static S botEditMechList(S name, S text) {
  bool change = true;
  try {
    S answer = botEditMechList_impl(name, text);
    change = !eqic(answer, "no change");
    ret answer;
  } finally {
    if (change)
      mechList_clearCache(name);
  }
}

static S botEditMechList_impl(S name, S text) {
  ifclass VirtualMechLists
    O writeMode = mechMode().writeMode;
    if (writeMode cast VirtualMechLists) {
      writeMode.setText(name, text);
      ret name + ": Changed";
    }
  endif

  if (mechPlaying()) {
    if (eq(mechList_raw(name), text)) ret "No change";
    print("Setting mech list " + name + ":");
    printIndent(text);
    ret "Would change";
  }
  
  S answer = postPageSilently("https://www.botcompany.de/mech/raw/bot-list-edit", arrayPlus(muricaCredentials(), +name, +text));
  print(name + ": " + answer);
  ret answer;
}

static S botEditMechList(S name, Collection<S> lines) {
  ret botEditMechList(name, lines(lines));
}

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: 443 / 522
Version history: 13 change(s)
Referenced in: [show references]