jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Thu Dec 09, 2004 8:34 pm
Medieiva - CaebUtils - This is required for all my others |
CaebUtils v1.0 - All my scripts will need this please install first if you use my scripts
To Install: Copy and paste into a file , save it in your root zmud directory and type #READ <filename>
Brief explanation of some of the scripts included
CaebPrompt - Has a prompt trigger that will work for most prompts on medievia as long as you have #hp #m or #/#hp #/#m on prompt line. If you don't then you will have to change the trigger to work for you. It makes variables for you hps and mana and also has an action alias that you can use to add / remove actions you want run when you get your prompt cpaddaction [alias name] cpremoveaction [aliasname]
CaebColor - Function used to generate ANSI color codes for chatting to zmud users.
Themer - This is a color themer that any script can use , to use it for your own scripts you first have to make you script _themeable_ for example will make a little script that when the person uses the alias it shows HI [%1]!
first we make a color list(MUST USE CAEBCOLOR)
Code: |
#VAR mytheme {@CC(bold,green)|@CC(bold,white)|@CC(bold,yellow)} |
now another list that holds the corresponding theme colors from this list:
1.Blue 2.Green 3.Cyan
4.Red 5.Magenta 6.Yellow
7.White 8.Bright Black 9.Bright Blue
10.Bright Green 11.Bright Cyan 12.Bright Red
13.Bright Magenta 14.Bright Yellow 15. Bright White
Code: |
#VAR mytheme1 {10|15|14} |
now the alias: Notice how we don't hard code the colors we use the color list this makes it themable
Code: |
#ALIAS showhi {#SHOW @mytheme.1"HI"@mytheme.2"%-1"@mytheme.3"!"} |
now we write another list that holds the explanations for each color in the list
Code: |
#VAR mythemeexplain {"The Color of HI"|"The Color of NAME"|"Exclamation point"} |
and finally we write a function that produces an example of our theme
Code: |
#FUN myexample {@mytheme.1"HI"@mytheme.2"JOE"@mytheme.3"!"} |
Now we have to write 2 aliases that the user of you script will use to access the themer one changes color the other shows the current theme
Lets write the color changer:
we call the themer alias cthchange %1 %2 [THEME LIST] [COLOR LIST] [NAME OF SHOW THEME ALIAS] [CLASS TO PUT THEMES IN]
Code: |
#ALIAS hichangecolor {cthchange %1 %2 mytheme1 mytheme hishowtheme "MYCLASS"} |
Lets write the viewer now we call cthshow [NAME OF SCRIPT] [THEME LIST] [COLOR LIST] [EXAMPLE] [EXPLAIN LIST] [COLOR CHANGE ALIAS]
Code: |
#ALIAS showhitheme {cthshow "My Show Hi Script" mytheme1 mytheme myexample mythemeexplain hichangecolor} |
Now the actual script:
Code: |
;;CaebUtilities v1.1 -12/05/04-
#DELCLASS "CaebUtils"
#CLASS "CaebUtils"
#VAR CaebUtils_Version 1.1
#CLASS 0
#CLASS "CaebUtils|CaebPrompt"
#TRIGGER {(?:[^0-9])(\d+)(?:/\d+)?hp (\d+)(?:/\d+)?m} {
#PRIORITY {
#VAR cpoldhp @cphp NA "CaebUtils|CaebPrompt"
#VAR cphp %1 NA "CaebUtils|CaebPrompt"
#VAR cpmana %2 NA "CaebUtils|CaebPrompt"
#IF (@cprunactions) {
@cprunactions
}
}
} "" {regex|prompt|nocr}
#ALIAS cpremoveaction {
#VAR cpactions %delitem(%1,@cpactions) _nodef "CaebUtils|CaebPrompt"
#VAR cprunactions %replace(@cpactions,"|",";") _nodef "CaebUtils|CaebPrompt"
}
#ALIAS cpaddaction {
#IF (!%ismember(%1,@cpactions)) {
#VAR cpactions %additem(%1,@cpactions) _nodef "CaebUtils|CaebPrompt"
#VAR cprunactions %replace(@cpactions,"|",";") _nodef "CaebUtils|CaebPrompt"
}
}
#CLASS 0
#CLASS "CaebUtils|CaebPkDetect"
#VAR CaebPkDetect_Version 1.0
#VAR cpdpk LPK LPK
#VAR cpdcolors "@CC(bold,green)|@CC(bold,yellow)|@CC(bold,red)"
#VAR cpdpklist "LPK|NPK|CPK"
#TRIG {You are leaving a PLAYER KILLING Area.} {#VAR cpdpk LPK LPK "CaebUtils|CaebPkDetect"}
#TRIG {WARNING! You HAVE ENTERED a CHAOTIC PLAYER} {#VAR cpdpk CPK LPK "CaebUtils|CaebPkDetect"}
#TRIG {You HAVE LEFT a CHAOTIC*AREA and ENTERED a NEUTRAL} {#VAR cpdpk NPK LPK "CaebUtils|CaebPkDetect"}
#TRIG {You HAVE ENTERED a NEUTRAL PLAYER KILLING Area!} {#VAR cpdpk NPK LPK "CaebUtils|CaebPkDetect"}
#FUN colorpk {%item(@cpdcolors,%ismember(@cpdpk,@cpdpklist))@cpdpk}
#CLASS 0
#CLASS "CaebUtils|CaebMsg"
#VAR CaebMsg_Version 1.0
#ALIAS cmgcreate {
#VAR cmgmessage {@CC(bold,blue)(@CC(bold,cyan)%1@CC(bold,blue)) @CC(bold,white)%2} "" "CaebUtils|CaebMsg"
#FORALL %3 {
#VAR cmgmessage {%replace(@cmgmessage,%i,@CC(bold,yellow)%i@CC(bold,white))} "" "CaebUtils|CaebMsg"
}
}
#ALIAS cmsg {cmgcreate %1 %2 %3;#SHOW @cmgmessage}
#CLASS 0
#CLASS "CaebUtils|HelpHelp"
#VAR HelpHelp_Version 1.0
#VAR hhcolor {@CC(bold,green)|@CC(green)|@CC(bold,cyan)|@CC(bold,yellow)|@CC(yellow)|@CC(blue)}
#FUN hhtitle {" "@hhcolor.1"%1" @hhcolor.2"by Caebryn of Medievia."%crlf}
#FUN hhline {%item(@hhcolor,4)+%item(@hhcolor,5)%repeat("-",78)%crlf}
#FUN hhentry {" "%format(%concat(@hhcolor.3,"&-20s",@hhcolor.5,"&-2s",@hhcolor.4,"&-59s"),"%1","%2","%3")%crlf}
#CLASS 0
#CLASS "CaebUtils|Help"
#ALIAS cuhelpcreate {
#VAR cuhlpmsg @hhtitle(%concat("Caeb Utilities v",@CaebUtils_Version," List of scripts")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhline) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhentry(%concat("Caeb Prompt v",@CaebPrompt_Version),"-","Prompt script for Medievia")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhentry(%concat("Caeb Pk Detect v",@CaebPkDetect_Version),"-", "Simple Pk Detection Script for Medievia")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhentry(%concat("Caeb Message v", @CaebMsg_Version),"-","Message colorer for CaebScripts")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhentry(%concat("Help Help v",@HelpHelp_Version),"-","Formats for Help Files like this")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhentry(%concat("Caeb Color v",@CaebColor_Version),"-","Color script for correctly reporting color over chat.")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhentry(%concat("Caeb Themer v",@CaebThemer_Version),"-","Color Themer for CaebScripts")) _nodef "CaebUtils|Help"
#VAR cuhlpmsg %concat(@cuhlpmsg, @hhline) _nodef "CaebUtils|Help"
}
#ALIAS cuhelp {
#SHOW @cuhlpmsg
}
#CLASS 0
#CLASS "CaebUtils|CaebColor"
#VAR CaebColor_Version 3.1
#VAR CCTypeList {bold|reset}
#VAR CCNameList {black|blue|green|cyan|red|magenta|yellow|white|reset|bold}
#VAR CCForeList {30|34|32|36|31|35|33|37|0|1}
#VAR CCBackList {40|44|42|46|41|45|43|47}
#FUN CCFore {%item(@CCForeList,%ismember(%1,@CCNameList))}
#FUN CCBack {%item(@CCBackList,%ismember(%1,@CCNameList))}
#FUN CaebColor {%if(%3,@CC3(%1,%2,%3),%if(%2,@CC2(%1,%2),@CC1(%1)))}
#FUN CC {%if(%3,@CC3(%1,%2,%3),%if(%2,@CC2(%1,%2),@CC1(%1)))}
#FUN CC1 {%e[@CCFore(reset);@CCFore(%1)m}
#FUN CC2 {%if(%ismember(%1,@CCTypeList),@CC2FC(%1,%2),@CC2BG(%1,%2))}
#FUN CC3 {%e[@CCFore(%1);@CCFore(%2);@CCBack(%3)m}
#FUN CC2FC {%e[@CCFore(%1);@CCFore(%2)m}
#FUN CC2BG {%e[@CCFore(%1);@CCBack(%2)m}
#CLASS 0
#CLASS "CaebUtils|CaebThemer"
#FUN cthtitle {@CC(bold,cyan)Color Theme for @CC(bold,white)"%1"%crlf}
#VAR CaebThemer_Version 1.0
#VAR cthcolors {[0;34m|[0;32m|[0;36m|[0;31m|[0;35m|[0;33m|[0;37m|[1;30m|[1;34m|[1;32m|[1;36m|[1;31m|[1;35m|[1;33m|[1;37m}
#VAR cthnames {Blue|Green|Cyan|Red|Magenta|Yellow|White|Bright Black|Bright Blue|Bright Green|Bright Cyan|Bright Red|Bright Magenta|Bright Yellow|Bright White}
#ALIAS cthshow {
#VAR cthtemp 0 0 "CaebUtils|CaebThemer"
#VAR cthdisplay @cthtitle("%1") "" "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,blue),%repeat("-",%eval(70 + %len(%5))),%crlf) "" "CaebUtils|CaebThemer"
#FORALL @%2 {
#VAR cthtemp %eval(@cthtemp + 1) 0 "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(cyan),%if(@cthtemp < 10," ",""),@cthtemp,".",@cthcolors.%i,%format("&-15s",@cthnames.%i),@CC(cyan),%item(@%4,@cthtemp),%crlf) _nodef "CaebUtils|CaebThemer"
}
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,blue),%repeat("-",%eval(70 + %len(%5))),%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,cyan),"Example:",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@%3,%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,blue),%repeat("-",%eval(70 + %len(%5))),%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,cyan),"Color List:",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@cthcolors.1" 1.Blue "@cthcolors.2" 2.Green "@cthcolors.3" 3.Cyan",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@cthcolors.4" 4.Red "@cthcolors.5" 5.Magenta "@cthcolors.6" 6.Yellow",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@cthcolors.7" 7.White "@cthcolors.8" 8.Bright Black "@cthcolors.9"9.Bright Blue",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@cthcolors.10"10.Bright Green "@cthcolors.11"11.Bright Cyan "@cthcolors.12"12.Bright Red",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@cthcolors.13"13.Bright Magenta "@cthcolors.14"14.Bright Yellow "@cthcolors.15"15. Bright White",%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,blue),%repeat("-",%eval(70 + %len(%5))),%crlf) _nodef "CaebUtils|CaebThemer"
#VAR cthdisplay %concat(@cthdisplay,@CC(bold,white),"To Change A Color of The Theme Type ",@CC(bold,yellow),%5," (Theme Number) (New Color Number)") _nodef "CaebUtils|CaebThemer"
#SHOW @cthdisplay
}
#ALIAS cthchange {#IF (%isnumber(%1) && %isnumber(%2)) {
#IF (%1 < %numitems(@%3) && %1 > 0) {
#IF (%2 < 16 && %2 > 0) {
#VAR {%3} {%replaceitem(%2,%1,@%3)} _nodef {%6}
#LOOP 1,%numitems(@%4) {
#VAR {%4} {%replaceitem(%item(@cthcolors,%item(@%3,%i)),%i,@%4)} _nodef {%6}
}
#EXEC %5
} {
#SHOW {@CC(blue)(@CC(bold,cyan)CaebThemer@CC(blue)) @CC(bold,white)Color choice must between 1 & 15}
}
} {
#SHOW {@CC(blue)(@CC(bold,cyan)CaebThemer@CC(blue)) @CC(bold,white)Color choice must between 1 & %numitems(@%3)}
}
} {
#SHOW {@CC(blue)(@CC(bold,cyan)CaebThemer@CC(blue)) @CC(bold,white)Syntax is ~<Number of the Theme Item to Change~> ~<Number of the color to replace it with~>}
}
}
#CLASS 0
cuhelpcreate
#SHOW {%ansi(bold,blue)(%ansi(bold,cyan)Install Complete%ansi(bold,blue)) %ansi(bold,white)Typing %ansi(bold,yellow)cuhelp%ansi(bold,white) will list the scripts including with CaebUtilities}
|
|
|