@verb #1371:"@polls" any none none rxdo #7153 @program #1371:"@polls" any none none "Usage: @polls/@vote/@respond " " -=> Tells you the latest polls, and allows you to vote in them. Valid responses are 'yes', 'no', and 'don't know'. The 'all' argument shows you all the polls, including the ones you've voted in." this:update_usage(verb) if (ban = this:check_banned_vote(player)) player:tell("Sorry, you have been banned from voting until ", ctime(ban), ".") return endif all = index(dobjstr, "all") polls = this.polls player:tell($su:centre(all ? "Latest Polls" | "All Polls", player:linelen(), "-", "-")) if (!polls) player:tell("There are no new polls for you to respond to.") else for x in [1..length(polls)] if (player in polls[x][7] && !all) else player:tell(tostr(player in polls[x][7]) ? "* " | " ", tostr(x), ". ", valid(who = polls[x][2]) ? who.name | "", " asked, \"", polls[x][1], "\" [Expires: ", ctime(polls[x][3]), "]") endif endfor endif player:tell($su:centre(all ? "* marks polls you have already voted in" | "", player:linelen(), "-", "-")) if (!(ch = toint($command_utils:read("the poll you wish to vote in")))) player:tell("Your choice must be a number.") elseif (ch > length(this.polls)) player:tell("Valid polls are between 1 and ", length(this.polls)) elseif (player in this.polls[ch][7]) player:tell("You've already voted in that poll.") else an = $command_utils:read("yes or no to cast your vote. Enter anything else to respond don't know") a = index(an, "no") ? 5 | (index(an, "yes") ? 4 | 6) this.polls[ch][a] = this.polls[ch][a] + 1 this.polls[ch][7] = setadd(this.polls[ch][7], player) player:tell("You cast your vote as ", a == 5 ? "no" | (a == 4 ? "yes" | "don't-know"), ".") endif "Last modified by Dax (#789) on Tue May 3 14:09:33 2005 MDT." .