Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // call with script { t: #s.[user].[loc] }
- function (c, a) {
- 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
- // g spits back x if x is prime, otherwise it returns 0
- g=x=>{
- j=2
- for(;j<x;) x = x%j++<1 ? 0 : x
- return x
- }
- // a is the lock name, b is the lock type
- // 0 is a digit from 0-9, 1 is a lock phrase,
- // 2 is a color name, 3 is a prime lock
- s=(a,b)=>{
- i=0
- // checks if the lock is present
- if ( r.search(a) > 0 )
- // run until it no longer asks for the correct value
- // and presents a new lock
- do {
- // set the value according to the lock type
- // lock phrases and colors are both stored in p,
- // colors are offset by 3
- o[a] = b ? b-1 ? b-2?g(i):p[3+i] : p[i] : i
- // skip querying if o[a] is 0 and it's not the first
- // iteration.
- // the do-while loop expects a new response so we have to
- // run it if i==0.
- // on later iterations we skip if o[a] is 0 as this
- // should only be the case if it's a prime lock and i
- // is not a prime
- r = !i||o[a] ? t.call (o) : r
- i++
- // search for "x is not the correct" string
- } while ( r.search("not") > 0)
- }
- while ( r.search("ERR") > 0 ) { // search for LOCK ERROR
- s("EZ_21", 1)
- s("EZ_35", 1)
- s("digit", 0)
- s("EZ_40", 1)
- s("ez_prime", 3)
- s(k+1, 2) // k="c00" to save some characters
- s("color_digit", 0)
- s(k+2, 2)
- s(k+"2_complement", 2)
- s(k+3, 2)
- s(k+"3_triad_1", 2)
- s(k+"3_triad_2", 2)
- }
- return r
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement