Affects Sidebar

From Dyrdex.com
Revision as of 18:27, 7 November 2022 by Admin (talk | contribs) (Created page with "This code creates a right-hand sidebar containing your affects list. You can toggle it on/off on the fly. It will not disrupt any existing right-hand sidebars you have set up. '''Usage:''' just type 'affbar' to toggle it on/off. If you would like this to auto-update as spells tick down, you can fire a re-draw based on the msdp reception of the affects string. In my MSDP script, just add the line in bold below to this event: #EVENT {IAC SB MSDP AFFECTS} { #un...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This code creates a right-hand sidebar containing your affects list.

You can toggle it on/off on the fly. It will not disrupt any existing right-hand sidebars you have set up.

Usage: just type 'affbar' to toggle it on/off.

If you would like this to auto-update as spells tick down, you can fire a re-draw based on the msdp reception of the affects string.

In my MSDP script, just add the line in bold below to this event:

  1. EVENT {IAC SB MSDP AFFECTS}

{

   #unvariable {msdp_info[AFFECTS]};
       #variable {msdp_affects_raw} {%1};
       #replace {msdp_affects_raw} {\a\a} {;};
       #replace {msdp_affects_raw} {\a} {;};
   #foreach {$msdp_affects_raw} {tmp} 
   {
       #regex {$tmp} {%*,%d} {#var msdp_info[AFFECTS][&1] &2} {#NOP};
   };
   #unvar tmp;
   #unvar msdp_affects_raw
   #IF {&{$affbar}} {draw_affects_bar};

};


SCRIPT:


  1. ALIAS screen_refresh {
       #CLASS null open;
       #SCREEN get split_top_bar screen[split_top];
       #SCREEN get split_bot_bar screen[split_bot];
       #SCREEN get split_left_bar screen[split_left];
       #SCREEN get split_right_bar screen[split_right];
       #CLASS null close;
       }
  1. EVENT {SCREEN RESIZE} {
       screen_refresh;
       #buffer end;
       };
  1. ALIAS get_affects {
       #LIST affects clear;
       #FOREACH {*msdp_info[AFFECTS][]} {affect}
       {
               #IF {$msdp_info[AFFECTS][$affect] < 50} {#var Color {<dbb>}};
               #IF {$msdp_info[AFFECTS][$affect] > 49 && $msdp_info[AFFECTS][$affect] < 99} {#var Color {<ffd>}};
               #IF {$msdp_info[AFFECTS][$affect] > 99} {#var Color {<ddd>}};
               #FORMAT {affect_line} {%c%+15.15s %c%-4s%c}
                       {<bbb>}{$affect}
                       {$Color}{$msdp_info[AFFECTS][$affect]}{<ddd>};
               #CLASS null assign #LIST {affects} {add} {<ddd>$affect_line};
       };
       #UNVAR Color;
       #UNVAR affect_line;

};

  1. ALIAS {draw_affects_sidebar} {
       #IF {!&{screen}} {screen_refresh};
       #MATH {screen[split_right_total]} {$screen[split_right] + 24};
       #SPLIT $screen[split_top] $screen[split_bot] $screen[split_left] $screen[split_right_total];
       #MATH {affects_Row1} {$screen[split_top] + 1};
       #MATH {affects_Col1} {$screen[split_right_total] - 1};
       #MATH {affects_Row2} {$screen[split_bot] + 2};
       #MATH {affects_Col2} {$screen[original_right_split] + 1};
       #DRAW box $affects_Row1 -$affects_Col1 -$affects_Row2 -$affects_Col2 $affects[1..-1];
       }
  1. ALIAS {affbar} {
       #IF {!&{affbar}} {
               #NOP if not already on, turn on;
               #VAR affbar 1;
               screen_refresh;
               #VAR {screen[original_right_split]} {$screen[split_right]};
               get_affects;
               draw_affects_sidebar;
               };
       #ELSE {
               #NOP if already on, turn off;
               #UNVAR affbar;
               #split $screen[split_top] $screen[split_bot] $screen[split_left] $screen[original_right_split];
               };
       }