{"name":"scog","enabled":true,"description":"Scroll-Log. Log the scrollback. No lag! Type SCOG for usage. See the Read_Me function inside the \"Reflexes\" tab for more details.","type":"group","id":1,"items":[{"type":"function","name":"Read_Me","enabled":true,"id":16,"code":"/* \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n!!! Click inside this script box below line 13 to load the rest of the page (nexus bug) !!!\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\nScog v1.0.0\nby: Zahan of Achaea\n\nLog the scrollback! Zero-lag-logging! Comes with fancy stat-bar icon!\n\nScogs are saved to your default 'downloads' folder. This is controlled by your browser.\n\nTo have timestamps in your scogs, make sure to enable \"Show timestamps in the main output scrollback\" \nin the 'Display Options' of your nexus settings tab.\n\n------------------------------\n\nType SCOG in-game for status and commands.\n\n------------------------------\n\nManual saving - save it now\n--------------------\n SCOG SAVE - save the current scrollback\n SCOG SAVE - save the current scrollback with a name\n\n \nAutomatic saving - hands-free scogging\n--------------------\n SCOG AUTO ON - turn on auto saving (generates an \"auto-pre\" scog)\n SCOG AUTO OFF - turn off auto saving (generates an \"auto-post\" scog)\n [click SCOG icon] - toggle auto saving on/off\n \n \nClear buffers - make cleaner scogs and release browser memory\n--------------------\n SCOG CLEAR - clear scrollback window\n SCOG CLEAR ALL - clear main and scrollback windows\n\n\n* Auto Scogging will clear the buffer as it logs, to prevent overlap and release browser memory.\nIf you check your scrollback while auto is active, you might find it to be super short.\n\n------------------------------\n\nIf you have any problems or questions, send me a msg in the game, on the forum, or discord.\n\nThis plugin is provided for free but donations to Zahan (achaea) are always appreciated, no matter how small!\n\n\n\n------------------------------\n\nVersion notes:\n- initial release\n\n*/"},{"type":"alias","name":"scog","enabled":true,"id":5,"matching":"regexp","whole_words":false,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"if (typeof scog == 'undefined')\n send_command('scog reload');\n\nlet status;\nif (scog.auto)\n status = 'ON';\nelse\n status = 'OFF';\nlet notice = 'Auto-Scogging is currently: '+status+'.' +\n '\\nSyntax:\\n   SCOG SAVE [<name>]' +\n '\\n   SCOG CLEAR [ALL]' +\n '\\n   SCOG AUTO ON|OFF'\n;\ndisplay_notice(notice, '#aaa')"}],"text":"^scog$"},{"type":"group","name":"Functions","enabled":true,"id":15,"items":[{"type":"function","name":"onLoad","enabled":true,"id":4,"code":"// initialize table\nif (typeof scog == 'undefined')\n scog = {};\n\n// default settings\nscog.settings = {\n auto: false,\n buffer: 100\n};\n\n// pull the client buffer setting\nif (typeof client.scrollback_msg_limit != 'undefined')\n scog.settings.buffer = client.scrollback_msg_limit;\n\n// setup icon\n$(\"#footer #scog\").remove();\nif (!$('#footer #scog').html()) {\n // add div\n $('#footer #fullscreen').after('
SC
OG
');\n // color icon\n let div = $(\"#footer #scog\");\n if (scog.auto)\n div.css(\"color\", \"white\");\n else\n div.css(\"color\", \"brown\");\n}\n\n// div onclick\nscog.div_onclick = function () {\n\tif (scog.auto)\n scog.toggle_auto(false);\n else\n scog.toggle_auto(true);\n};\n\n\n// save file\nscog.download_file = function (filename, text) {\n var element = document.createElement('a');\n element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));\n element.setAttribute('download', filename);\n element.style.display = 'none';\n document.body.appendChild(element);\n element.click();\n document.body.removeChild(element);\n return true;\n}\n\nscog.save_file = function (suffix) {\n\t// pull some variables\n\tlet c_width = Math.round($('#output_main').width())+30;\n\tlet today = new Date();\n\tlet date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();\n\tlet time = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\n\tlet char = GMCP.Status.fullname;\n\t\n\t// set headers\n\tlet headers = [\n \t\t'',\n \t\t'',\n\t \t'',\n\t \t'
\\n'\n\t].join('\\n');\n\tvar html_log = headers;\n\t\n\t// add controls\n\tlet controls = [\n \t\t'
\\n',\n \t\t'
Top
',\n \t\t'
Bottom
',\n \t\t'
Toggle Times
',\n \t\t'
'\n\t].join('');\n\thtml_log += controls;\n\t\n\t// add title\n\tlet title = '\\n
'+char+'
'+date+' at '+time+'';\n\tif (suffix) {\n\t\ttitle += ' \"'+suffix+'\"';\n\t}\n\ttitle += '
\\n\\n\\n
';\n\thtml_log += title;\n\t\n\t// grab scrollback\n\thtml_log += $('#output_main .output_scrollback').html();\n\t\n\t// clean up html\n\thtml_log = html_log.replace(/
\\n\\n
\\n\\n'\n \t].join('\\n\\n');\n\thtml_log += styles;\n\n\t// add scripts\n\tlet scripts = [\n\t\t'\\n'\n \t].join('\\n');\n\thtml_log += scripts;\n\t\n\t// add footer\n\thtml_log +='\\n\\n';\n\n\tlet name = GMCP.Status.name;\n\tlet minutes = today.getMinutes();\n\tif (minutes < 10)\n\t minutes = '0'+minutes;\n\tlet time2 = today.getHours() + \"-\" + minutes;// + \"-\" + today.getSeconds();\n\tlet file = 'scog__'+name+'-Achaea__'+date+'__'+time2+'';\n\tif (suffix) {file += '__'+suffix;}\n\t\n\t// save log\n\tif (scog.download_file(file+'.html', html_log)) {\n display_notice(''+file+'.html downloaded.', 'olivedrab');\n return true;\n }\n else {\n display_notice('Scog failed to download.', 'red');\n return false;\n }\n};\n\n// auto on and off\nscog.toggle_auto = function (status) {\n let div = $(\"#footer #scog\");\n if (status) {\n // log pre-auto\n scog.save_file('auto-pre');\n // clear scrollback\n $('.output_scrollback').html('');\n\t\tdelete scog.blocks;\n // turn on auto\n scog.auto = true;\n div.css(\"color\", \"white\"); \n }\n else {\n // scog post-auto\n scog.save_file('auto-post');\n // turn off auto\n scog.auto = false;\n delete scog.auto_count;\n div.css(\"color\", \"brown\");\n }\n};"},{"type":"function","name":"onBlock","enabled":true,"id":8,"code":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\n// count blocks\nif (!scog.blocks)\n scog.blocks = 0;\nscog.blocks += 1;\n\n// escape if off\nif (!scog.auto)\n return;\n\n// get buffer count\nif (typeof client.scrollback_msg_limit != 'undefined')\n scog.settings.buffer = client.scrollback_msg_limit;\nlet limit = scog.settings.buffer;\nlimit = (limit/2)-(limit/2*.2);\n\n// scog if full\nif (scog.blocks >= limit) {\n // count scogs\n if (!scog.auto_count)\n scog.auto_count = 0;\n scog.auto_count += 1; \n // save scog\n scog.save_file('auto-'+scog.auto_count);\n // clear buffer\n $('.output_scrollback').html('');\n\tdelete scog.blocks;\n}"}],"actions":[]},{"type":"group","name":"Aliases","enabled":true,"id":13,"items":[{"type":"alias","name":"scog reload","enabled":true,"id":7,"matching":"regexp","whole_words":false,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"function","fn":"onLoad"}],"text":"^scog reload$"},{"type":"alias","name":"scog save ","enabled":true,"id":2,"matching":"regexp","whole_words":false,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\n// wildcards\nlet suffix = false;\nif (args)\n suffix = args[2];\n// save\nif (scog.save_file(suffix))\n\treturn true;"}],"text":"^scog save(| (.*?))$"},{"type":"alias","name":"scog auto on|off","enabled":true,"id":11,"matching":"regexp","whole_words":false,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\n// get parameter\nif (args)\n suffix = args[1];\nelse\n return;\n\n// toggle\nif (suffix == \"on\")\n scog.toggle_auto(true);\nelse\n scog.toggle_auto(false);"}],"text":"^scog auto (on|off)$"},{"type":"alias","name":"","enabled":true,"id":3,"matching":"exact","whole_words":false,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\n$('.output_scrollback').html('');\ndelete scog.blocks;"}],"text":"scog clear"},{"type":"alias","name":"","enabled":true,"id":6,"matching":"exact","whole_words":false,"case_sensitive":false,"prefix_suffix":true,"actions":[{"action":"script","script":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\n$('.output_scrollback').html('');\n$('.output_wrap .output').html('');\ndelete scog.blocks;"}],"text":"scog clear all"}],"actions":[]},{"type":"group","name":"Triggers","enabled":true,"id":14,"items":[{"type":"trigger","name":"qq","enabled":true,"id":9,"matching":"exact","whole_words":true,"case_sensitive":true,"text":"You feel your insides clench as your soul is frozen.","actions":[{"action":"script","script":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\nif (scog.auto)\n scog.save_file('auto-qq');"}]},{"type":"trigger","name":"dc","enabled":true,"id":12,"matching":"exact","whole_words":true,"case_sensitive":true,"text":"Connection has been closed. Click here to reconnect.","actions":[{"action":"script","script":"// Failsafe - fresh install\nif (typeof scog == 'undefined')\n send_command('scog reload');\n\nif (scog.auto)\n scog.save_file('auto-dc');"}]}],"actions":[]}]}