Voting System.. Help Anyone?

Posted by Xyrex on Wed 13 Mar 2002 07:12 PM — 3 posts, 13,933 views.

#0
I want to implement a voting system on my mud, but I don't know WHERE to begin! Here is what I want it to do in a nutshell.

--KEY--
-> = does action
"" = does command


-------

Player A -> "candidate council1"
Player B -> "vote player A council1"

Player 1 votes = 1 for Position council1
------------------------------------------------

In essence, I want a person to be able to first toggle a flag that marks them as a candidate (versus they meet min. req.) - then other players can vote on him, for that certain position. But I also have to have another check, Player A and Player B both must be in the same "Kingdom" (which I suppose I could setup using a flag in char_data, and compare against that). Basically there will be several kingdoms and they should be able to vote for 4 council member positions within their own kingdom only. And I want an imm command to "make the voting" time ready.. I could do this by cedit'ng the levels of the commands above to 65 until I declare it voting time.?! ..

Any ideas, help, info, sites, would be GREATLY appreciated thanks a lot. I think I can handle it, I just need a starting point.

Xyrex
#1
hmm, maybe it was alittle too complex. Can anyone atleast point me to a good place to ask this question? Atleast to find some info on where I can go to give me some insights on how to do this...




--Xyrex
Australia Forum Administrator #2
Yes, you would need a couple of extra fields in the character data. eg.


int is_candidate;
int votes;
int kingdom;
int has_voted;


You would initially set "is_candidate" "votes" and "has_voted" to zero (false). Then they can become a candidate if they want. Also they vote by adding 1 to the "votes" field for their candidate (providing the kingdom matches), and then set the "has_voted" flag for the person doing the voting, otherwise they could vote twice.

You could have a system-wide flag about whether an election is running, as at the point of starting the election is an obvious place to clear the "votes" and "has_voted" fields.