Help - Search - Members - Calendar
Full Version: House Class Counter
Achaea's Forums > Off-Topic > Tech Support > Curing Systems and Scripts
Jonathin
As the title suggests, this counts all the classes in a house via HOUSE MEMBERS, and HOUSE MEMBERS DORMANT.

That's what it's supposed to look like.


CODE
#CLASS {Classcounter}
#ALIAS classcount {house members %1;#t+ activateclasscap;#t+ classmore;#t+ classprompt}
#ALIAS Classlist {#show %ansi( Purple)House member class numbers:;#say %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total;#say %ansi( gray)Apostate%repeat( ".", 7)@classes.apostate%repeat( ".", %eval( 8-%len( @classes.apostate)))@dclasses.apostate%repeat( ".", %eval( 8-%len( @dclasses.apostate)))%eval( @dclasses.apostate+@classes.apostate);#say %ansi( white)Bard%repeat( ".", 11)@classes.bard%repeat( ".", %eval( 8-%len( @classes.bard)))@dclasses.bard%repeat( ".", %eval( 8-%len( @dclasses.bard)))%eval( @dclasses.bard+@classes.bard);#say %ansi( gray)Druid%repeat( ".", 10)@classes.Druid%repeat( ".", %eval( 8-%len( @classes.druid)))@dclasses.druid%repeat( ".", %eval( 8-%len( @dclasses.druid)))%eval( @dclasses.druid+@classes.druid);#say %ansi( white)Infernal%repeat( ".", 7)@classes.infernal%repeat( ".", %eval( 8-%len( @classes.infernal)))@dclasses.infernal%repeat( ".", %eval( 8-%len( @dclasses.infernal)))%eval( @dclasses.infernal+@classes.infernal);#say %ansi( gray)Jester%repeat( ".", 9)@classes.jester%repeat( ".", %eval( 8-%len( @classes.jester)))@dclasses.jester%repeat( ".", %eval( 8-%len( @dclasses.jester)))%eval( @dclasses.jester+@classes.jester);#say %ansi( white)Magi%repeat( ".", 11)@classes.magi%repeat( ".", %eval( 8-%len( @classes.magi)))@dclasses.magi%repeat( ".", %eval( 8-%len( @dclasses.magi)))%eval( @dclasses.apostate+@classes.magi);#say %ansi( gray)Monk%repeat( ".", 11)@classes.monk%repeat( ".", %eval( 8-%len( @classes.monk)))@dclasses.monk%repeat( ".", %eval( 8-%len( @dclasses.monk)))%eval( @dclasses.monk+@classes.monk);#say %ansi( white)Occultist%repeat( ".", 6)@classes.occultist%repeat( ".", %eval( 8-%len( @classes.occultist)))@dclasses.occultist%repeat( ".", %eval( 8-%len( @dclasses.occultist)))%eval( @dclasses.occultist+@classes.occultist);#say %ansi( gray)Paladin%repeat( ".", 8)@classes.paladin%repeat( ".", %eval( 8-%len( @classes.paladin)))@dclasses.paladin%repeat( ".", %eval( 8-%len( @dclasses.paladin)))%eval( @dclasses.paladin+@classes.paladin);#say %ansi( white)Priest%repeat( ".", 9)@classes.priest%repeat( ".", %eval( 8-%len( @classes.priest)))@dclasses.priest%repeat( ".", %eval( 8-%len( @dclasses.priest)))%eval( @dclasses.priest+@classes.priest);#say %ansi( gray)Runewarden%repeat( ".", 5)@classes.runewarden%repeat( ".", %eval( 8-%len( @classes.runewarden)))@dclasses.runewarden%repeat( ".", %eval( 8-%len( @dclasses.runewarden)))%eval( @dclasses.runewarden+@classes.runewarden);#say %ansi( white)Sentinel%repeat( ".", 7)@classes.sentinel%repeat( ".", %eval( 8-%len( @classes.sentinel)))@dclasses.sentinel%repeat( ".", %eval( 8-%len( @dclasses.sentinel)))%eval( @dclasses.sentinel+@classes.sentinel);#say %ansi( gray)Serpent%repeat( ".", 8)@classes.serpent%repeat( ".", %eval( 8-%len( @classes.serpent)))@dclasses.serpent%repeat( ".", %eval( 8-%len( @dclasses.serpent)))%eval( @dclasses.serpent+@classes.serpent);#say %ansi( white)Shaman%repeat( ".", 9)@classes.shaman%repeat( ".", %eval( 8-%len( @classes.shaman)))@dclasses.shaman%repeat( ".", %eval( 8-%len( @dclasses.shaman)))%eval( @dclasses.shaman+@classes.shaman);#say %ansi( gray)Sylvan%repeat( ".", 9)@classes.sylvan%repeat( ".", %eval( 8-%len( @classes.sylvan)))@dclasses.sylvan%repeat( ".", %eval( 8-%len( @dclasses.sylvan)))%eval( @dclasses.sylvan+@classes.sylvan);#say %ansi( white)Total:%repeat( ".", 9)@classes.total%repeat( ".", %eval( 8-%len( @classes.total)))@dclasses.total%repeat( ".", %eval( 8-%len( @dclasses.total)))%eval( @classes.total+@dclasses.total)}
#VAR classes {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occul
tist=0|Paladin=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=
0|Sylvan=0|total=0}
#VAR dclasses {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occul
tist=0|Paladin=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=
0|Sylvan=0|total=0}
#REGEX "activeclasscap" {^(\s+)(\d+)(?: prob|)(\s+)(\a+)(\s+)(.+?)$} {#mat classes.%4 {@classes.%4+1};#mat classes.total (@classes.total+1)} "" {disable}
#REGEX "classmore" {^\[Type MORE if you wish to continue reading\. \((\d+)\% shown\)\]$} {more} "" {disable}
#ALARM "classprompt" {*20} {#t- activeclasscap;#t- dormantclasscap;#t- classmore;#t- activateclasscap;#t- classprompt} "" {nocr|prompt|disable}
#REGEX "activateclasscap" {^(?:\s+)(ACTIVE|DORMANT) members of the Warlocks of the Rising Phoenix\.$} {#if (%2="ACTIVE") {#say {%ansi( white)Checking ACTIVE members};#t+ activeclasscap;#loopdb @classes {#addk classes {%key=0}}} {#say {%ansi( white)Checking DORMANT members};#t+ dormantclasscap;#loopdb @dclasses {#addk dclasses {%key=0}}}} "" {disable}
#REGEX "dormantclasscap" {^(\s+)(\d+)(?: prob|)(\s+)(\a+)(\s+)(.+?)$} {#mat dclasses.%4 {@dclasses.%4+1};#mat dclasses.total (@dclasses.total+1)} "" {disable}
#CLASS 0


If someone wants to make it less long, and complex, be my guest.

Use CLASSCOUNT to check active members, and CLASSCOUNT DORMANT to check dormant members then use CLASSLIST to list it like shown above. Fyi, It's really spammy because I didn't add any gags in.


Edit: I'm still not sure if there's an IG option to see this info, but I haven't seen one.

Edit2: You may have to edit the timer to suit you, it's set for 20 seconds, but if you have a ton of members, you may have to make it longer.
Jonathin
and I noticed an issue with the magi count, here's the fixed:

CODE
#CLASS {Classcounter}
#ALIAS classcount {house members %1;#t+ activateclasscap;#t+ classmore;#t+ classprompt}
#ALIAS Classlist {#show %ansi( Purple)House member class numbers:;#say %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total;#say %ansi( gray)Apostate%repeat( ".", 7)@classes.apostate%repeat( ".", %eval( 8-%len( @classes.apostate)))@dclasses.apostate%repeat( ".", %eval( 8-%len( @dclasses.apostate)))%eval( @dclasses.apostate+@classes.apostate);#say %ansi( white)Bard%repeat( ".", 11)@classes.bard%repeat( ".", %eval( 8-%len( @classes.bard)))@dclasses.bard%repeat( ".", %eval( 8-%len( @dclasses.bard)))%eval( @dclasses.bard+@classes.bard);#say %ansi( gray)Druid%repeat( ".", 10)@classes.Druid%repeat( ".", %eval( 8-%len( @classes.druid)))@dclasses.druid%repeat( ".", %eval( 8-%len( @dclasses.druid)))%eval( @dclasses.druid+@classes.druid);#say %ansi( white)Infernal%repeat( ".", 7)@classes.infernal%repeat( ".", %eval( 8-%len( @classes.infernal)))@dclasses.infernal%repeat( ".", %eval( 8-%len( @dclasses.infernal)))%eval( @dclasses.infernal+@classes.infernal);#say %ansi( gray)Jester%repeat( ".", 9)@classes.jester%repeat( ".", %eval( 8-%len( @classes.jester)))@dclasses.jester%repeat( ".", %eval( 8-%len( @dclasses.jester)))%eval( @dclasses.jester+@classes.jester);#say %ansi( white)Magi%repeat( ".", 11)@classes.magi%repeat( ".", %eval( 8-%len( @classes.magi)))@dclasses.magi%repeat( ".", %eval( 8-%len( @dclasses.magi)))%eval( @dclasses.magi+@classes.magi);#say %ansi( gray)Monk%repeat( ".", 11)@classes.monk%repeat( ".", %eval( 8-%len( @classes.monk)))@dclasses.monk%repeat( ".", %eval( 8-%len( @dclasses.monk)))%eval( @dclasses.monk+@classes.monk);#say %ansi( white)Occultist%repeat( ".", 6)@classes.occultist%repeat( ".", %eval( 8-%len( @classes.occultist)))@dclasses.occultist%repeat( ".", %eval( 8-%len( @dclasses.occultist)))%eval( @dclasses.occultist+@classes.occultist);#say %ansi( gray)Paladin%repeat( ".", 8)@classes.paladin%repeat( ".", %eval( 8-%len( @classes.paladin)))@dclasses.paladin%repeat( ".", %eval( 8-%len( @dclasses.paladin)))%eval( @dclasses.paladin+@classes.paladin);#say %ansi( white)Priest%repeat( ".", 9)@classes.priest%repeat( ".", %eval( 8-%len( @classes.priest)))@dclasses.priest%repeat( ".", %eval( 8-%len( @dclasses.priest)))%eval( @dclasses.priest+@classes.priest);#say %ansi( gray)Runewarden%repeat( ".", 5)@classes.runewarden%repeat( ".", %eval( 8-%len( @classes.runewarden)))@dclasses.runewarden%repeat( ".", %eval( 8-%len( @dclasses.runewarden)))%eval( @dclasses.runewarden+@classes.runewarden);#say %ansi( white)Sentinel%repeat( ".", 7)@classes.sentinel%repeat( ".", %eval( 8-%len( @classes.sentinel)))@dclasses.sentinel%repeat( ".", %eval( 8-%len( @dclasses.sentinel)))%eval( @dclasses.sentinel+@classes.sentinel);#say %ansi( gray)Serpent%repeat( ".", 8)@classes.serpent%repeat( ".", %eval( 8-%len( @classes.serpent)))@dclasses.serpent%repeat( ".", %eval( 8-%len( @dclasses.serpent)))%eval( @dclasses.serpent+@classes.serpent);#say %ansi( white)Shaman%repeat( ".", 9)@classes.shaman%repeat( ".", %eval( 8-%len( @classes.shaman)))@dclasses.shaman%repeat( ".", %eval( 8-%len( @dclasses.shaman)))%eval( @dclasses.shaman+@classes.shaman);#say %ansi( gray)Sylvan%repeat( ".", 9)@classes.sylvan%repeat( ".", %eval( 8-%len( @classes.sylvan)))@dclasses.sylvan%repeat( ".", %eval( 8-%len( @dclasses.sylvan)))%eval( @dclasses.sylvan+@classes.sylvan);#say %ansi( white)Total:%repeat( ".", 9)@classes.total%repeat( ".", %eval( 8-%len( @classes.total)))@dclasses.total%repeat( ".", %eval( 8-%len( @dclasses.total)))%eval( @classes.total+@dclasses.total)}
#VAR classes {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occul
tist=0|Paladin=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=
0|Sylvan=0|total=0}
#VAR dclasses {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occul
tist=0|Paladin=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=
0|Sylvan=0|total=0}
#REGEX "activeclasscap" {^(\s+)(\d+)(?: prob|)(\s+)(\a+)(\s+)(.+?)$} {#mat classes.%4 {@classes.%4+1};#mat classes.total (@classes.total+1)} "" {disable}
#REGEX "classmore" {^\[Type MORE if you wish to continue reading\. \((\d+)\% shown\)\]$} {more} "" {disable}
#ALARM "classprompt" {*20} {#t- activeclasscap;#t- dormantclasscap;#t- classmore;#t- activateclasscap;#t- classprompt} "" {nocr|prompt|disable}
#REGEX "activateclasscap" {^(?:\s+)(ACTIVE|DORMANT) members of the Warlocks of the Rising Phoenix\.$} {#if (%2="ACTIVE") {#say {%ansi( white)Checking ACTIVE members};#t+ activeclasscap;#loopdb @classes {#addk classes {%key=0}}} {#say {%ansi( white)Checking DORMANT members};#t+ dormantclasscap;#loopdb @dclasses {#addk dclasses {%key=0}}}} "" {disable}
#REGEX "dormantclasscap" {^(\s+)(\d+)(?: prob|)(\s+)(\a+)(\s+)(.+?)$} {#mat dclasses.%4 {@dclasses.%4+1};#mat dclasses.total (@dclasses.total+1)} "" {disable}
#CLASS 0
Gorlasintan
That alias is the reason I hate writing code in zMud.
Sena
There's no reason for it to be so long. It can be shortened to:
CODE
#ALIAS Classlist {#SHOW %ansi( Purple)House member class numbers:;#SHOW %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total;#LOOPDB @classes {#SHOW %ansi( @AltColors)%key%repeat( ".", %eval( 15-%len( %key)))%val%repeat( ".", %eval( 8-%len( %val)))%db( @dclasses, %key)%repeat( ".", %eval( 8-%len( %db( @dclasses, %key))))%eval( %db( @dclasses, %key)+%val);#IF (@AltColors=7) {#VARIABLE AltColors {15}} {#VARIABLE AltColors {7}}}}
#VAR AltColors {7} {7}
Otha
Someone please use this in the Dawnstriders and post their results.
Jonathin
QUOTE (Sena @ Oct 1 2009, 04:53 PM) *
There's no reason for it to be so long. It can be shortened to:
CODE
#ALIAS Classlist {#SHOW %ansi( Purple)House member class numbers:;#SHOW %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total;#LOOPDB @classes {#SHOW %ansi( @AltColors)%key%repeat( ".", %eval( 15-%len( %key)))%val%repeat( ".", %eval( 8-%len( %val)))%db( @dclasses, %key)%repeat( ".", %eval( 8-%len( %db( @dclasses, %key))))%eval( %db( @dclasses, %key)+%val);#IF (@AltColors=7) {#VARIABLE AltColors {15}} {#VARIABLE AltColors {7}}}}
#VAR AltColors {7} {7}



See, I didn't think to do that. I just did it the long way. I wanted to use Loopdb but couldn't figure it out.
Please, if you have time, walk me through that?

And for some reason, it's catching the first parts of titles, I'm not sure why. Like I get Venator, Newborn, and some others quite often.

And:
QUOTE (Otha @ Oct 1 2009, 04:54 PM) *
Someone please use this in the Dawnstriders and post their results.

laugh.gif
Sena
QUOTE (Jonathin @ Oct 1 2009, 05:46 PM) *
QUOTE (Sena @ Oct 1 2009, 04:53 PM) *
There's no reason for it to be so long. It can be shortened to:
CODE
#ALIAS Classlist {#SHOW %ansi( Purple)House member class numbers:;#SHOW %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total;#LOOPDB @classes {#SHOW %ansi( @AltColors)%key%repeat( ".", %eval( 15-%len( %key)))%val%repeat( ".", %eval( 8-%len( %val)))%db( @dclasses, %key)%repeat( ".", %eval( 8-%len( %db( @dclasses, %key))))%eval( %db( @dclasses, %key)+%val);#IF (@AltColors=7) {#VARIABLE AltColors {15}} {#VARIABLE AltColors {7}}}}
#VAR AltColors {7} {7}



See, I didn't think to do that. I just did it the long way. I wanted to use Loopdb but couldn't figure it out.
Please, if you have time, walk me through that?

#LOOPDB is pretty simple, it just executes the given script on every key/value pair in order. %key is used for the current key, and %val for the current value. It basically does the same thing your original script does, but replaces, for example, Apostate with %key, @classes.apostate with %val, and @dclasses.apostate with %db(@dclasses,%key). I added the AltColors thing to keep the alternating colors. The if statement at the end just switches the variable between 7 and 15 after every class, 7 and 15 being the ansi codes for grey and white.
Jonathin
I figured out how to use loopdb, but I couldn't figure out how to get it to do both databases in one line.

i.e. Apostate.......18....21....39
Sena
%key and %val are for the first database, for apostates they would return Apostate and 18. Since the second database uses the same key (Apostate), %db(@dclasses,%key) will return the value, 21. And then adding %val and %db(@dclasses,%key) gets the total of 39.

%db(@Variable,Key) is the also the same as @Variable.Key.
Gorlasintan
#LOOPDB @classes {#ECHO %val;#ECHO @dclasses.%key}

Sena ninja'd me.

EDIT: This only works if both databases have the same keys.
Jonathin
ooh, now i get it, I'm not sure why I didn't see that before. Thank you both.


I figured out why it captures partial titles, it's because if someone doesn't have a class, there's no class to capture. I'll figure out some way to fix it.
Imyrr
I'm hopeless with coding. Is that alias merely the replacement for the alias in the originally posted script or is it meant to be a wholesale replacement of the script entire? I'd like to check my House's numbers, too.
Gorlasintan
QUOTE (Imyrr @ Oct 1 2009, 07:57 PM) *
I'm hopeless with coding. Is that alias merely the replacement for the alias in the originally posted script or is it meant to be a wholesale replacement of the script entire? I'd like to check my House's numbers, too.

Sena's alias replaces the 'Classlist' alias in the OP.
Imyrr
Lovely, thank you!
Trevize
Hmm. Could you post up a sample line with, and one without, the class? I can probably whip up a quick regex for it, but since I'm not in a House I can't figure it out. tongue.gif
Jonathin
Thank's Trevize
Trevize
QUOTE (Jonathin @ Oct 1 2009, 09:15 PM) *
Thank's Trevize

See my edit... not sure if what I posted would work. Pure guesswork, I'm Houseless. blush.gif
Soludra
Based on the PCRE regex engine, this should match any variant of the HOUSE MEMBERS lines:

CODE
^ (?: \d|\d{2}) (?:prob|    )? (?:\w+)\s+(?:.+)$
Trevize
Here:
CODE
\s+\d+ (?:prob|\s{4}) \w*\s+.+

Add captures as appropriate.

edit: Sol beat me to it... and damn near the same thing. His is more precise, mine shorter, either would work fine.
Jonathin
This is the script with the changes mentioned.
CODE
#CLASS {Classcounter}
#ALIAS classcount {house members %1;#t+ activateclasscap;#t+ classmore;#t+ classprompt}
#ALIAS Classlist {#SHOW %ansi( Purple)House member class numbers:;#SHOW %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total;#LOOPDB @classes {#SHOW %ansi( @AltColors)%key%repeat( ".", %eval( 15-%len( %key)))%val%repeat( ".", %eval( 8-%len( %val)))%db( @dclasses, %key)%repeat( ".", %eval( 8-%len( %db( @dclasses, %key))))%eval( %db( @dclasses, %key)+%val);#IF (@AltColors=7) {#VARIABLE AltColors {15}} {#VARIABLE AltColors {7}}}}
#VAR classes {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occultist=0|Paladin
=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=0|Sylvan=0|total=0}
#VAR dclasses {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occultist=0|Paladin
=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=0|Sylvan=0|total=0}
#VAR AltColors {7} {7}
#REGEX "activeclasscap" {(?:\s+)(?:\d+) (?:prob|\s{4}) (\w*)(?:\s+)(?:.+)} {#gag;#mat classes.%1 {@classes.%1+1};#mat classes.total (@classes.total+1)} "" {disable}
#REGEX "classmore" {^\[Type MORE if you wish to continue reading\. \((\d+)\% shown\)\]$} {#gag;more} "" {disable}
#ALARM "classprompt" {*25} {#t- activeclasscap;#t- dormantclasscap;#t- classmore;#t- activateclasscap;#t- classprompt} "" {nocr|prompt|disable}
#REGEX "activateclasscap" {^(?:\s+)(ACTIVE|DORMANT) members of the Warlocks of the Rising Phoenix\.$} {#gag;#if (%2="ACTIVE") {#say {%ansi( white)Checking ACTIVE members};#t+ activeclasscap;#loopdb @classes {#addk classes {%key=0}}} {#say {%ansi( white)Checking DORMANT members};#t+ dormantclasscap;#loopdb @dclasses {#addk dclasses {%key=0}}}} "" {disable}
#REGEX "dormantclasscap" {(?:\s+)(?:\d+) (?:prob|\s{4}) (\w*)(?:\s+)(?:.+)} {#gag;#mat dclasses.%1 {@dclasses.%1+1};#mat dclasses.total (@dclasses.total+1)} "" {disable}
#CLASS 0


It's also got a gag in there, it's not pretty, but you don't see 1984144 names fly across your screen either.
Trevize
QUOTE (Soludra @ Oct 1 2009, 09:26 PM) *
Based on the PCRE regex engine

Not sure how closely zMUD follows the engine. I know it's at least slightly off, \a should be \x07, the bell/alarm character, but zMUD treats it as [A-Za-z] or the POSIX [[:alpha:]].
Jonathin
If you want to be able to tell it over a channel without having to type it out, just add this in:

CODE
#ALIAS breakdown {#va classtell {};#if (%lower( %1)="active") {#loopdb @classes {#addi classtell { %key %val}};hts Active members~: %replace( @classtell, "|", ", ")} {#if (%lower( %1)="dormant");#loopdb @dclasses {#addi classtell {%key %val}};hts Dormant members~: %replace( @classtell, "|", ", ")}}  "Classcounter"


I have no idea if that's the best way to do it, but it works.


BREAKDOWN ACTIVE will give active members over HTS, and BREAKDOWN DORMANT (or just BREAKDOWN) will do dormant members over HTS.

If you don't want it to go over HTS, just change "HTS Active members:" and "HTS Dormant members:"

I'm liking this script more and more, I may add more too it as time goes on.

And I know that it's pretty much a pointless addon, but I got tired of typing the results out, I figured that whoever else might be too.

Also, to completely gag it without gagging using #gagon add this:

CODE
#regex "classcountgag" {^(?:(?:\s)HR(?:\s+)Stat(?:\s)Class(?:\s+)Name(?:\s)\+(?:\s)Title|-{79}|more)} {#gag}


and add

#t+ classcountgag
to the CLASSCOUNT alias, right at the end works.

then add

#t- classcountgag
to the *25 alarm, but put it one before the last, so it looks like
QUOTE
#t- activeclasscap
#t- dormantclasscap
#t- classmore
#t- activateclasscap
#t- classcountgag
#t- classprompt
Imyrr
CODE
House member class numbers:
Class        Active  Dormant  Total
Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occultist=0|Paladin=
0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=0|Sylvan=0|total=0..........
.
.....

CODE
total..........0=011111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111........0


I'm getting these things when I do classlist. Any suggestions? Reviewed what I could in notepad, but can't figure out what's doing it. Changed the Warlock line to the Occultists, naturally.

edit: Used Jonathin's posted version. Couldn't get it to work with Sena's.
Sena
I can't think of how those exact problems would happen, but the variables probably got messed up, zMUD is really unreliable with importing/exporting database variables.

Try importing this:
CODE
#VARIABLE classes {}
#ADDKEY classes {Apostate} {1}
#ADDKEY classes {Bard} {1}
#ADDKEY classes {Druid} {1}
#ADDKEY classes {Infernal} {1}
#ADDKEY classes {Jester} {1}
#ADDKEY classes {Magi} {1}
#ADDKEY classes {Monk} {1}
#ADDKEY classes {Occultist} {1}
#ADDKEY classes {Paladin} {1}
#ADDKEY classes {Priest} {1}
#ADDKEY classes {Runewarden} {1}
#ADDKEY classes {Sentinel} {1}
#ADDKEY classes {Serpent} {1}
#ADDKEY classes {Shaman} {1}
#ADDKEY classes {Sylvan} {1}
#ADDKEY classes {Total} {1}
#VARIABLE dclasses {}
#ADDKEY dclasses {Apostate} {1}
#ADDKEY dclasses {Bard} {1}
#ADDKEY dclasses {Druid} {1}
#ADDKEY dclasses {Infernal} {1}
#ADDKEY dclasses {Jester} {1}
#ADDKEY dclasses {Magi} {1}
#ADDKEY dclasses {Monk} {1}
#ADDKEY dclasses {Occultist} {1}
#ADDKEY dclasses {Paladin} {1}
#ADDKEY dclasses {Priest} {1}
#ADDKEY dclasses {Runewarden} {1}
#ADDKEY dclasses {Sentinel} {1}
#ADDKEY dclasses {Serpent} {1}
#ADDKEY dclasses {Shaman} {1}
#ADDKEY dclasses {Sylvan} {1}
#ADDKEY dclasses {Total} {1}
Gorlasintan
Hm, yes.


#VAR classes {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occultist=0|Paladin
=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=0|Sylvan=0|total=0}
#VAR dclasses {Apostate=0|Bard=0|Druid=0|Infernal=0|Jester=0|Magi=0|Monk=0|Occultist=0|Paladin
=0|Priest=0|Runewarden=0|Sentinel=0|Serpent=0|Shaman=0|Sylvan=0|total=0}

should be

#VAR classes {}
#ADDKEY classes {Apostate|Bard|Druid|Infernal|Jester|Magi|Monk|Occultist|Paladin|Priest|Runeward
en|Sentinel|Serpent|Shaman|Sylvan|total} {0}
#VAR dclasses {}
#ADDKEY classes {Apostate|Bard|Druid|Infernal|Jester|Magi|Monk|Occultist|Paladin|Priest|Runeward
en|Sentinel|Serpent|Shaman|Sylvan|total} {0}
Sena
The problem with my alias not working was also caused by the variables being messed up. If they're set properly, my script should work identically to Jonathin's.
Imyrr
Aha! Works. Thank you everyone!
Sena
You'll need to check the members lists again to update it. I just set everything to 1 for testing.
Veldrin
hrm I couldn't really get it to work, so I tried some different stuff too, here's my version (still need to reactive some of the gags actually)
I primarily moved the check for whetever it's active or dormant into the alias, and made a folder for each variable so I could use #reset on them to set them back to their default states instead of using a #loopdb (I -think- it's faster?)
and I made it deactive whatever you're not using so you don't have to wait the 25 seconds before it turns it off when you start it

CODE
#CLASS {Classcounter}
#ALIAS classcount {
  #pri {
    #t- dormantclasscap
    #t- activeclasscap
    #if (%proper( %1)=%proper( active)) {
      #say {%ansi( white)Checking ACTIVE members}
      #res {Classcounter|classesvariable}
      #t+ activeclasscap
      } {
      #res {Classcounter|dclassesvariable}
      #say {%ansi( white)Checking DORMANT members}
      #t+ dormantclasscap
      }
    }
  house members %1
  #t+ classmore
  #t+ classprompt
  }
#ALIAS Classlist {
  #pri {
    #SHOW %ansi( Purple)House member class numbers:
    #SHOW %ansi( white)Class%repeat( " ", 8)Active%repeat( " ", 2)Dormant%repeat( " ", 2)Total
    #LOOPDB @classes {
      #SHOW %ansi( @AltColors)%key%repeat( ".", %eval( 15-%len( %key)))%val%repeat( ".", %eval( 8-%len( %val)))%db( @dclasses, %key)%repeat( ".", %eval( 8-%len( %db( @dclasses, %key))))%eval( %db( @dclasses, %key)+%val)
      #IF (@AltColors=7) {#VARIABLE AltColors {15}} {#VARIABLE AltColors {7}}
      }
    }
  }
#VAR AltColors {7} {7}
#REGEX "activeclasscap" {(?:\s+)(?:\d+) (?:prob|\s{4}) (\w*)(?:\s+)(?:.+)} {
  #gag
  #addkey classes %1 {%eval( %db( @classes, %1)+1)}
  #addkey classes total {%eval( %db( @classes, total)+1)}
  } "" {disable}
#REGEX "classmore" {^\[Type MORE if you wish to continue reading\. \((\d+)\% shown\)\]$} {
  #gag
  more
  } "" {disable}
#ALARM "classprompt" {*25} {
  #t- activeclasscap
  #t- dormantclasscap
  #t- classmore
  #t- activateclasscap
  #t- classprompt
  } "" {nocr|prompt|disable}
#REGEX "activateclasscap" {^(?:\s+)(ACTIVE|DORMANT) members of the .*\.$} {#gag} "" {disable}
#REGEX "dormantclasscap" {(?:\s+)(?:\d+) (?:prob|\s{4}) (\w*)(?:\s+)(?:.+)} {
  #gag
  #addkey dclasses %1 {%eval( %db( @dclasses, %1)+1)}
  #addkey dclasses total {%eval( %db( @dclasses, total)+1)}
  } "" {disable}
#CLASS 0
#CLASS {Classcounter|classesvariable}
#VAR classes {Apostate|0|Bard|0|Druid|0|Infernal|0|Jester|0|Magi|0|Monk|0|Occultist|0|Paladin
|0|Priest|0|Runewarden|0|Sentinel|0|Serpent|0|Shaman|0|Sylvan|0|total|0} {Apostate|0|Bard|0|Druid|0|Infernal|0|Jester|0|Magi|0|Monk|0|Occultist|0|Paladin
|0|Priest|0|Runewarden|0|Sentinel|0|Serpent|0|Shaman|0|Sylvan|0|total|0}
#CLASS 0
#CLASS {Classcounter|dclassesvariable}
#VAR dclasses {Apostate|0|Bard|0|Druid|0|Infernal|0|Jester|0|Magi|0|Monk|0|Occultist|0|Paladin
|0|Priest|0|Runewarden|0|Sentinel|0|Serpent|0|Shaman|0|Sylvan|0|total|0} {Apostate|0|Bard|0|Druid|0|Infernal|0|Jester|0|Magi|0|Monk|0|Occultist|0|Paladin
|0|Priest|0|Runewarden|0|Sentinel|0|Serpent|0|Shaman|0|Sylvan|0|total|0}
#CLASS 0



now someone convert this to Mush! tongue.gif
Jonathin
that alias I posted can also be used for converting other databases to a single line for tells too. The limits are endless. I originally used it for this for testing purposes.
Trevize
For MUSHclient, this is a quick version I made translating his (almost) directly. I don't know if it works yet or not, I haven't had a chance to test it. Only had ten minutes to write it, I have to run for now. If anyone could let me know if it works, that'd be great! If not, I'll do it myself later. And I'll polish it up when I can.

CODE
<triggers>
  <trigger
   ignore_case="y"
   keep_evaluating="y"
   match="^\[Type MORE if you wish to continue reading\. \((\d+)\% shown\)\]$"
   name="classmore"
   regexp="y"
   sequence="100"
  >
  <send>more</send>
  </trigger>
  <trigger
   ignore_case="y"
   keep_evaluating="y"
   match="^\s+\d+ (?:prob|\s{4}) (\w*)\s+.+$"
   name="activeclasscap"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>classes["%1"] = classes["%1"] + 1
classes.total = classes.total + 1</send>
  </trigger>
  <trigger
   ignore_case="y"
   keep_evaluating="y"
   match="^\s+\d+ (?:prob|\s{4}) (\w*)\s+.+$"
   name="dormantclasscap"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>dclasses["%1"] = dclasses["%1"] + 1
dclasses.total = dclasses.total + 1</send>
  </trigger>
</triggers>


CODE
<aliases>
  <alias
   match="^classcount (active|dormant)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger ("dormantclasscap", false)
EnableTrigger ("activeclasscap", false)
if string.lower ("%1") == "active" then
  ColourNote ("silver", "black", "Checking ACTIVE members")
  Execute ("reset_class")
  EnableTrigger ("activeclasscap", true)
else
  ColourNote ("silver", "black", "Checking DORMANT members")
  Execute ("reset_dclass")
  EnableTrigger ("dormantclasscap", true)
end -- if
Send ("house members %1")
EnableTrigger ("classmore", true)
DoAfterSpecial (2, [[
  EnableTrigger ("dormantclasscap", false)
  EnableTrigger ("activeclasscap", false)
  EnableTrigger ("classmore", false)
]], sendto.script)</send>
  </alias>
  <alias
   match="^classlist$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>altcolors = "silver"
ColourNote ("purple", "black", "House member class numbers:")
ColourNote ("white", "black", "Class        Active  Dormant  Total")
for key, val in pairs (classes) do
  ColourTell (altcolors, "black", key)
  ColourTell (altcolors, "black", string.rep (".", 15 - string.len (key)))
  ColourTell (altcolors, "black", val)
  ColourTell (altcolors, "black", string.rep (".", 8-val))
  ColourTell (altcolors, "black", dclasses[key])
  ColourTell (altcolors, "black", string.rep (".", 8 - string.len (dclasses[key])))
  ColourNote (altcolors, "black", dclasses[key] + val)
  if altcolors == "silver" then altcolors = "white" else altcolors = "silver" end
end -- for</send>
  </alias>
  <alias
   match="^reset_class$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>classes = {
  Apostate = 0,
  Bard = 0,
  Druid = 0,
  Infernal = 0,
  Jester = 0,
  Magi = 0,
  Monk = 0,
  Occultist = 0,
  Paladin = 0,
  Priest = 0,
  Runewarden = 0,
  Sentinel = 0,
  Serpent = 0,
  Shaman = 0,
  Sylvan = 0,
  total = 0,
  }</send>
  </alias>
  <alias
   match="^reset_dclass$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>dclasses = {
  Apostate = 0,
  Bard = 0,
  Druid = 0,
  Infernal = 0,
  Jester = 0,
  Magi = 0,
  Monk = 0,
  Occultist = 0,
  Paladin = 0,
  Priest = 0,
  Runewarden = 0,
  Sentinel = 0,
  Serpent = 0,
  Shaman = 0,
  Sylvan = 0,
  total = 0,
  }</send>
  </alias>
</aliases>
Danith
I thought maybe the Dawnstriders had added more classes to their list, and so it was now necessary to make a script that would count them. Boy, was I wrong.
Rangor Corten
So, what's your total active? smile.gif

and thanks!
Nitro
QUOTE (Trevize @ Oct 3 2009, 02:30 AM) *
For MUSHclient, this is a quick version I made translating his (almost) directly. I don't know if it works yet or not, I haven't had a chance to test it. Only had ten minutes to write it, I have to run for now. If anyone could let me know if it works, that'd be great! If not, I'll do it myself later. And I'll polish it up when I can.


Edit: nevermind, I understood it wrong, seems to work so far.

CODE
Run-time error
Plugin: achaea_curing (called from world: Achaea)
Immediate execution
[string "Trigger: dormantclasscap"]:1: attempt to perform arithmetic on field '' (a nil value)
stack traceback:
        [string "Trigger: dormantclasscap"]:1: in main chunk
Run-time error
Plugin: achaea_curing (called from world: Achaea)
Immediate execution
[string "Trigger: activeclasscap"]:1: attempt to perform arithmetic on field '' (a nil value)
stack traceback:
        [string "Trigger: activeclasscap"]:1: in main chunk


Is this because of classless members perhaps?

Edit: And the counting seems to be wrong, because I doubt the Ashurans have 6000+ active monks.
Trevize
It is because of classless, I'll fix up that and anything else I can find, and post again. Not sure what could cause the extra numbers.
Trevize
It wasn't counting wrong, it was just omitting the periods due to me leaving out one small part. I've also fixed the classless problem, by giving them their own class. Here's the updated version for MUSHclient/Lua, it should work.

Triggers:
CODE
<triggers>
  <trigger
   ignore_case="y"
   keep_evaluating="y"
   match="^\[Type MORE if you wish to continue reading\. \((\d+)\% shown\)\]$"
   name="classmore"
   regexp="y"
   sequence="100"
  >
  <send>more</send>
  </trigger>
  <trigger
   ignore_case="y"
   keep_evaluating="y"
   match="^\s+\d+ (?:prob|\s{4}) (\w*)\s+.+$"
   name="activeclasscap"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>local x = "%1"
if x == "" then x = "classless" end
aclasses[x] = aclasses[x] + 1
aclasses.total = aclasses.total + 1</send>
  </trigger>
  <trigger
   ignore_case="y"
   keep_evaluating="y"
   match="^\s+\d+ (?:prob|\s{4}) (\w*)\s+.+$"
   name="dormantclasscap"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>local x = "%1"
if x == "" then x = "classless" end
dclasses[x] = dclasses[x] + 1
dclasses.total = dclasses.total + 1</send>
  </trigger>
</triggers>


Aliases:
CODE
<aliases>
  <alias
   match="^classcount (active|dormant)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger ("dormantclasscap", false)
EnableTrigger ("activeclasscap", false)
if string.lower ("%1") == "active" then
  ColourNote ("silver", "black", "Checking ACTIVE members")
  resetclasses ("a")
  EnableTrigger ("activeclasscap", true)
else
  ColourNote ("silver", "black", "Checking DORMANT members")
  resetclasses ("d")
  EnableTrigger ("dormantclasscap", true)
end -- if
Send ("house members %1")
EnableTrigger ("classmore", true)
DoAfterSpecial (20, [[
  EnableTrigger ("dormantclasscap", false)
  EnableTrigger ("activeclasscap", false)
  EnableTrigger ("classmore", false)
]], sendto.script)</send>
  </alias>
  <alias
   match="^classlist$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>altcolors = "silver"
ColourNote ("purple", "black", "House member class numbers:")
ColourNote ("white", "black", "Class        Active  Dormant  Total")
for key, val in pairs (classes) do
  ColourTell (altcolors, "black", val)
  ColourTell (altcolors, "black", string.rep (".", 15 - string.len (val)))
  ColourTell (altcolors, "black", aclasses[val])
  ColourTell (altcolors, "black", string.rep (".", 8 - string.len (aclasses[val])))
  ColourTell (altcolors, "black", dclasses[val])
  ColourTell (altcolors, "black", string.rep (".", 8 - string.len (dclasses[val])))
  ColourNote (altcolors, "black", dclasses[val] + aclasses[val])
  if altcolors == "silver" then altcolors = "white" else altcolors = "silver" end
end -- for</send>
  </alias>
</aliases>


Script:
CODE
classes = {
  "Apostate",
  "Bard",
  "Druid",
  "Infernal",
  "Jester",
  "Magi",
  "Monk",
  "Occultist",
  "Paladin",
  "Priest",
  "Runewarden",
  "Sentinel",
  "Serpent",
  "Shaman",
  "Sylvan",
  "classless",
  "total",
  }

resetclasses = function (type)
  _G[type.."classes"] = {
    Apostate = 0,
    Bard = 0,
    Druid = 0,
    Infernal = 0,
    Jester = 0,
    Magi = 0,
    Monk = 0,
    Occultist = 0,
    Paladin = 0,
    Priest = 0,
    Runewarden = 0,
    Sentinel = 0,
    Serpent = 0,
    Shaman = 0,
    Sylvan = 0,
    classless = 0,
    total = 0,
    }
end -- func
    
resetclasses ("a")
resetclasses ("d")


Just paste the first two into the appropriate sections, paste the last into your script file, then follow his instructions above. (classcount dormant, classcount active, classlist)
Semla
Ok I can not get this to work on any version posted here for Zmud. It states that all are 0 each time
Demfrax
QUOTE (Semla @ Oct 6 2009, 09:44 AM) *
Ok I can not get this to work on any version posted here for Zmud. It states that all are 0 each time


same here, so I just gave up cause there are only two classes in my house, heh
Dontarion
Balynne should use this for the Naga.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.