Affects Sidebar: Difference between revisions

From Dyrdex.com
Jump to navigation Jump to search
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
This code creates a right-hand sidebar containing your affects list.  
This code creates a right-hand sidebar containing your affects list.  
[[Image:Affbar.PNG]]


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.


=Auto-Update=
This works in conjunction with my [[MSDP Script]] so you'll want to get that set up and working first.
 
 
=Usage=
Toggle the sidebar on/off by typing 'affbar'. It will open a new sidebar and not disrupt any existing sidebars you may already have.
 
'''Syntax:''' affbar
 
 
 
=Installation=
 
# Edit my MSDP script [[https://dyrdex.com/index.php?title=MSDP_Script Here]] per the Auto-Updater section below
#* #READ msdp.tin before connecting to the mud.
# Create a new file and copy/paste all the Affbar Code section below into it.
#* #READ filename.tin after connecting to the mud.
# Run 'affbar' to toggle the sidebar on/off
 
=Troubleshooting=
If you have problems, please do the following:
 
# open tintin, and read in the msdp.tin file
# connect to the mud
# read in the affbar.tin script
# run affbar
 
Check if these vars exist and contain data or not.
 
# Run #var msdp_info 
# Run #var screen 
# Run #line debug get_affects
# Run #var affects
 
If you run into a problem, check those first and let me know where you are seeing a problem.
 
Also... (and this has fooled me multiple times...) -- make sure your character as some spells on! duh!
 
=Custom Colors=
The formatting of the list is done in the get_affects alias, edit that however you like to change colors based on spell name or duration remaining:
 
Look at the various #IF statements in there, and #IF <whatever> set the SpellNameColor or SpellRoundsColor var to what you prefer.
 
I set you up with some basic settings there: sanctuary spells will be colored white. Spells will be grey if greater than 99 rounds remain, then change to yellow, then red if under 49 rounds remaining.
 
Adjust to taste.
 
 
=CODE:=
==MSDP Auto Updater==
To get this to auto-update as spells tick down, you can fire a re-draw based on the msdp reception of the affects string.  
To get 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:
Edit my MSDP script [[https://dyrdex.com/index.php?title=MSDP_Script Here]], just add the line in bold below to this event:




Line 22: Line 69:
     };
     };
     #unvar tmp;
     #unvar tmp;
     #unvar msdp_affects_raw
     #unvar msdp_affects_raw;
     '''#IF {&{affbar}} {draw_affects_sidebar};'''
     '''#IF {&{affbar}} {draw_affects_sidebar};'''
  };
  };
=Customization=
The formatting of the list is done in the get_affects alias, edit that however you like.
It basically just builds a list at $affects, do #var affects to view it. Get that looking however you want.




=CODE:=
----
----
==Affbar Code==
<pre>
<pre>
#ALIAS get_affects {
#ALIAS get_affects {
         #LIST affects clear;
         #LIST affects clear;
        #VAR SpellNameColor {<bbb>};
         #FOREACH {*msdp_info[AFFECTS][]} {affect}
         #FOREACH {*msdp_info[AFFECTS][]} {affect}
         {
         {
                 #IF {$msdp_info[AFFECTS][$affect] < 50} {#var Color {<dbb>}};
                #IF {"*msdp_info[AFFECTS][$affect]" == "{sanctuary|nadur dion|prophetic aura|sacral divinity|greater sanctuary|holy sanctity}"} {#var SpellNameColor {<fff>}} {#var SpellNameColor {<ddd>}};
                 #IF {$msdp_info[AFFECTS][$affect] > 49 && $msdp_info[AFFECTS][$affect] < 99} {#var Color {<ffd>}};
                 #IF {$msdp_info[AFFECTS][$affect] < 50} {#var SpellRoundsColor {<dbb>}};
                 #IF {$msdp_info[AFFECTS][$affect] > 99} {#var Color {<ddd>}};
                 #IF {$msdp_info[AFFECTS][$affect] > 49 && $msdp_info[AFFECTS][$affect] < 99} {#var SpellRoundsColor {<ffd>}};
                 #IF {$msdp_info[AFFECTS][$affect] > 99} {#var SpellRoundsColor {<ddd>}};
                 #FORMAT {affect_line} {%c%+15.15s %c%-4s%c}
                 #FORMAT {affect_line} {%c%+15.15s %c%-4s%c}
                         {<bbb>}{$affect}
                         {$SpellNameColor}{$affect}
                         {$Color}{$msdp_info[AFFECTS][$affect]}{<ddd>};
                         {$SpellRoundsColor}{$msdp_info[AFFECTS][$affect]}{<ddd>};
                 #CLASS null assign #LIST {affects} {add} {<ddd>$affect_line};
                 #CLASS null assign #LIST {affects} {add} {<ddd>$affect_line};
         };
         };
         #UNVAR Color;
         #UNVAR SpellNameColor;
        #UNVAR SpellRoundsColor;
         #UNVAR affect_line;
         #UNVAR affect_line;
};
};


#ALIAS {draw_affects_sidebar} {
#ALIAS {draw_affects_sidebar} {
        get_affects;
         #IF {!&{screen}} {screen_refresh};
         #IF {!&{screen}} {screen_refresh};
         #MATH {screen[split_right_total]} {$screen[split_right] + 24};
         #MATH {screen[split_right_total]} {$screen[split_right] + 24};
Line 83: Line 131:
                 screen_refresh;
                 screen_refresh;
                 #VAR {screen[original_right_split]} {$screen[split_right]};
                 #VAR {screen[original_right_split]} {$screen[split_right]};
                get_affects;
                 draw_affects_sidebar;
                 draw_affects_sidebar;
                 };
                 };

Latest revision as of 13:14, 23 November 2023

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


This works in conjunction with my MSDP Script so you'll want to get that set up and working first.


Usage

Toggle the sidebar on/off by typing 'affbar'. It will open a new sidebar and not disrupt any existing sidebars you may already have.

Syntax: affbar


Installation

  1. Edit my MSDP script [Here] per the Auto-Updater section below
    • #READ msdp.tin before connecting to the mud.
  2. Create a new file and copy/paste all the Affbar Code section below into it.
    • #READ filename.tin after connecting to the mud.
  3. Run 'affbar' to toggle the sidebar on/off

Troubleshooting

If you have problems, please do the following:

  1. open tintin, and read in the msdp.tin file
  2. connect to the mud
  3. read in the affbar.tin script
  4. run affbar

Check if these vars exist and contain data or not.

  1. Run #var msdp_info
  2. Run #var screen
  3. Run #line debug get_affects
  4. Run #var affects

If you run into a problem, check those first and let me know where you are seeing a problem.

Also... (and this has fooled me multiple times...) -- make sure your character as some spells on! duh!

Custom Colors

The formatting of the list is done in the get_affects alias, edit that however you like to change colors based on spell name or duration remaining:

Look at the various #IF statements in there, and #IF <whatever> set the SpellNameColor or SpellRoundsColor var to what you prefer.

I set you up with some basic settings there: sanctuary spells will be colored white. Spells will be grey if greater than 99 rounds remain, then change to yellow, then red if under 49 rounds remaining.

Adjust to taste.


CODE:

MSDP Auto Updater

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

Edit my MSDP script [Here], just add the line in bold below to this event:


#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_sidebar};
};



Affbar Code

#ALIAS get_affects {
        #LIST affects clear;
        #VAR SpellNameColor {<bbb>};
        #FOREACH {*msdp_info[AFFECTS][]} {affect}
        {
                #IF {"*msdp_info[AFFECTS][$affect]" == "{sanctuary|nadur dion|prophetic aura|sacral divinity|greater sanctuary|holy sanctity}"} {#var SpellNameColor {<fff>}} {#var SpellNameColor {<ddd>}};
                #IF {$msdp_info[AFFECTS][$affect] < 50} {#var SpellRoundsColor {<dbb>}};
                #IF {$msdp_info[AFFECTS][$affect] > 49 && $msdp_info[AFFECTS][$affect] < 99} {#var SpellRoundsColor {<ffd>}};
                #IF {$msdp_info[AFFECTS][$affect] > 99} {#var SpellRoundsColor {<ddd>}};
                #FORMAT {affect_line} {%c%+15.15s %c%-4s%c}
                        {$SpellNameColor}{$affect}
                        {$SpellRoundsColor}{$msdp_info[AFFECTS][$affect]}{<ddd>};
                #CLASS null assign #LIST {affects} {add} {<ddd>$affect_line};
        };
        #UNVAR SpellNameColor;
        #UNVAR SpellRoundsColor;
        #UNVAR affect_line;
};



#ALIAS {draw_affects_sidebar} {
        get_affects;
        #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];
        }

#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;
        }

#EVENT {SCREEN RESIZE} {
        #buffer end;
        #IF {&{affbar}} {draw_affects_sidebar};
        };


#ALIAS {affbar} {
        #IF {!&{affbar}} {
                #NOP if not already on, turn on;
                #VAR affbar 1;
                screen_refresh;
                #VAR {screen[original_right_split]} {$screen[split_right]};
                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];
                };
        }