Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Global namespaces
- o = {};
- o.tog = {};
- o.cond = {};
- tmp = {};
- tmp.arr = [];
- //Function to get target from Nexus
- setTar = set => {
- tar = get_variable("tar")
- };
- //Action sequence namespaces
- prefix = [];
- action = [];
- suffix = [];
- string = "";
- //Action manipulation functions
- //Parse each array
- parsePrefix = (val, index) => {
- if (typeof val == "object") {
- prefix.splice(arg.join(sep), index, 0)
- }
- };
- parseAction = (val, index) => {
- if (typeof val == "object") {
- action.splice(arg.join(sep), index, 0)
- }
- };
- parseSuffix = (val, index) => {
- if (typeof val == "object") {
- suffix.splice(arg.join(sep), index, 0)
- }
- };
- parseConditions = (val, index, array) => {
- if (o.cond[val]) { removeItem(val, array) }
- };
- //Pre-process each array
- processPrefix = () => {
- if (o.tog.get_gold) {
- addItem("put money in pack")
- addItem("get money")
- } else {
- removeItem("get money", prefix)
- removeItem("put money in pack", prefix)
- }
- addItem("light pipes", prefix)
- addItem("stand", prefix)
- addItem("stand", prefix)
- prefix.forEach(parsePrefix)
- };
- processAction = () => {
- action.forEach(parseAction)
- action.forEach(parseConditions)
- };
- processSuffix = () => {
- suffix.forEach(parseSuffix)
- };
- //Send the entire block
- sendAction = () => {
- //Pre-processing functions
- processPrefix()
- processAction()
- processSuffix()
- //Handle first action in action list
- var act = []
- act.push(action[0])
- //Combine prefix, action, and suffix and send
- var combined = prefix.concat(act, suffix)
- combined = combined.join(sep)
- sent = combined
- send_command("queue addclear eqbal " + combined)
- };
- //Repeat the current block
- repeatAction = q => {
- if (o.tog.repeat==true && stop.repeat!=true) {
- sendAction(q);
- stop.on("repeat", 1000)
- } else {
- return
- }
- };
- //Used to listen and unlisten condition triggers for an action
- listenCondition = name => {
- var name = "condition_" + name
- var reflex = reflex_find_by_name("group", name, true, false)
- reflex_enable(reflex)
- };
- unlistenCondition = name => {
- var name = "condition_" + name
- var reflex = reflex_find_by_name("group", name, true, false)
- reflex_disable(reflex)
- };
- //Toggle manipulation
- tog = (arg, val) => {
- if (val===true || val===false) {
- o.tog[arg] = val
- } else if (o.tog[arg]==true) {
- o.tog[arg] = false
- } else {
- o.tog[arg] = true
- }
- print(o.tog[arg])
- };
- //Condition manipulation
- cond = (arg, val) => {
- if (val===true || val===false) {
- o.cond[arg] = val
- } else if (o.cond[arg]==true) {
- o.cond[arg] = false
- } else {
- o.cond[arg] = true
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement