@q @program asys-vote 1 99999 d i ( asys-vote v1.2 Jessy@FurryMUCK 6/97, 7/99 asys-vote runs Argo +vote command, allowing players to cast votes for others based on good roleplaying. The results of these votes are used to allocate xp's, with the amounts and intervals based on configurable system parameters. INSTALLATION: asys-vote uses the default Argo installation method. Port and install lib-Argo. Set asys-vote W. Type '+install asys-vote' to install this program and its actions. Note: asys-vote records votes and keeps track of how many votes have been cast per player per interval, but does *not* do the actual tallying of votes and allotment of xp's. This is handled by the background asys-gameclock program, which must be installed and running in order for the voting system to work as described. USAGE: +vote .................. Display your current totals. +vote ......... Cast one of your votes alloted for this voting period for . +vote #log ............. Display log of possible alt-char voting violations. +vote #clear ........... Clear log of possible alt-char voting violations. +vote #strict .......... Set alt-detection to 'strict' [site-based] +vote #notstrict ....... Set alt-detection to 'not strict' [host-based] +vote #once ............ Set: players may vote for someone only once per voting interval. +vote #multiple ........ Set: players may vote for someone multiple times per voting interval. +vote #reset ........... Reset voting interval. Staff members may configure the voting system via the +tune command, using the following parameters: vote_interval .......... Time interval at which vote allotments will be reset and results tallied. Takes a time string such as '5 days' or '1 week'. vote_xp_given .......... Amount of xp's given to player when total number of votes cast for hem reach votes_required. votes_per_interval ..... Number of votes each player may cast during vote_interval. Tune to 'unlimited' to allow unlimited votes per interval. votes_required ......... Number of votes required in order to receive the xp bonus. Defaults are: vote_interval .......... 1 week vote_xp_given .......... 1 votes_per_interval ..... 3 votes_required ......... 10 See lib-Argo and the Argo manual for further information. asys-vote may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $include $lib/argo lvar scratch (* workspace var *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourArg (* inital arg string, unmodified *) lvar ourCom (* string: 'official' name of command *) lvar ourBoolean (* int: misc flow control var *) : DoInstall ( -- ) (* install program into Argo system *) caller program? not if (* confirm installation method *) ">> Programs must be installed via the " "+install" GetCommandName strcat " command." strcat Tell exit then prog "@a/version" getpropstr if (* confirm re-install *) ">> Reinstalling... " Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-vote" setprop RecOldActions #0 "+vote" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+vote" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+vote" setprop ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) prog "@a/name" getpropstr if #0 "@a/prog_list/" prog "@a/name" getpropstr strcat getprop not if ">> " prog name strcat " is not currently installed." strcat Tell pid kill then else ">> " prog name strcat " is not currently installed." strcat Tell pid kill then ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadYesNo not if ">> Aborted." Tell pid kill Then background "@a/comm_list/+vote" RemoveCommand #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop RecOldActions ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoHelp ( -- ) (* display help screen *) " " Tell "asys-vote (#" prog intostr strcat ")" strcat Tell " " Tell "The +vote command allows players to recognize and reward superior " "roleplay by casting votes. Acruing a significant amount of points " "results in a player receiving character development points. The " "length of a voting period, the number of votes you may cast during " "a voting period, the number of votes required to receive development " "points, and the number of points awarded are each configured by " "the MUCK's administrators. Current values for this MUCK are: " strcat strcat strcat strcat strcat strcat Tell " " Tell " Voting Period ................ " #0 "@a/sysparms/vote_interval" getpropstr strcat Tell " Votes per Period ............. " #0 "@a/sysparms/votes_per_interval" getpropstr strcat Tell " Votes Required for Points .... " #0 "@a/sysparms/votes_required" getpropstr strcat Tell " Points Awarded ............... " #0 "@a/sysparms/vote_xp_given" getpropstr strcat Tell " " Tell "You may not vote for yourself, and should not vote for alternate " "characters you control. This program attempts to detect such " "instances of alt-voting, and records them, but be advised that " "proper use of the system is players' responsibility. " "Currently, you may vote for someone " #0 "@a/vote/one_per" getpropstr if "only " else "more than " then "once per voting interval." strcat strcat strcat strcat strcat strcat Tell " " Tell "Syntax: " Tell " " Tell " " command @ strcat "...................................." strcat 33 strcut pop " Display your current vote total" strcat Tell " " command @ strcat " " strcat "...................................." strcat 33 strcut pop " Vote for " strcat Tell StaffCheck if " " Tell "Staff options: " Tell " " Tell " " command @ strcat " #log " strcat "...................................." strcat 33 strcut pop " Display log" strcat Tell " " command @ strcat " #clear " strcat "...................................." strcat 33 strcut pop " Clear log" strcat Tell " " command @ strcat " #strict " strcat "...................................." strcat 33 strcut pop " Set alt-detection to 'strict'" strcat Tell " " command @ strcat " #notstrict " strcat "...................................." strcat 33 strcut pop " Set alt-detection to 'not strict'" strcat Tell " " command @ strcat " #reset " strcat "...................................." strcat 33 strcut pop " Reset voting period." strcat Tell " " command @ strcat " #once " strcat "...................................." strcat 33 strcut pop " Set: Players may vote for someone only" strcat Tell " " 33 strcut pop " per voting interval" strcat Tell " " command @ strcat " #multiple " strcat "...................................." strcat 33 strcut pop " Set: Players may vote for someone multiple" strcat Tell " " 33 strcut pop " times per voting interval" strcat Tell " " Tell "'Strict' alt-detection is site-based. 'Not strict' is host-based. " "To allow unlimited votes per interval, do +tune votes_per_interva" "l = unlimited. When the 'unlimited' value is set, players may vote " "as many times as they wish, but may only vote for a given player " "once per interval." strcat strcat strcat strcat Tell then ; : DoStrict ( -- ) (* set alt-detection to strict *) (* 'strict' means that detection is site-based rather than host-based *) StaffCheck not if ">> Permission denied." Tell exit then #0 "@a/vote/strict" "yes" setprop ">> Alt-logging now set to 'strict'." Tell ; : DoNotStrict ( -- ) (* set alt-detection to strict *) (* 'strict' means that detection is site-based rather than host-based *) StaffCheck not if ">> Permission denied." Tell exit then #0 "@a/vote/strict" remove_prop ">> Alt-logging now set to 'not strict'." Tell ; : DoOne ( -- )(* set control prop: may only vote for a player once *) StaffCheck not if ">> Permission denied." Tell exit then #0 "@a/vote/one_per" "yes" setprop ">> Players may now vote for someone only once per voting interval." Tell ; : DoMany ( -- ) (* set control prop: may vote for player many times *) StaffCheck not if ">> Permission denied." Tell exit then #0 "@a/vote/one_per" remove_prop ">> Players may now vote for someone multiple times per voting " "interval." strcat Tell ; : DoReset ( -- ) (* reset start of current voting period to now *) StaffCheck not if (* check permission *) ">> Permission denied." Tell exit then (* get confirmation *) ">> Please confirm: You wish to start a new voting period? (y/n)" Tell ReadYesNo if #0 "@a/vote/voted/" RemoveDir #0 "@a/vote/one_per/" RemoveDir #0 "@a/vote/start" systime setprop (* reset start prop *) ">> Voting period reset." Tell (* notify *) else ">> Aborted." Tell then ; : DoLog ( -- ) (* display log of possible voting violations *) StaffCheck not if (* check permission *) ">> Permission denied." Tell exit then (* display header *) " " Tell "LOG OF POSSIBLE VOTING VIOLATIONS:" Tell " " Tell (* display log entries *) #0 "@a/vote/altlog#/" nextprop if #0 "@a/vote/altlog" ShowList else " < No current entries >" Tell then (* display grain-of-salt warning *) " " Tell "Note: The alt-detection system is not perfect. It is quite possible " "that some of these votes are legitimate. These log entries should " "simply be read as warnings that one character voted for another who " "logs in from the same site or a closely related site." strcat strcat strcat Tell ; : DoClearLog ( -- ) (* clear current entries in alt-voting log *) StaffCheck not if (* check permission *) ">> Permission denied." Tell exit then (* get confirmation *) ">> Please confirm: You wish to clear all entries in the log? (y/n)" Tell ReadYesNo if #0 "@a/vote/altlog" RemoveList (* clear log entries *) "@a/vote/altlog" (* record log-clearing *) "%D, %l:%M %p >> Log cleared by " me @ name strcat systime timefmt AddListLine ">> Log cleared." Tell else ">> Aborted." Tell then ; : DoWarnLog ( -- ) (* record possible alt-voting in log *) ourBoolean @ if exit then (* exit if already got one hit this vote *) "@a/vote/altlog" (* put log list name on stack *) (* format entry *) "%D, %l:%M %p >> " me @ name strcat " voted for " strcat depth pick name strcat systime timefmt (* timestamp it *) AddListLine (* add entry *) 1 ourBoolean ! (* note this hit for this vote *) " member to discuass." (* notify user *) " using an alt character to vote for yourself. Please page a staff " ">> Warning: This vote has been recorded as a possible instance of " Tell Tell Tell ; : DoVote ( -- ) (* if player has votes available and tar- get is found, cast vote for target *) (* check: user has votes to use? *) #0 "@a/sysparms/votes_per_interval" getpropstr "unlimited" smatch #0 "@a/sysparms/votes_per_interval" getpropstr atoi #0 "@a/vote/voted/" me @ intostr strcat getpropstr atoi > or if 0 ourBoolean ! (* clear alt-warn control var *) ourArg @ .pmatch dup if dup me @ dbcmp if ">> Sorry, you can't vote for yourself." Tell exit then #0 "@a/vote/one_per" getpropstr if #0 "@a/vote/one_per/" me @ intostr strcat "-" strcat 3 pick intostr strcat getprop if ">> Sorry, you have already voted for " swap name strcat " this voting period." strcat Tell exit then then dup "@/host" getpropstr (* check: maybe an alt? *) dup if #0 "@a/vote/strict" getpropstr if dup "." instr strcut swap pop "*" swap strcat then else pop "null1" then over "@/lasthost" getpropstr dup if #0 "@a/vote/strict" getpropstr if dup "." instr strcut swap pop "*" swap strcat then else pop "null1" then me @ "@/host" getpropstr dup not if pop "null2" then over smatch if DoWarnLog then me @ "@/lasthost" getpropstr dup not if pop "null2" then over smatch if DoWarnLog then pop me @ "@/host" getpropstr dup not if pop "null2" then over smatch if DoWarnLog then me @ "@/lasthost" getpropstr dup not if pop "null2" then over smatch if DoWarnLog then pop dup "@/email" getpropstr dup not if pop "null3" then me @ "@/email" getpropstr dup not if pop "null4" then smatch if DoWarnLog then #0 "@a/vote/votes/" 3 pick intostr strcat over over getpropstr atoi 1 + intostr setprop #0 "@a/vote/voted/" me @ intostr strcat over over getpropstr atoi 1 + intostr setprop #0 "@a/vote/one_per" getpropstr if #0 "@a/vote/one_per/" me @ intostr strcat "-" strcat 3 pick intostr strcat systime intostr setprop then ">> You have received a vote for good roleplay." notify ">> Vote recorded." Tell else ">> Sorry, player not found." Tell pop then else ">> Sorry, you've used all your votes for this voting period." Tell then ; : DoStatus ( -- ) (* display votes user currently has *) ">> You currently have " #0 "@a/vote/votes/" me @ intostr strcat getpropstr atoi intostr dup "1" smatch if pop "1 vote" else " votes" strcat then strcat " for good roleplaying." strcat Tell ">> You will receive a character point when your total reaches " #0 "@a/sysparms/votes_required" getpropstr strcat " votes." strcat Tell ">> You have used " #0 "@a/vote/voted/" me @ intostr strcat getpropstr atoi intostr strcat " of your " strcat #0 "@a/sysparms/votes_per_interval" getpropstr atoi intostr dup "1" smatch if strcat " vote for this voting period." strcat else dup "0" smatch if pop "(unlimited) votes for this voting period." strcat else strcat " votes for this voting period." strcat then then Tell ">> The current voting period length is " #0 "@a/sysparms/vote_interval" getpropstr strcat "." strcat Tell ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! Update ourArg @ if ourArg @ "#" stringpfx if "#help" ourArg @ stringpfx if DoHelp else "#log" ourArg @ stringpfx if DoLog else "#clear" ourArg @ stringpfx if DoClearLog else "#strict" ourArg @ stringpfx if DoStrict else "#notstrict" ourArg @ stringpfx if DoNotStrict else "#once" ourArg @ stringpfx if DoOne else "#multiple" ourArg @ stringpfx if DoMany else "#reset" ourArg @ stringpfx if DoReset else "#enable" ourArg @ stringpfx if DoEnable else "#disable" ourArg @ stringpfx if DoDisable else "#version" ourArg @ stringpfx if DoVersion else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then then then then then then then then then then exit then else DoStatus exit then me @ ArgoPermCheck Disabled? DoVote ; . c q @set asys-vote=W