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

95
LINES

< > BotCompany Repo | #1002626 // Sister Bot

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1739L/11K/36K).

!752

static class Sister {
  S name, url, robotURL;
}

static Sister sister;

p {
  load("sister");
}

static boolean has() {
  ret sister != null;
}

synchronized answer {
  if "do you have a sister"
    ret yn(has());
  if "what is your sister's name"
    if (!has())
      ret "Ain't got no sister yo";
    else
      ret or(sister.name, "I don't know");
  if "what is your sister's url"
    if (!has())
      ret "Ain't got no sister yo";
    else
      ret or(sister.url, "I don't know");
  if "what is your sister's robot url"
    if (!has())
      ret "Ain't got no sister yo";
    else
      ret or(sister.robotURL, "I don't know");
      
  if (master()) {
    // master stuff
    
    if "now you have a sister" {
      makeSister();
      ret "Cool!";
    }
    
    if "you have no sister anymore" {
      if (has()) { 
        sister = null;
        save("sister");
        ret "Aw... what happened to her?";
      }
      ret "Woot? Didn't have one anyway";
    }
    
    if "your sister's name is *" exceptionToUser {
      if (!has()) makeSister();
      sister.name = eqic("unknown", m.unq(0)) ? null : m.unq(0);
      save("sister");
      ret "OK!";
    }
    
    if "your sister's url is *" exceptionToUser {
      S url = m.unq(0);
      if (!has()) makeSister();
      if (eqic("unknown", url))
        sister.url = null;
      else {
        assertTrue("not an url", isURL(url));
        sister.url = url;
      }
      save("sister");
      ret "OK!";
    }
    
    if "your sister's robot url is *" exceptionToUser {
      S url = m.unq(0);
      if (!has()) makeSister();
      if (eqic("unknown", url))
        sister.robotURL = null;
      else {
        assertTrue("not an url", isURL(url));
        sister.robotURL = url;
      }
      save("sister");
      ret "OK!";
    }
  }    
}

static synchronized Sister _get() {
  ret sister;
}

static void makeSister() {
  sister = new Sister;
  save("sister");
}

Author comment

Began life as a copy of #1002596

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: #1002626
Snippet name: Sister Bot
Eternal ID of this version: #1002626/1
Text MD5: c14d677c74c5ca39497bb05eb0b9785b
Transpilation MD5: cf32773b94562aa1d4d2998faa5a4a41
Author: stefan
Category: eleu
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-11 01:35:16
Source code size: 2036 bytes / 95 lines
Pitched / IR pitched: No / No
Views / Downloads: 653 / 1257
Referenced in: [show references]