Stat Checker Databases

From AvatarWiki
Revision as of 12:55, 12 September 2014 by Ivrin (talk | contribs)
Jump to navigation Jump to search

This is a script set that allows you to capture characters' stats in databases and then anyone can check said stats at any given time through buddy, gtell or tell commands.

Download the following file, and import into cmud settings by using the Import XML option. Media:Stat_Checker_Database_Set.xml‎

Alternatively, copy the below preformat block into your favourite text editor, save the file as .xml and then import said file into cmud.

WARNING: This script comes brand new with no pre-loaded characters or databases, so you must capture and capture and capture to populate them.
If you are lazy and wish to get mine for your own use you are welcome to it:Media:CharDBs.xml‎ Check back here for updated versions of this file.

Below is a list of commands and how things work. Commands are enclosed in single quotes, which are to be ommited when entering the command along with < and > signs.

'_updates' to toggle the beckon trigger and allow people to automatically add their alts. Type once to turn it on, again to turn it off. Echo will aid you. This is good to have on your bot set so people can add themselves to your databases.

'_update' to manually add all current group members to the statChecker databases.

'_loadNotes <character> <notes text>' to set the special NOTES field for a specific character. eg. '_loadNotes Naimon He is an awesome tank.' will set naimon's notes, which will then show up next time someone searches for Naimon.

The way this works is you/others have to either GTELL, BUDDY or TELL YOU 'stats.charname' and you will reply in the appropiate channel with those characters stats. eg. 'buddy stats.Naimon' Please note you have to be in the same group or buddyset for this to work, obviously.

StatCheckIMG.png

There are optional keywords to fetch specific data from the dbs. For instance you can do 'buddy stats.naimon.hp' to see only their hp, etc.
When the automatic update toggle is set to on, anyone can 'beckon you' then 'gtell update.stats' to add themselves and all their group members to your databases.

This set comes loaded with a THEME implementation, there is a theme folder where you have a database in which you can fill in 6 different color values which are used to color the report aliases. You can insert these into your scripts by using the syntax @COL1 - @COL6. Additionally, there is a database with all valid AVATAR colors to simplify your coloring even further, use these by inserting the color codes into your scripts like so: @B for |b|, @BC for |bc| and so on and so forth. This can be helpful since the | pipe character is a delimiter used by CMUD and can cause conflicts. All these things will be compatible with other script sets I plan to release in the future.

For more info or for contructive criticism please email me at tuataur@gmail.com or note Ivrin on board 2.

This set will be needed to have full functionality of my upcoming group-health monitor-window scripts.

Enjoy

This part of my Ivrin's Scripts upcoming series.




EDITS: Can no longer query for berserker mana, error message given. When querying to full stat report, if char is bzk mana will not be shown

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="statChecker">
    <notes><![CDATA[Hello and welcome to statChecker beta.

Bellow is a list of commands and how things work. Commands are enclosed in single quotes, which are to be ommited when entering the command along with < and > signs.

'_updates' to toggle the beckon trigger and allow people to automatically add their alts. Type once to turn it on, again to turn it off. Echo will aid you. This is good to have on your bot set so people can add themselves to your databases.

'_update' to manually add all current group members to the statChecker databases.

'_loadNotes <character> <notes text>' to set the special NOTES field for a specific character. eg. '_loadNotes Naimon He is an awesome tank.' will set naimon's notes, which will then show up next time someone searches for Naimon.

The way this works is you/others have to either GTELL, BUDDY or TELL YOU 'stats.charname' and you will reply in the appropiate channel with those characters stats. eg. 'buddy stats.Naimon' Please note you have to be in the same group or buddyset for this to work, obviously.
There are optional keywords to fetch specific data from the dbs. For instance you can do 'buddy stats.naimon.hp' to see only their hp, etc.


For more info or for contructive criticism please email me at tuataur@gmail.com or note Ivrin on board 2.

This set will be needed to have full functionality of my upcoming group-health monitor window scripts.

Enjoy

]]></notes>
    <class name="record_capture" enabled="false">
      <trigger priority="320">
        <pattern>(*)|(*) {Lord|Hero|Lgnd|Mob |%w } (%w)(%s)({STUN!|DROWN|Fight|Sleep|Stand|Rest|Rest }) ({%d|%n})/({%d|%n})%s({%d|%n})/({%d|%n})%s(%d)/({%d|%n})%s(%d)%s({%d|%n|?????})</pattern>
        <value>#CLASS {statChecker|statdbs|%3};
#ADDKEY %3_DB HP %7;
#ADDKEY %3_DB MP %9;
#ADDKEY %3_DB MV %11;
#ADDKEY %3_DB UPDATE {%trim(%remove(%word(@systemTIME,%if(%numwords(@systemTIME)=6,5,4))%char(32),@systemTIME))%char(32)at%char(32)%word(@systemTIME,%if(%numwords(@systemTIME)=6,5,4))};
#ADDITEM peopleLIST %3;
#CLASS 0;
#SENDRAW last %3;
#T+ _blnkKill;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <trigger name="Legend" priority="10010">
        <pattern>(%w) the (*) is a (%d){st|rd|st|nd|th} level Lord (*) ~(Legend (%d)*~),$was born {on |}(*), and was last logged in on (*).$</pattern>
        <value>#if (%ismember(%1,@peopleLIST)) {
#CLASS {statChecker|statdbs|%1};
#ADDKEY %1_DB RACE %2;
#ADDKEY %1_DB LVL %3;
#ADDKEY %1_DB CLASS %4;
#ADDKEY %1_DB LGNDLVL %5;
#ADDKEY %1_DB BORN %6;
#ADDKEY %1_DB LAST %trim(%remove(%word(%7,%if(%numwords(%7)=6,5,4))%char(32),%7));
#ADDKEY %1_DB TIER Legend;
#CLASS 0
} {};
#T+ _blnkKill;
#GAG -1;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <trigger name="Lowmort" priority="10290">
        <pattern>(%w) the (*) is a (%d){st|rd|st|nd|th} level ({Rogue|Mage|Warrior|Berserker|Bodyguard|Paladin|Archer|Monk|Wizard|Sorcerer|Stormlord|Druid|Cleric|Priest|Black Circle Initiate|Assassin|Fusilier|Psionicist|Mindbender|Shadowfist|Bladedancer|Ranger}), was born {on |}(*), and$was last logged in on (*).$</pattern>
        <value>#if (%ismember(%1,@peopleLIST)) {
#CLASS {statChecker|statdbs|%1};
#ADDKEY %1_DB RACE %2;
#ADDKEY %1_DB LVL %3;
#ADDKEY %1_DB CLASS %4;
#ADDKEY %1_DB BORN %5;
#ADDKEY %1_DB LAST %trim(%remove(%word(%6,%if(%numwords(%7)=6,5,4))%char(32),%6));
#ADDKEY %1_DB TIER Lowmort;
#CLAS 0
} {};
#T+ _blnkKill;
#GAG -1;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <trigger priority="10490">
        <pattern>^You need %d experience to level and have %d practice{s.|.}$</pattern>
        <value>#T+ _blnkKill;
#GAG -1;
#GAG;
#T- _blnkKill;
#T- record_capture;
#T+ groupHealth
</value>
      </trigger>
      <trigger priority="10550">
        <pattern>{-------------------------------------------------------------------------------|##~| Level   Name         Pos   HitPoints   ManaPoints  MovePoints  TNL    Align|%w's group~:|As a group leader, you can lead a group size of %d.}</pattern>
        <value>#T+ _blnkKill;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <trigger name="Hero_Lord" priority="13090">
        <pattern>(%w) the (*) is a (%d){st|rd|st|nd|th} level ({Hero|Lord}) (*), was born {on |}(*), and$was last logged in on (*).$</pattern>
        <value>#if (%ismember(%1,@peopleLIST)) {
#CLASS {statChecker|statdbs|%1};
#ADDKEY %1_DB RACE %2;
#ADDKEY %1_DB LVL %3;
#ADDKEY %1_DB CLASS %5;
#ADDKEY %1_DB BORN %6;
#ADDKEY %1_DB LAST %trim(%remove(%word(%7,%if(%numwords(%7)=6,5,4))%char(32),%7));
#ADDKEY %1_DB TIER %4;
#CLASS 0
} {};
#T+ _blnkKill;
#GAG -1;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <trigger priority="13020">
        <pattern>^The System time ~(EST~) is currently:           &systemTIME</pattern>
        <value>#T+ _blnkKill;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <class name="_blnkKill" enabled="false">
        <trigger priority="50240">
          <pattern>^$</pattern>
          <value>#GAG</value>
        </trigger>
      </class>
      <trigger priority="13040">
        <pattern>^The AVATAR System started up at:              &lastReboot</pattern>
        <value>#T+ _blnkKill;
#GAG;
#T- _blnkKill;</value>
      </trigger>
      <trigger priority="13030">
        <pattern><![CDATA[It is &inGameTime, Day of (&gameDaySign), &inGameDate day in the Month of &inGameMonth~.]]></pattern>
        <value>#T+ _blnkKill;
#GAG;
#T- _blnkKill;</value>
      </trigger>
    </class>
    <trigger priority="4070">
      <pattern>~{(%w)~} {stats.|st.}(%w){.(%w)|}</pattern>
      <value>queryKey = "";
dbQuery = "";
dbQuery = %2;
queryKey = %3;
reportCHANNEL = "buddy";
#T+ record_capture;
#SWITCH (%ismember(@dbQuery,@peopleLIST) AND %ismember(@queryKey,@validQueries) AND @{@dbQuery"_DB"}.class="Berserker") {#SENDRAW @reportCHANNEL" "@COL3"Don't be silly"@COL4" "%1@COL3", Bersekers don't have Mana!"@N} (%ismember(@dbQuery,@peopleLIST) AND %ismember(@queryKey,@validQueries)) {#SENDRAW @reportCHANNEL" "@COL2%proper(@dbQuery)"'"%if(%rightback(@dbQuery,1)!="s","s")@COL1" "%proper(@queryKey)": ["@COL2%db(@{@dbQuery"_DB"},@queryKey)@COL1"]."@N;reportCHANNEL = "gtell"} (%ismember(@dbQuery,@peopleLIST) AND %numparam = 2) {#EXECUTE fullPeopleReport} (%ismember(@dbQuery,@peopleLIST) AND (!%ismember(@queryKey,@validQueries))) {#SENDRAW @reportCHANNEL" "@COL3"Invalid dataBase Query Key: ["@COL4%upper(@queryKey)@COL3"]. Valid queries: ["@COL4%expandlist(@validQueries,"|g|, "@COL4)@COL3"]."@N;reportCHANNEL = "gtell";} {#SENDRAW @reportCHANNEL" "@COL3"Sorry, ["@COL4%proper(@dbQuery)@COL3"] isn't in my dataBase yet."@N;reportCHANNEL = "gtell"};
#SENDRAW worth</value>
    </trigger>
    <class name="Vars">
      <var name="dbQuery"/>
      <var name="queryKey"/>
      <var name="validQueries" type="StringList" sorted="1">
        <value>born|class|hp|last|mp|mv|notes|race|tier|update</value>
        <json>["born","class","hp","last","mp","mv","notes","race","tier","update"]</json>
      </var>
      <var name="wordlist" type="StringList">
        <json>[]</json>
      </var>
      <var name="_loadNotes"/>
      <var name="autoUpdate" type="Literal">no</var>
      <var name="reportChannel" type="Literal">gtell</var>
      <var name="inGameTime"/>
      <var name="gameDaySign"/>
      <var name="inGameDate"/>
      <var name="inGameMonth"/>
      <var name="lastReboot"/>
      <var name="systemTIME"/>
    </class>
    <class name="Keys">
      <var name="whatTIER">%if(%db(@{@dbQuery"_DB"},TIER) = Legend,"(Lord "@COL2%db(@{@dbQuery"_DB"},LVL)@COL1") Legend",%if(%db(@{@dbQuery"_DB"},TIER) = Hero,"Hero",%if(%db(@{@dbQuery"_DB"},TIER) = Lord,"Lord","Lowmort")))</var>
      <var name="ifLgndLvl">%if(%db(@{@dbQuery"_DB"},TIER) = Legend,LGNDLVL,LVL)</var>
      <var name="ifNOTES">%if(%iskey(@{@dbQuery"_DB"},NOTES)," They are: "%db(@{@dbQuery"_DB"},NOTES)@COL1".")</var>
    </class>
    <trigger priority="11070">
      <pattern>^{You dream of |}(%w){ telling you | tells you }'{stats.|st.}(%w){.(%w)|}'$</pattern>
      <value>queryKey = "";
dbQuery = "";
dbQuery = %2;
queryKey = %3;
reportCHANNEL = "reply";
#T+ record_capture;
#SWITCH (%ismember(@dbQuery,@peopleLIST) AND %ismember(@queryKey,@validQueries) AND @{@dbQuery"_DB"}.class="Berserker") {#SENDRAW @reportCHANNEL" "@COL3"Don't be silly"@COL4" "%1@COL3", Bersekers don't have Mana!"@N} (%ismember(@dbQuery,@peopleLIST) AND %ismember(@queryKey,@validQueries)) {#SENDRAW @reportCHANNEL" "@COL2%proper(@dbQuery)"'"%if(%rightback(@dbQuery,1)!="s","s")@COL1" "%proper(@queryKey)": ["@COL2%db(@{@dbQuery"_DB"},@queryKey)@COL1"]."@N;reportCHANNEL = "gtell"} (%ismember(@dbQuery,@peopleLIST) AND %numparam = 2) {#EXECUTE fullPeopleReport} (%ismember(@dbQuery,@peopleLIST) AND (!%ismember(@queryKey,@validQueries))) {#SENDRAW @reportCHANNEL" "@COL3"Invalid dataBase Query Key: ["@COL4%upper(@queryKey)@COL3"]. Valid queries: ["@COL4%expandlist(@validQueries,"|g|, "@COL4)@COL3"]."@N;reportCHANNEL = "gtell";} {#SENDRAW @reportCHANNEL" "@COL3"Sorry, ["@COL4%proper(@dbQuery)@COL3"] isn't in my dataBase yet."@N;reportCHANNEL = "gtell"};
#SENDRAW worth</value>
    </trigger>
    <trigger priority="11080">
      <pattern>^(*) tell{s|} the group '{stats.|st.}(%w){.(%w)|}'</pattern>
      <value>queryKey = "";
dbQuery = "";
dbQuery = %2;
queryKey = %3;
reportCHANNEL = "gtell";
#T+ record_capture;
#SWITCH (%ismember(@dbQuery,@peopleLIST) AND %ismember(@queryKey,@validQueries) AND @{@dbQuery"_DB"}.class="Berserker") {#SENDRAW @reportCHANNEL" "@COL3"Don't be silly"@COL4%if(%1="You",""," "%1)@COL3", Bersekers don't have Mana!"@N} (%ismember(@dbQuery,@peopleLIST) AND %ismember(@queryKey,@validQueries)) {#SENDRAW @reportCHANNEL" "@COL2%proper(@dbQuery)"'"%if(%rightback(@dbQuery,1)!="s","s")@COL1" "%proper(@queryKey)": ["@COL2%db(@{@dbQuery"_DB"},@queryKey)@COL1"]."@N;reportCHANNEL = "gtell"} (%ismember(@dbQuery,@peopleLIST) AND %numparam=2) {#EXECUTE fullPeopleReport} (%ismember(@dbQuery,@peopleLIST) AND (!%ismember(@queryKey,@validQueries))) {#SENDRAW @reportCHANNEL" "@COL3"Invalid dataBase Query Key: ["@COL4%upper(@queryKey)@COL3"]. Valid queries: ["@COL4%expandlist(@validQueries,"|g|, "@COL4)@COL3"]."@N;reportCHANNEL = "gtell"} {#SENDRAW @reportCHANNEL" "@COL3"Sorry, ["@COL4%proper(@dbQuery)@COL3"] isn't in my dataBase yet."@N;reportCHANNEL = "gtell"}
#sendraw worth;

</value>
    </trigger>
    <trigger priority="11240">
      <pattern>^(*) tell{s|} the group 'update%pStats'</pattern>
      <value>gt @COL1"Updating dataBase, please "@COL2"hold still"@COL1" (Lords make sure you do this while I am on Thorn)."@N;
#EXECUTE pplupdate</value>
    </trigger>
    <trigger name="autoPeopleUpdate" priority="12640">
      <pattern>(%w) beckons for you to follow {him|her|it}.</pattern>
      <value>#FORALL {wake|follow %1} {#SENDRAW %i}</value>
    </trigger>
    <class name="theme">
      <class name="colors" initenable="true">
        <class name="keys">
          <var name="b">%db(@colorDATA,b)</var>
          <var name="bb">%db(@colorDATA,bb)</var>
          <var name="bc">%db(@colorDATA,bc)</var>
          <var name="bg">%db(@colorDATA,bg)</var>
          <var name="bk">%db(@colorDATA,bk)</var>
          <var name="bp">%db(@colorDATA,bp)</var>
          <var name="br">%db(@colorDATA,br)</var>
          <var name="bw">%db(@colorDATA,bw)</var>
          <var name="by">%db(@colorDATA,by)</var>
          <var name="c">%db(@colorDATA,c)</var>
          <var name="COL1" type="String">%char(124)%db(@colorTHEME,COL1)%char(124)</var>
          <var name="COL2" type="String">%char(124)%db(@colorTHEME,COL2)%char(124)</var>
          <var name="COL3" type="String">%char(124)%db(@colorTHEME,COL3)%char(124)</var>
          <var name="COL4">%char(124)%db(@colorTHEME,COL4)%char(124)</var>
          <var name="COL5" type="String">%char(124)%db(@colorTHEME,COL5)%char(124)</var>
          <var name="COL6" type="String">%char(124)%db(@colorTHEME,COL6)%char(124)</var>
          <var name="g">%db(@colorDATA,g)</var>
          <var name="k">%db(@colorDATA,k)</var>
          <var name="n">%db(@colorDATA,n)</var>
          <var name="p">%db(@colorDATA,p)</var>
          <var name="r">%db(@colorDATA,r)</var>
          <var name="w">%db(@colorDATA,w)</var>
          <var name="y">%db(@colorDATA,y)</var>
        </class>
        <var name="colorDATA" type="Record" sorted="1">
          <value>b="|b|"|bb="|bb|"|bc="|bc|"|bg="|bg|"|bk="|bk|"|bp="|bp|"|br="|br|"|bw="|bw|"|by="|by|"|c="|c|"|g="|g|"|k="|k|"|n="|n|"|p="|p|"|r="|r|"|w="|w|"|y="|y|"</value>
          <json>{"b":["","b",""],"bb":["","bb",""],"bc":["","bc",""],"bg":["","bg",""],"bk":["","bk",""],"bp":["","bp",""],"br":["","br",""],"bw":["","bw",""],"by":["","by",""],"c":["","c",""],"g":["","g",""],"k":["","k",""],"n":["","n",""],"p":["","p",""],"r":["","r",""],"w":["","w",""],"y":["","y",""]}</json>
        </var>
      </class>
      <var name="colorTHEME" type="Record" sorted="2">
        <value>COL1=c|COL2=bw|COL3=g|COL4=bc|COL5=r|COL6=br</value>
        <json>{"COL1":"c","COL2":"bw","COL3":"g","COL4":"bc","COL5":"r","COL6":"br"}</json>
      </var>
    </class>
    <class name="aliases">
      <alias name="pplUPDATE">
        <value>#T+ record_capture;
#T- groupHealth;
#SENDRAW time;
#SENDRAW group;
#TEMP {You have %d gold} {gt @COL1"OK. dataBase Update "@COL2"COMPLETE"@COL1". Good Luck."@N;#IF (%numparam = 0) {#FORALL {wake|follow self|sleep} {#SENDRAW %i}}} 
#WAIT 5000;
#SENDRAW worth;</value>
      </alias>
      <alias name="fullPeopleReport">
        <value>#SENDRAW last @dbQuery;
#TEMP {You need %d} {#SENDRAW @reportCHANNEL" "@COL2%proper(@dbQuery)@COL1" the "@COL2%db(@{@dbQuery"_DB"},RACE)@COL1" is a Level"@COL2" "%db(@{@dbQuery"_DB"},@ifLgndLvl)@COL1" "@whatTIER" "@COL2%db(@{@dbQuery"_DB"},CLASS)@COL1" - Born: "@COL2%db(@{@dbQuery"_DB"},BORN)@COL1" - Last seen online: "@COL2%db(@{@dbQuery"_DB"},LAST)@COL1"."@N;
#SENDRAW @reportCHANNEL" "@COL1%proper(@dbQuery)"'"%if(%rightback(@dbQuery,1)!="s","s")" stats were: "@COL2%db(@{@dbQuery"_DB"},HP)@COL1"HP"%if(%db(@{@dbQuery"_DB"},MP)!=0," and "@COL2%db(@{@dbQuery"_DB"},MP)@COL1"MP "," ")"as of "%db(@{@dbQuery"_DB"},UPDATE)"."@ifNotes@N;reportCHANNEL = "gtell";
}</value>
      </alias>
      <alias name="_update">
        <value>#T+ record_capture;
#T- groupHealth;
#SENDRAW time;
#SENDRAW group;
#TEMP {You have %d gold} {#EC OK. dataBase Update COMPLETE}
#WAIT 5000;
#SENDRAW worth;</value>
      </alias>
      <alias name="_loadNotes">
        <value>wordlist = "";
_loadNotes = "";
#loop %numparam {wordlist = %additem(%trim(%param(%i+1)),@wordlist)};
#loop (%numitems(@wordlist)) {#VAR _loadNotes %concat(@_loadNotes,%item(@wordlist,%i)," ")};
#CALL %vartype(_loadNotes,3);
#CLASS {statChecker|statdbs|%proper(%1)};
#ADDKEY %proper(%1)_DB NOTES %trim(@_loadNotes);
#CLASS 0</value>
      </alias>
      <alias name="_updates">
        <value>#IF (@autoUpdate = "no") {autoUpdate = "yes";#T+ autoPeopleUpdate;#EC Ok. Stat databases update automation is now on. You will autofollow on beckon.} {autoUpdate = "no";#T- autoPeopleUpdate;#EC Ok. Stat databases update automation is now off.}</value>
      </alias>
    </class>
    <class name="statdbs">
      <var name="peopleLIST" type="StringList">
        <json>[]</json>
      </var>
    </class>
  </class>
</cmud>