Affects Sidebar: Difference between revisions
(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...") |
No edit summary |
||
(21 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]] | |||
This works in conjunction with my [[MSDP Script]] so you'll want to get that set up and working first. | |||
#EVENT {IAC SB MSDP AFFECTS} | =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. | |||
Edit my MSDP script [[https://dyrdex.com/index.php?title=MSDP_Script Here]], just add the line in bold below to this event: | |||
#EVENT {IAC SB MSDP AFFECTS} | |||
{ | |||
#unvariable {msdp_info[AFFECTS]}; | #unvariable {msdp_info[AFFECTS]}; | ||
#variable {msdp_affects_raw} {%1}; | #variable {msdp_affects_raw} {%1}; | ||
Line 20: | Line 69: | ||
}; | }; | ||
#unvar tmp; | #unvar tmp; | ||
#unvar msdp_affects_raw | #unvar msdp_affects_raw; | ||
#IF {&{ | '''#IF {&{affbar}} {draw_affects_sidebar};''' | ||
}; | }; | ||
---- | ---- | ||
==Affbar Code== | |||
<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 | #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 | #IF {$msdp_info[AFFECTS][$affect] < 50} {#var SpellRoundsColor {<dbb>}}; | ||
#IF {$msdp_info[AFFECTS][$affect] > 99} {#var | #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} | ||
{ | {$SpellNameColor}{$affect} | ||
{$ | {$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 | #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 68: | Line 109: | ||
#DRAW box $affects_Row1 -$affects_Col1 -$affects_Row2 -$affects_Col2 $affects[1..-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} { | #ALIAS {affbar} { | ||
Line 75: | Line 131: | ||
screen_refresh; | screen_refresh; | ||
#VAR {screen[original_right_split]} {$screen[split_right]}; | #VAR {screen[original_right_split]} {$screen[split_right]}; | ||
draw_affects_sidebar; | draw_affects_sidebar; | ||
}; | }; | ||
Line 84: | Line 139: | ||
}; | }; | ||
} | } | ||
</pre> |
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
- Edit my 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.
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]; }; }