Fancy Archaea Prompt

From Gwen Morse's Wiki
Jump to: navigation, search

Original source http://forums.achaea.com/index.php?showtopic=38178

/visual on

/set status_height=2
/set isize=2
/set status_pad= 
/status_add -r0 -c blanks::Cgray
/status_add -r1 -c prompt_health:19:Cgreen
/status_add -r1 prompt_mana:19:Ccyan
/status_add -r1 prompt_endurance:19:Cyellow
/status_add -r1 prompt_willpower:19:Cblue
/status_add -r1 prompt_balance:10:Ccyan

/test blanks := strrep("-", 200)

/if (!isvar('max_health')) /set max_health=5000 %; /endif
/if (!isvar('max_mana')) /set max_mana=5000 %; /endif

/def -F -mregexp -t"^Health: +([0-9]+) ?/ ?([0-9]+) +Mana: +([0-9]+) ?/ ?([0-9]+)" max_health = \
/set max_health=$[{P2}+0] %; \
/set max_mana=$[{P4}+0] %;
/def -F -mregexp -t"^Endurance: +([0-9]+) ?/ ?([0-9]+) +Willpower: +([0-9]+) ?/ ?([0-9]+)" max_endurance= \
/set max_endurance=$[{P2}+0] %; \
/set max_willpower=$[{P4}+0] %;

/def -mregexp -Fp1000 -h"PROMPT ([0-9]+)h, ([0-9]+)m, ([0-9]+)e, ([0-9]+)w (.*)-" normal_prompt = \
;	uncomment the next line if you want to see the prompt in the message area
;	/eval /echo %{*} %; \
;	uncomment the next line if you want to see the prompt where you type
;	/test prompt({*}) %; \
/set health=%{P1} %; \
/set mana=%{P2} %; \
/set endurance=%{P3} %; \
/set willpower=%{P4} %; \
/set prompt_health=$[make_graph_prompt({P1}, {max_health})] %; \
/set prompt_mana=$[make_graph_prompt({P2}, {max_mana})] %; \
/set prompt_endurance=$[make_graph_prompt({P3}, {max_endurance})] %; \
/set prompt_willpower=$[make_graph_prompt({P4}, {max_willpower})] %; \
/set prompt_balance=$[strip_attr({P5})] %;\
/if ({P1} * 1.0 / {max_health} > 0.5) \
/eval /status_edit prompt_health:$[columns()/2-5]:Cgreen %; \
/elseif ({P1} * 1.0 / {max_health} > 0.25) \
/eval /status_edit prompt_health:$[columns()/2-5]:Cyellow %; \
/else \
/eval /status_edit prompt_health:$[columns()/2-5]:Cred %; \
/endif %; \
/eval /status_edit -r1 prompt_mana:$[columns()/2-5]:Ccyan %; \

/def make_graph_prompt = \
/let tlength=$[columns()/2-15] %; \
/let length=$[trunc(1.0 * {1} / {2} * tlength)] %; \
/let string=[ %; \
/test string := strcat(string, strrep("#",length-1)) %; \
/test string := strcat(string, strrep(":",tlength-length)) %; \
/test string := strcat(string, "] ", pad({1}, 4)) %; \
/result "%{string}"