Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // call with script { t: #s.[user].[loc] }
  2. function (c, a) {
  3.     var o={},t=a.t,r=t.call(o),i,p = ["unlock","open","release","red","green","orange","cyan","yellow","blue","lime","purple"],k="c00",g,s,j
  4.  
  5.     // g spits back x if x is prime, otherwise it returns 0
  6.     g=x=>{
  7.         j=2
  8.         for(;j<x;) x = x%j++<1 ? 0 : x
  9.         return x
  10.     }
  11.  
  12.     // a is the lock name, b is the lock type
  13.     // 0 is a digit from 0-9, 1 is a lock phrase,
  14.     // 2 is a color name,     3 is a prime lock
  15.     s=(a,b)=>{
  16.         i=0
  17.         // checks if the lock is present
  18.         if ( r.search(a) > 0 )
  19.             // run until it no longer asks for the correct value
  20.             // and presents a new lock
  21.             do {
  22.                 // set the value according to the lock type
  23.                 // lock phrases and colors are both stored in p,
  24.                 // colors are offset by 3
  25.                 o[a] = b  ?  b-1 ? b-2?g(i):p[3+i] : p[i]  :  i
  26.                 // skip querying if o[a] is 0 and it's not the first
  27.                 // iteration.
  28.                 // the do-while loop expects a new response so we have to
  29.                 // run it if i==0.
  30.                 // on later iterations we skip if o[a] is 0 as this
  31.                 // should only be the case if it's a prime lock and i
  32.                 // is not a prime
  33.                 r = !i||o[a] ? t.call (o) : r
  34.                 i++
  35.             // search for "x is not the correct" string
  36.             } while ( r.search("not") > 0)
  37.     }
  38.  
  39.     while ( r.search("ERR") > 0 ) { // search for LOCK ERROR
  40.         s("EZ_21", 1)
  41.         s("EZ_35", 1)
  42.         s("digit", 0)
  43.         s("EZ_40", 1)
  44.         s("ez_prime", 3)
  45.         s(k+1, 2) // k="c00" to save some characters
  46.         s("color_digit", 0)
  47.         s(k+2, 2)
  48.         s(k+"2_complement", 2)
  49.         s(k+3, 2)
  50.         s(k+"3_triad_1", 2)
  51.         s(k+"3_triad_2", 2)
  52.     }
  53.     return r
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement