Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Run this from the feedback page, through your browser's development console, usually opened by CTRL+SHIFT+J.
- // This will "download" a .cfg file, save it in /Team Fortress 2/tf/cfg/
- // Load up your map in TF2 and type in "exec _burg_show_fb_YOURMAPNAME.cfg"
- // This should give you visible notes, green lasers representing feedback sightlines, and general feedback in the console.
- function download(data, filename) {
- let a = document.createElement('a');
- a.href = window.URL.createObjectURL(new Blob([data]));
- a.setAttribute('download', filename);
- document.body.appendChild(a);
- setTimeout(() => {
- a.click();
- document.body.removeChild(a);
- setTimeout(() => {
- window.URL.revokeObjectURL(a.href);
- }, 250);
- }, 66);
- return true;
- }
- function escStrQ(s) {return s.replace(/[";]/g, '')}
- function escStr(s) {return s.replace(/[;]/g, '')}
- function addCmd(cmd) {cfg+=escStr(cmd)+'\n'}
- function addAnnot(look, pos, disp) {
- disp = escStrQ(disp);
- addCmd('setpos_exact ' + look);
- addCmd('ent_create training_annotation origin "' + look + '" lifetime -1 offset 0 display_text "' + disp + '"');
- addCmd('ent_create info_target targetname _t' + t_iter);
- t_iter++;
- // Raise laser position to player view
- pos = pos.split(' ');
- pos[2] = parseFloat(pos[2]) + 71; // Raise start Z by average class eye height (71)
- pos = pos.join(' ');
- addCmd('setpos_exact ' + pos);
- addCmd('ent_create env_beam targetname _t' + t_iter + ' spawnflags 1 life 0 BoltWidth 2 LightningStart _t' + t_iter + ' LightningEnd _t' + (t_iter - 1) + ' tripwire 0 renderamt 255 rendercolor "0 255 0" damage 0 ClipType 0 NoiseAmplitude 0 texture sprites/laserbeam.spr');
- t_iter++;
- }
- var comments = document.getElementsByClassName('comments')[0].children;
- var map = window.top.location.href.split("/")[4];
- var gf = [];
- var fb = [];
- var cfg = '';
- var t_iter = 0;
- for (let i = 0; i < comments.length; i++) {
- let has_coords = comments[i].children[1].innerText.indexOf("made an annotation at") != -1;
- let commenter = comments[i].children[1].children[1].children[0].innerText;
- let comment = comments[i].children[2].innerText;
- if (has_coords) {
- let look = comments[i].children[1].children[1].children[1].innerText;
- let pos = comments[i].children[1].children[1].children[2].innerText;
- fb.push([commenter, comment, look, pos]);
- } else {
- gf.push([commenter, comment]);
- }
- }
- addCmd('sv_cheats 1;sv_allow_wait_command 1;setang_exact 90 0 0;con_filter_text_out "Failed to load sound";con_filter_enable 1');
- addCmd('echo ==================== General feedback ====================');
- for (let i = 0; i < gf.length; i++) {
- addCmd('echo ' + gf[i][0] + ': ' + gf[i][1]); // AUTHOR: TEXT
- }
- addCmd('echo ==========================================================');
- for (let i = 0; i < fb.length; i++) {
- addAnnot(fb[i][2], fb[i][3], fb[i][1] + ' - ' + fb[i][0]); // TEXT - AUTHOR
- }
- addCmd('ent_fire training_annotation Show');
- // addCmd('con_filter_text_out ""');
- // addCmd('con_filter_enable 0');
- download(cfg, '_burg_show_fb_' + map + '.cfg'/*, 'text/plain'*/);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement