XP tracker
This is one of those "Gain XP for being logged in and getting +votes" systems.
Functions:
add(),
center(),
convtime(),
div(),
extract(),
fdiv(),
get(),
gte(),
iter(),
lt(),
match(),
mid(),
mudname(),
name(),
not(),
num(),
or(),
orflags(),
repeat(),
setq(),
sub(),
switch(),
time(),
type(),
u(),
words().
Features:
color substitutions.
Compatibility:
TinyMUX.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for XP tracker
@@ This is a modified version of the XP System as created by Gwen Morse (goldmooneachna@yahoo.com).
@@ Changes Include:
@@ * Took out parts of the @aconnect which @pemit-ed to connecting players their XP stats. (This was simply our preference to keep spam down.)
@@ * Modified output to be formatted to our MUX standard (higlighted yellow trim with highlighted green text for player code, and higlighted cyan trim and highlighted maroon text for staff code).
@@ * Made +votes from players worth .1XP and staff votes worth .5XP.
@@ * Every 10 hours of connection time nets a .1XP award, and resets votes to 10.
@@ * The XP System now keeps track of a player's last 15 votes. Players cannot vote for the same person within the first 3 votes of the list.
@@ * Added Staff-only command: +xp/status. This allows Staff to get a player's XP status and see the last 15 people they have voted for.
@@ * Added Staff-only command: +xp/set. This allows Staff to adjust a player's XP.
@@
@@ Important Notes:
@@ * The +vote command makes use of the Mux in a Minute STAT system and references the 'bkapprove' ability to determine if a character is approved or not. If you are not using that set of code, it will need to be removed or replaced by similar code that works for your MUX.
@@ * The flaglists of the @aconnect, @adisconnect, and XP attributes will need to be looked at and modified for your MUX's use to ensure it works like you want it to.
@@ * +xp will not work for players/staff with any of the following flags: Wizard, Royalty, Staff, Immortal, Fixed, Head, Uninspected. Meaning you will have to test it with an approved player character on your MUX. (Had a few people claim it was broke so felt I should add this note here. ;)
@@
@@ These revisions were done by Xelloss@ChaosMUX (unopened). Email: voidspiral@hotmail.com.
@@
@@ *** Be sure to take note of the last of the file before quoting this text!
@create XP System=10
@Aconnect XP System=@switch [orflags(%#,WZwif?g)]=0,{@switch [gte(u(%#/timeon),36000)]=1,{&STATSXP %#=[add([u(%#/STATSXP)],.1)]; @wait 1=&timeon %#=0; &votes %#=10;}
@Adisconnect XP System=@switch [orflags(%#,WZwif?g)]=0,{&timeon %#=[add(u(%#/timeon),sub(convtime(time()),convtime(u(%#/last))))]};
&VOTE XP System=$+vote *:@switch [isstaff(%#)][match(type(*%0),PLAYER)][or([not([match([getabil(%#,bkapprove)],Approved*)])],[match([extract([get(%#/LASTVOTE)],1,3,|)],[num(*%0)],|)],[match(%#,[num(*%0)])],[lt(get(%#/VOTES),1)])]=00?,{@Pemit %#=%ch%cg[mudname()] XP System:%cn That is not a valid player.},10?,{@pemit %#=%ch%cm[mudname()] XP System:%cn That is not a valid player.},011,{@Pemit %#=%ch%cg[mudname()] XP System:%cn You may not vote for the same player twice, for yourself, if you are unapproved or if you are out of votes.},010,{&VOTES %#=[sub(get(%#/VOTES),1)]; &STATSXP *%0=[add(get(*%0/XP),.1)]; @pemit %#=%ch%cg[mudname()] XP System:%cn You have voted for [name(*%0)].;&LASTVOTE %#=[switch([words([get(%#/LASTVOTE)])],0,[num(*%0)],<14,[num(*%0)]|[get(%#/LASTVOTE)],[num(*%0)]|[extract([get(%#/LASTVOTE)],1,14,|)])];@pemit *%0=%ch%cg[mudname()] XP System:%cn Someone has just voted for you!},11?,{&STATSXP *%0=[add(get(*%0/XP),.5)];@pemit *%0=%ch%cg[mudname()] XP System:%cn A Staff member has just voted for you!;&LASTVOTE %#=[switch([words([get(%#/LASTVOTE)])],0,[num(*%0)],<14,[num(*%0)]|[get(%#/LASTVOTE)],[num(*%0)]|[extract([get(%#/LASTVOTE)],1,14,|)])];@pemit %#=%ch%cm[mudname()] XP System:%cn You have voted for [name(*%0)].}
&XP XP System=$+xp:@switch [orflags(%#,WZwif?g)]=0,{@pemit %#=[center(%ch%cy>%b%ch%cg[mudname()] XP System%b%ch%cy<%cn,78,%ch%cy=%cn)]%rYou have [u(%#/STATSXP)] Experience Point(s), and [u(%#/VOTES)] Vote(s).;@switch [gte(u(%#/timeon),36000)]=1,{@pemit %#=You have earned an additional XP award for connection time!%r[center(%ch%cy>%b%ch%cgRecent +VOTES%b%ch%cy<%cn,78,%ch%cy-%cn)]%r[setq(0,[extract([get(%#/LASTVOTE)],1,3,|)])][switch([words(%q0,|)],0,You have not voted for anyone yet!,1,[name(*%q0)],[andlist([iter(%q0,[name(*##)],|)])])]%r[repeat(%ch%cy-%cn,78)]%rDon't forget to +vote for good RP!%r[repeat(%ch%cy=%cn,78)]; &STATSXP %#=[add([u(%#/STATSXP)],.1)]; @wait 1=&timeon %#=0; &votes %#=10;},0,{@switch gte(u(%#/timeon),32400)=0,{@pemit %#=You have [mid(fdiv(div(sub(36000,u(%#/timeon)),60),60),0,3)] hours left before you get an XP award for connection time.%r[center(%ch%cy>%b%ch%cgRecent +VOTES%b%ch%cy<%cn,78,%ch%cy-%cn)]%r[setq(0,[extract([get(%#/LASTVOTE)],1,3,|)])][switch([words(%q0,|)],0,You have not voted for anyone yet!,1,[name(*%q0)],[andlist([iter(%q0,[name(*##)],|)])])]%r[repeat(%ch%cy-%cn,78)]%rDon't forget to +vote for good RP!%r[repeat(%ch%cy=%cn,78)]},1,{@pemit %#=You have [div(sub(36000,u(%#/timeon)),60)] minutes left before you get an XP award for connection time.%r[center(%ch%cy>%b%ch%cgRecent +VOTES%b%ch%cy<%cn,78,%ch%cy-%cn)]%r[setq(0,[extract([get(%#/LASTVOTE)],1,3,|)])][switch([words(%q0,|)],0,You have not voted for anyone yet!,1,[name(*%q0)],[andlist([iter(%q0,[name(*##)],|)])])]%r[repeat(%ch%cy-%cn,78)]%rDon't forget to +vote for good RP!%r[repeat(%ch%cy=%cn,78)]}}}
&CREDITS XP System=This XP tracker was coded by Gwen Morse (goldmooneachna@yahoo.com). It has been modified by Xelloss@ChaosMUX from its original version to work with the MiaM code from Pendersen and the SGP globals as provided in the release of TinyMUX 2.0/2.1. Later minimal revisions by Gwen Morse to make it more universally portable.
@set XP System=INHERIT
@set XP System=SAFE
@@ The following commands should be placed on your Global Staff Object, or another object use-locked to Staff members.
@@ You can easily replace the text ##Global Staff Object## with your object information.
&CMD-XP_STATUS ##Global Staff Object##=$+xp/status *:@switch [setq(0,[num(*%0)])][type(%q0)]=PLAYER,{@pemit %#=[center(%ch%cc>%b%ch%cm[mudname()] XP System%b%ch%cc<%cn,78,%ch%cc=%cn)]%r[name(*%q0)] has [u(%q0/STATSXP)] Experience Point(s), and [u(%q0/VOTES)] Vote(s).;@switch [gte(u(%q0/timeon),36000)]=1,{@pemit %#=[name(*%q0)] has earned an additional XP award for connection time!%r[center(%ch%cc>%b%ch%cmRecent +VOTES%b%ch%cc<%cn,78,%ch%cc-%cn)]%r[setq(1,[get(%q0/LASTVOTE)])][switch([words(%q1,|)],0,[name(*%q0)] has not voted for anyone yet!,1,[name(*%q1)],[andlist([iter(%q1,[name(*##)],|)])])]%r[repeat(%ch%cy=%cn,78)]; &STATSXP %q0=[add([u(%q0/STATSXP)],.1)]; @wait 1=&timeon %q0=0; &votes %q0=10;},0,{@switch gte(u(%q0/timeon),32400)=0,{@pemit %#=[name(*%q0)] has [mid(fdiv(div(sub(36000,u(%#/timeon)),60),60),0,3)] hours left before receiving an XP award for connection time.%r[center(%ch%cc>%b%ch%cmRecent +VOTES%b%ch%cc<%cn,78,%ch%cc-%cn)]%r[setq(1,[get(%q0/LASTVOTE)])][switch([words(%q1,|)],0,[name(*%q0)] has not voted for anyone yet!,1,[name(*%q1)],[andlist([iter(%q1,[name(*##)],|)])])]%r[repeat(%ch%cc=%cn,78)]},1,{@pemit %#=[name(*%q0)] has [div(sub(36000,u(%#/timeon)),60)] minutes left before receiving an XP award for connection time.%r[center(%ch%cc>%b%ch%cmRecent +VOTES%b%ch%cc<%cn,78,%ch%cc-%cn)]%r[setq(1,[get(%q0/LASTVOTE)])][switch([words(%q1,|)],0,[name(*%q0)] has not voted for anyone yet!,1,[name(*%q1)],[andlist([iter(%q1,[name(*##)],|)])])]%r[repeat(%ch%cc=%cn,78)]}}},{@pemit %#=%ch%cm[mudname()] XP System:%cn ERROR: Cannot locate a player named '%0'.}
&CMD-XP_SET ##Global Staff Object##=$+xp/set *=*:@switch [setq(0,[num(*%0)])][type(*%q0)]=PLAYER,{@switch [setq(1,[add([get(%q0/STATSXP)],%1)])][lt(%q1,0)]=1,{@pemit %#=%ch%cm[mudname()] XP System:%cn You may not drop a player's XP below 0.},{&STATSXP %q0=%q1;@pemit %#=%ch%cm[mudname()] XP System:%cn You adjust [name(*%q0)]'s XP by %1. Their total XP is: [get(%q0/STATSXP)].;@pemit *%q0=%ch%cg[mudname()] XP System:%cn A Staff member has adjusted your XP! Your total XP is: [get(%q0/STATSXP)].}},{@pemit %#=%ch%cm[mudname()] XP System:%cn ERROR: Cannot locate a player named '%0'.}
@@ Changes Include:
@@ * Took out parts of the @aconnect which @pemit-ed to connecting players their XP stats. (This was simply our preference to keep spam down.)
@@ * Modified output to be formatted to our MUX standard (higlighted yellow trim with highlighted green text for player code, and higlighted cyan trim and highlighted maroon text for staff code).
@@ * Made +votes from players worth .1XP and staff votes worth .5XP.
@@ * Every 10 hours of connection time nets a .1XP award, and resets votes to 10.
@@ * The XP System now keeps track of a player's last 15 votes. Players cannot vote for the same person within the first 3 votes of the list.
@@ * Added Staff-only command: +xp/status. This allows Staff to get a player's XP status and see the last 15 people they have voted for.
@@ * Added Staff-only command: +xp/set. This allows Staff to adjust a player's XP.
@@
@@ Important Notes:
@@ * The +vote command makes use of the Mux in a Minute STAT system and references the 'bkapprove' ability to determine if a character is approved or not. If you are not using that set of code, it will need to be removed or replaced by similar code that works for your MUX.
@@ * The flaglists of the @aconnect, @adisconnect, and XP attributes will need to be looked at and modified for your MUX's use to ensure it works like you want it to.
@@ * +xp will not work for players/staff with any of the following flags: Wizard, Royalty, Staff, Immortal, Fixed, Head, Uninspected. Meaning you will have to test it with an approved player character on your MUX. (Had a few people claim it was broke so felt I should add this note here. ;)
@@
@@ These revisions were done by Xelloss@ChaosMUX (unopened). Email: voidspiral@hotmail.com.
@@
@@ *** Be sure to take note of the last of the file before quoting this text!
@create XP System=10
@Aconnect XP System=@switch [orflags(%#,WZwif?g)]=0,{@switch [gte(u(%#/timeon),36000)]=1,{&STATSXP %#=[add([u(%#/STATSXP)],.1)]; @wait 1=&timeon %#=0; &votes %#=10;}
@Adisconnect XP System=@switch [orflags(%#,WZwif?g)]=0,{&timeon %#=[add(u(%#/timeon),sub(convtime(time()),convtime(u(%#/last))))]};
&VOTE XP System=$+vote *:@switch [isstaff(%#)][match(type(*%0),PLAYER)][or([not([match([getabil(%#,bkapprove)],Approved*)])],[match([extract([get(%#/LASTVOTE)],1,3,|)],[num(*%0)],|)],[match(%#,[num(*%0)])],[lt(get(%#/VOTES),1)])]=00?,{@Pemit %#=%ch%cg[mudname()] XP System:%cn That is not a valid player.},10?,{@pemit %#=%ch%cm[mudname()] XP System:%cn That is not a valid player.},011,{@Pemit %#=%ch%cg[mudname()] XP System:%cn You may not vote for the same player twice, for yourself, if you are unapproved or if you are out of votes.},010,{&VOTES %#=[sub(get(%#/VOTES),1)]; &STATSXP *%0=[add(get(*%0/XP),.1)]; @pemit %#=%ch%cg[mudname()] XP System:%cn You have voted for [name(*%0)].;&LASTVOTE %#=[switch([words([get(%#/LASTVOTE)])],0,[num(*%0)],<14,[num(*%0)]|[get(%#/LASTVOTE)],[num(*%0)]|[extract([get(%#/LASTVOTE)],1,14,|)])];@pemit *%0=%ch%cg[mudname()] XP System:%cn Someone has just voted for you!},11?,{&STATSXP *%0=[add(get(*%0/XP),.5)];@pemit *%0=%ch%cg[mudname()] XP System:%cn A Staff member has just voted for you!;&LASTVOTE %#=[switch([words([get(%#/LASTVOTE)])],0,[num(*%0)],<14,[num(*%0)]|[get(%#/LASTVOTE)],[num(*%0)]|[extract([get(%#/LASTVOTE)],1,14,|)])];@pemit %#=%ch%cm[mudname()] XP System:%cn You have voted for [name(*%0)].}
&XP XP System=$+xp:@switch [orflags(%#,WZwif?g)]=0,{@pemit %#=[center(%ch%cy>%b%ch%cg[mudname()] XP System%b%ch%cy<%cn,78,%ch%cy=%cn)]%rYou have [u(%#/STATSXP)] Experience Point(s), and [u(%#/VOTES)] Vote(s).;@switch [gte(u(%#/timeon),36000)]=1,{@pemit %#=You have earned an additional XP award for connection time!%r[center(%ch%cy>%b%ch%cgRecent +VOTES%b%ch%cy<%cn,78,%ch%cy-%cn)]%r[setq(0,[extract([get(%#/LASTVOTE)],1,3,|)])][switch([words(%q0,|)],0,You have not voted for anyone yet!,1,[name(*%q0)],[andlist([iter(%q0,[name(*##)],|)])])]%r[repeat(%ch%cy-%cn,78)]%rDon't forget to +vote for good RP!%r[repeat(%ch%cy=%cn,78)]; &STATSXP %#=[add([u(%#/STATSXP)],.1)]; @wait 1=&timeon %#=0; &votes %#=10;},0,{@switch gte(u(%#/timeon),32400)=0,{@pemit %#=You have [mid(fdiv(div(sub(36000,u(%#/timeon)),60),60),0,3)] hours left before you get an XP award for connection time.%r[center(%ch%cy>%b%ch%cgRecent +VOTES%b%ch%cy<%cn,78,%ch%cy-%cn)]%r[setq(0,[extract([get(%#/LASTVOTE)],1,3,|)])][switch([words(%q0,|)],0,You have not voted for anyone yet!,1,[name(*%q0)],[andlist([iter(%q0,[name(*##)],|)])])]%r[repeat(%ch%cy-%cn,78)]%rDon't forget to +vote for good RP!%r[repeat(%ch%cy=%cn,78)]},1,{@pemit %#=You have [div(sub(36000,u(%#/timeon)),60)] minutes left before you get an XP award for connection time.%r[center(%ch%cy>%b%ch%cgRecent +VOTES%b%ch%cy<%cn,78,%ch%cy-%cn)]%r[setq(0,[extract([get(%#/LASTVOTE)],1,3,|)])][switch([words(%q0,|)],0,You have not voted for anyone yet!,1,[name(*%q0)],[andlist([iter(%q0,[name(*##)],|)])])]%r[repeat(%ch%cy-%cn,78)]%rDon't forget to +vote for good RP!%r[repeat(%ch%cy=%cn,78)]}}}
&CREDITS XP System=This XP tracker was coded by Gwen Morse (goldmooneachna@yahoo.com). It has been modified by Xelloss@ChaosMUX from its original version to work with the MiaM code from Pendersen and the SGP globals as provided in the release of TinyMUX 2.0/2.1. Later minimal revisions by Gwen Morse to make it more universally portable.
@set XP System=INHERIT
@set XP System=SAFE
@@ The following commands should be placed on your Global Staff Object, or another object use-locked to Staff members.
@@ You can easily replace the text ##Global Staff Object## with your object information.
&CMD-XP_STATUS ##Global Staff Object##=$+xp/status *:@switch [setq(0,[num(*%0)])][type(%q0)]=PLAYER,{@pemit %#=[center(%ch%cc>%b%ch%cm[mudname()] XP System%b%ch%cc<%cn,78,%ch%cc=%cn)]%r[name(*%q0)] has [u(%q0/STATSXP)] Experience Point(s), and [u(%q0/VOTES)] Vote(s).;@switch [gte(u(%q0/timeon),36000)]=1,{@pemit %#=[name(*%q0)] has earned an additional XP award for connection time!%r[center(%ch%cc>%b%ch%cmRecent +VOTES%b%ch%cc<%cn,78,%ch%cc-%cn)]%r[setq(1,[get(%q0/LASTVOTE)])][switch([words(%q1,|)],0,[name(*%q0)] has not voted for anyone yet!,1,[name(*%q1)],[andlist([iter(%q1,[name(*##)],|)])])]%r[repeat(%ch%cy=%cn,78)]; &STATSXP %q0=[add([u(%q0/STATSXP)],.1)]; @wait 1=&timeon %q0=0; &votes %q0=10;},0,{@switch gte(u(%q0/timeon),32400)=0,{@pemit %#=[name(*%q0)] has [mid(fdiv(div(sub(36000,u(%#/timeon)),60),60),0,3)] hours left before receiving an XP award for connection time.%r[center(%ch%cc>%b%ch%cmRecent +VOTES%b%ch%cc<%cn,78,%ch%cc-%cn)]%r[setq(1,[get(%q0/LASTVOTE)])][switch([words(%q1,|)],0,[name(*%q0)] has not voted for anyone yet!,1,[name(*%q1)],[andlist([iter(%q1,[name(*##)],|)])])]%r[repeat(%ch%cc=%cn,78)]},1,{@pemit %#=[name(*%q0)] has [div(sub(36000,u(%#/timeon)),60)] minutes left before receiving an XP award for connection time.%r[center(%ch%cc>%b%ch%cmRecent +VOTES%b%ch%cc<%cn,78,%ch%cc-%cn)]%r[setq(1,[get(%q0/LASTVOTE)])][switch([words(%q1,|)],0,[name(*%q0)] has not voted for anyone yet!,1,[name(*%q1)],[andlist([iter(%q1,[name(*##)],|)])])]%r[repeat(%ch%cc=%cn,78)]}}},{@pemit %#=%ch%cm[mudname()] XP System:%cn ERROR: Cannot locate a player named '%0'.}
&CMD-XP_SET ##Global Staff Object##=$+xp/set *=*:@switch [setq(0,[num(*%0)])][type(*%q0)]=PLAYER,{@switch [setq(1,[add([get(%q0/STATSXP)],%1)])][lt(%q1,0)]=1,{@pemit %#=%ch%cm[mudname()] XP System:%cn You may not drop a player's XP below 0.},{&STATSXP %q0=%q1;@pemit %#=%ch%cm[mudname()] XP System:%cn You adjust [name(*%q0)]'s XP by %1. Their total XP is: [get(%q0/STATSXP)].;@pemit *%q0=%ch%cg[mudname()] XP System:%cn A Staff member has adjusted your XP! Your total XP is: [get(%q0/STATSXP)].}},{@pemit %#=%ch%cm[mudname()] XP System:%cn ERROR: Cannot locate a player named '%0'.}