Tfppnotice

In the course of coding I need to put a bit of info on the screen, either something changes or I hit a function key to change invokes or whatever. I kept making echos for this but since they were non standard I found I missed them in battle spam. This little snipet of code from my Zmacro.tf file solves this problem and makes it easy to post something to the screen in a uh… pretty, formated notice.

Note: New version. Added level of 0 and 7 to the options. 7 is solid hired and 0 allows you to configure the highlights. This was due to my hp/sp/np monitor having 7 states and needed a easy way to format it.

;;; PPNotice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; /test PPNotice(<level>, <text>[, <attr1>, <attr2>])
; just formats a pretty player notice
; <level>=1 to 7 for blue, green, yellow, cyan, magenta, red and realred highlights
; <level>=0 to provide alternate attrs to the line
;
; examples:
;     /test PPNotice(6,"DREAM COUNT LOW")
;
;    /test PPNotice({colornotice}, \
;        "@{xCgreen}HP@{n}:$[dif_chp] @{xCmagenta}SP@{n}:$[dif_csp] \
;        @{xCyellow}NP@{n}:$[dif_cnp]")%;\
;
;    /test PPNotice(0,"You have been Snarfed","BCcyan","BCgreen")
;
/def PPNotice = \
    /let level=%1%; \
    /let notice=%2%; \
    /if (level = 1) \
        /let h1=@{Cblue}%; \
        /let h2=@{BCblue}%; \
    /elseif (level = 2) \
        /let h1=@{Cgreen}%; \
        /let h2=@{BCgreen}%; \
    /elseif (level = 3) \
        /let h1=@{Cyellow}%; \
        /let h2=@{BCyellow}%; \
    /elseif (level = 4) \
        /let h1=@{Ccyan}%; \
        /let h2=@{BCcyan}%; \
    /elseif (level = 5) \
        /let h1=@{Cmagenta}%; \
        /let h2=@{BCmagenta}%; \
    /elseif (level = 6) \
        /let h1=@{Cred}%; \
        /let h2=@{BCred}%; \
    /elseif (level = 7) \
        /let h1=@{BCred}%; \
        /let h2=@{BCred}%; \
    /elseif (level = 0) \
        /let h1=$[strcat("@{",{3},"}")]%; \
        /let h2=$[strcat("@{",{4},"}")]%; \
    /else \
        /test ppnotice(2, "Syntax for PPNotice is PPNotice(<1...7>, <text>)")%; \
        /return -1%; \
    /endif%; \
    /let x=@{n}%; \
    /let LeftArrow=$[strcat(h1,">",x,h2,">",x)]%; \
    /let RightArrow=$[strcat(h1,"<",x,h2,"<",x)]%; \
    /let LenNotice=$[strlen(decode_attr(notice))]%; \
    /let tempv=$[((76-LenNotice)/4)]%; \
    /let LeftSide=$[strrep({LeftArrow}, tempv)]%; \
    /let RightSide=$[strrep({RightArrow}, tempv)]%; \
    /eval /echo -p %LeftSide %h2%notice%x %RightSide
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License