Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function(context, args) { // target:"#s.no.quotes"
- // Above, we have set an autocomplete string that will give us a tip on how to use the script while we type it.
- var ret = "" // "ret", short for return, is declared here beforeand. I use it in this script to
- // store and analyze what the game spits out at me.
- var ez = ["open","unlock","release"] // The "ez" array I define here stores the possibilities for unlocking the EZ_21 lock.
- // It's just named "ez" because these same strings are used in all the EZ locks,
- // and this can be used in that capacity if you wanted to expand on this script.
- var regex = /\N(\wV)\N lock\./ // This is a little trickier. Regular expressions are used to find and extract
- // stuff from strings. This in particular finds the part of the game output that
- // tells you which lock you're up against next. The game output is something like
- // "blah blah blah Hyperion Systems EZ-21 lock." This regex expression will match
- // the end of that string and extract the "EZ-21" part. It will also, in fact,
- // extract the name of any lock you are up against, not just this specifically.
- // You can find out more here:
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
- ret = args.target.call({}) // args.target is used to pull the scriptor you passed to this script with the "target"
- // key. ".call" at the end allows us to further pass our own arguments with it. So
- // basically if we do something like args.target.call({foo:"bar"}), that's like us
- // entering "your.target {foo:"bar"}" into hackmud.
- var done = false // I use "done" as a boolean that we can switch to "true" when we detect that we have
- // cracked our lock. Otherwise, the program will time out or return a failure.
- // Ok, here we go.
- var lock = regex.exec(ret) // Here I use our RegEx from earlier to find the name of the next lock and store it in
- // a "lock" variable. This is actually an array because of how RegEx capturing groups
- // work.
- if (lock[1] == "EZ_21") { // Here we see if the name we got from our RegEx matches "EZ_21". We compare it
- // specifically to key 1 in "lock" (lock[1]) because that's where it will have
- // been captured.
- for (var i = 0; i < 3; i++) { // So if the match is successful, we begin brute-forcing the lock.
- ret = args.target.call({ez_21: ez[i]}) // We use a for loop and our variable "i" we use to iterate through
- // our "ez" array from earlier. We use a call and send our target
- // an argument {ez_21:"<etc>"} each time we loop, and put the return
- // response in "ret".
- if (!ret.includes("LOCK_ERROR")) { // Each time we run the loop, we want to check if the target responds
- done = true // that the lock has been cracked. Specifically, we check to see if
- break; // the response includes the "LOCK_ERROR" string. If not, we
- } // have done it! We flag that we are done and break our of our for loop
- } // to return a "success" string. At this point, the lock has been
- } // cracked so we end the script.
- return {ok:done,msg:"gg fam"}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement