Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1 lines (1 sloc) 7.84 KB
{"name":"vital tracker","enabled":true,"description":"","type":"group","id":1,"items":[{"type":"function","name":"onLoad","enabled":true,"id":2,"code":"//engi: parts: pt\nvit = {};\nvit.tell = false;\nvit.tellWho = '';\nvit.gmcp = function(e, r, n) {\n \n if (r == \"Char.Vitals\") {\n var output = \"\";\n var noHTML = \"\";\n var diff = 0;\n var num = 0;\n //if it's different, add the string.\n for (var key in vit.vitals) {\n if (vit.vitals[key].show && (vit.vitals[key].val !== n[key])) {\n diff = Number(vit.vitals[key].val) - Number(n[key]);\n if (diff < 0) {\n num = Math.floor(Math.abs(diff) * 100) / 100\n output+='<span style=\"color: ' + vit.vitals[key].cogain + ';\">+'+ num +vit.vitals[key].short+' </span>';\n noHTML+='+'+num + vit.vitals[key].short+' ';\n } else {\n num = Math.floor(Math.abs(diff) * 100) / 100\n output+='<span style=\"color: ' + vit.vitals[key].coloss + ';\">-'+num+vit.vitals[key].short+' </span>';\n noHTML+='-'+num + vit.vitals[key].short+' ';\n }\n\n }\n vit.vitals[key].val = n[key];\n }\n if (output !== '') {\n vit.report(output);\n if(vit.tell) {\n send_command('tell '+vit.tellWho+ ' '+noHTML);\n }\n }\n }\n}\nvit.options = {};\nvit.options.tag = '&Lang; vit &Rang;'\nvit.options.tagc = 'rgb(239, 143, 124)'\nvit.options.msgc = 'rgb(239, 249, 119)'\n\n\nvit.owWrite = function(selector, text) {\n if (text.trim() == \"\") return;\n\n // doing these updates asynchronously to minimize reflows when under heavy load\n window.requestAnimationFrame(function() {\n var hooks = $.cssHooks;\n $.cssHooks = {};\n\n var output = client.document.querySelectorAll(selector + ' .output')[0];\n var newel = document.createElement('div');\n newel.innerHTML = text;\n newel.className = 'line';\n newel.id = 'msg' + num_msgs;\n output.appendChild(newel);\n append_to_log(newel.innerHTML);\n\n var scrollback = client.document.querySelectorAll(selector + ' .output_scrollback')[0];\n newel = document.createElement('div');\n newel.className = 'line';\n newel.innerHTML = text;\n newel.id = 'sb_msg' + num_msgs;\n scrollback.appendChild(newel);\n\n trim_ow(selector);\n\n num_msgs++;\n scrollback_num_msgs++;\n\n if (selector === '#output_main') {\n if (no_prompts || gag_prompts) {\n var el = client.document.querySelectorAll('#output_main .prompt');\n for (var i = 0; i < el.length; i++) el[i].style.display = 'none';\n // last prompt shown?\n if ((!no_prompts) && el.length > 0)\n el[el.length - 1].style.display = 'block';\n }\n if (show_timestamps) {\n var el = client.document.querySelectorAll('#output_main .output #msg'+(num_msgs-1)+' .timestamp');\n for (var i = 0; i < el.length; i++) el[i].classList.remove('no_out');\n }\n if (show_scroll_timestamps) {\n var el = client.document.querySelectorAll('#output_main .output_scrollback #sb_msg'+(num_msgs-1)+' .timestamp');\n for (var i = 0; i < el.length; i++) el[i].classList.remove('no_out');\n }\n }\n\n output.scrollTop = output.scrollHeight;\n\n $.cssHooks = hooks;\n });\n\n},\n \n//vit.write = function(msg) { ow_Write('#output_main', '<div>' + msg + '</div>') }\nvit.report = function(msg) { vit.owWrite('#output_main', '<div style=\"color: ' + vit.options.tagc + ';\">' + vit.options.tag + ': <span style=\"color: ' + vit.options.msgc + ';\">' + msg + '</span></div>') };\n/*\nClass-specific: \"class\" (current class), \"pl\" / \"maxpl\" / \"formatpl\" (plasma), \"bl\" / \"maxbl\" / \"formatbl\" (bullets), \"nn\" / \"maxnn\" / \"formatnn\" (nanites), \"sa\" / \"maxsa\" / \"formatsa\" (sanity), \"rg\" / \"maxrg\" / \"formatrg\" (rage), \"pt\" / \"maxpt\" / \"formatpt\" (parts), \"st\" (stance) \n*/\nvit.vitals = {\n \"hp\": {val : \"0\", cogain : 'rgb(8, 242, 0)', coloss:'rgb(242, 0, 0)', short:\"HP\", show:true},\n \"em\": {val : \"0\", cogain : 'rgb(0, 216, 205)', coloss:'rgb(0, 216, 205)',short:\"EM\", show:true},\n \"muscular\": {val : \"100.00\", cogain : 'rgb(250, 0, 255)', coloss:'rgb(255, 89, 0)',short:\"musc\", show:true},\n \"internal\": {val : \"100.00\", cogain : 'rgb(250, 0, 255)', coloss:'rgb(255, 89, 0)',short:\"int\", show:true},\n \"sensory\": {val : \"100.00\", cogain : 'rgb(250, 0, 255)', coloss:'rgb(255, 89, 0)',short:\"sens\", show:true},\n \"mind\": {val : \"100.00\", cogain : 'rgb(250, 0, 255)', coloss:'rgb(255, 89, 0)',short:\"mind\", show:true},\n \"wetwiring\": {val : \"100.00\", cogain : 'rgb(250, 0, 255)', coloss:'rgb(255, 89, 0)',short:\"ww\", show:true},\n \"xp\": {val : \"0\", cogain : 'rgb(0, 216, 205)', coloss:'rgb(0, 216, 205)',short:\"XP\", show:true},\n};\n\nvar cl = get_variable('my_class');\n\nswitch (cl) {\n case 'Nanoseer':\n vit.vitals['nn'] = {val : \"0\", cogain : 'rgb(247, 230, 0)', coloss:'rgb(216, 207, 73)',short:\"NN\", show:true};\n vit.vitals['sa'] = {val : \"1000\", cogain : 'rgb(247, 230, 0)', coloss:'rgb(216, 207, 73)',short:\"SA\", show:true};\n break;\n case 'Engineer':\n vit.vitals['pt'] = {val : \"0\", cogain : 'rgb(247, 230, 0)', coloss:'rgb(216, 207, 73)',short:\"PT\", show:true};\n break;\n case 'B.E.A.S.T.':\n vit.vitals['pl'] = {val : \"0\", cogain : 'rgb(247, 230, 0)', coloss:'rgb(216, 207, 73)',short:\"PL\", show:true};\n break;\n case 'Fury':\n vit.vitals['rg'] = {val : \"0\", cogain : 'rgb(247, 230, 0)', coloss:'rgb(216, 207, 73)',short:\"PT\", show:true};\n break;\n case 'Scoundrel':\n vit.vitals['bl'] = {val : \"0\", cogain : 'rgb(247, 230, 0)', coloss:'rgb(216, 207, 73)',short:\"BL\", show:true};\n break;\n default:\n vit.report('ERROR: Vit found no valid character class');\n break;\n}\n\nvit.go = true;\nsend_command('vit')"},{"type":"function","name":"onGMCP","enabled":true,"id":3,"code":"//Enter the function here\nvar matches = arguments[0]\nvar r = matches.gmcp_method\nvar n = matches.gmcp_args\n\nif ((typeof vit != 'undefined')) {\n if (vit.go) {vit.gmcp(null, r, n)}\n}\n"},{"type":"alias","name":"","enabled":true,"id":4,"matching":"regexp","whole_words":true,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"//Enter the script here\nmatch = args[1].toLowerCase();\nmatch=match.split(' ');\nif (match[0] == 'on') {\n\tvit.go = true;\n vit.report('Tracking vitals!')\n} else if (match[0] == 'off') {\n\tvit.go = false;\n vit.report('No longer tracking vitals!')\n} else if (match[0] == 'tell'){\n if (match[1] =='off') {\n vit.tell = false;\n vit.report('No longer TELLing vital stats')\n }else if (match[1] != undefined) {\n vit.tellWho = match[1];\n vit.tell = true;\n vit.report('Now TELLing vital stats to '+vit.tellWho)\n } else {\n \tvit.report('ERROR: valid commands are VITALS ON/OFF and VITALS TELL NAME/OFF!')\n }\n} else {\n vit.report('ERROR: valid commands are VITALS ON/OFF and VITALS TELL NAME/OFF!')\n}"}],"text":"^vit (.+)$"},{"type":"group","name":"Functions","enabled":true,"id":8,"items":[],"actions":[]},{"type":"alias","name":"","enabled":true,"id":9,"matching":"exact","whole_words":true,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"//Enter the script here\nvit.report('Welcome to VIT, a Vitals Tracker for Nexus. valid commands are VIT ON/OFF and VIT TELL NAME/OFF!')"}],"text":"vit"}]}
You can’t perform that action at this time.