ID:156670
 
var/list/entrants = list()

mob
proc
pinput()
for(var/mob/player/P in world)
P.entry = input(P,"Enter your acronym.","Acronym!")
spawn(450)
if(P.entry == null)
P<<"<small><small>You didnt enter an acronym in time!"
else
entrants.Add(P)
P << "Time is up!"
world << "<b><FONT COLOR = purple>[name]- [P.entry]"
/*
How do I go about getting a vote of entrants from every player, then output a winning result to the world?
*/




How do I go about getting a vote of entrants from every player, then output a winning result to the world?
Look here for the max() reference. You could use that to find the winning one.
In response to Hi1
Ahh! Awesome Thanks. Ive never used that proc before.

But I also wanto ask, how do you use arglist to get mob arguments out of a list and then generate a vote for the world.

I don't know if thats very clear but..

I want the whole world vote for players in a list of people that have been added beforehand.
In response to Slic3y
var/mob/X = input(Ref, "Pick your opponent","MORTAL KOMBAT") in /list_ref //  Lets assume that this reference contains a mob reference and not text
world << "<b>MORTAL KOMBAT:</b> [Ref.name] vs. [X.name], FIGHT!"
Battle.Start(X, Ref) // Do not worry about this, just for completeness... kinda. The previous line should be within this procedure anyways...
In response to GhostAnime
I don't really understand Ref even after looking through the reference this doesn't make much sense to me.

Here is a commented snippet of what I'm trying for.

var/list/entrants = list()//define my list.

mob
proc
pinput()
for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
spawn(450)//in 45..
if(P.entry == null)//If P doesnt enter anything
P<<"<small><small>You didnt enter an acronym in time!"//send this message
else//otherwise
entrants.Add(P)//add them to the entrants list
P << "Time is up!"//tell them time is up..
world << "<b><FONT COLOR = purple>[name]- [P.entry]"//display the world everyones acronym.
spawn(100)//in 10.
input(P, "Vote for an acronym!","Vote!") in entries //vote for people in the entries list.
if(entries)//if they chose an entry
Vote(P, entries)//call this proc.
Vote()//vote proc
entry.vote += 1//give the entry voted for a vote.
//I really havent much idea about this last part from the spawn(100) down to here.
In response to Slic3y
Ref means reference, the object (in this case, a client's /mob) you want the input to go to.

As for tallying up the votes, you may want to read this article abotu associative lists: http://www.byond.com/members/ DreamMakers?command=view_post&post=32170

What you want to do is add one to each of the acronym names, and at the end, go through and select the entry with the highest vote and announce it to the world!
In response to GhostAnime
Ok. Heres my latest attempt, It works by myself but somehow I doubt it works with more players. suggestions?

proc/Randomletter()
usr.initial = ascii2text(rand(65,90)) //set these initials as a random letter.

proc/Randomletter1()
usr.initial2 = ascii2text(rand(65,90))//same here

proc/Randomletter2()
usr.initial3 = ascii2text(rand(65,90))//same here

mob
verb
Host_Game()
if(client.hosting < 1)//if client hosting is less than 1 continue
client.hosting = abs(1)//make it 1
usr.theme = input("What is the Theme for this round?.","Theme?")//send an input to determine the theme
world << "<b><FONT COLOR = purple>[usr.name] has started a game of Acrophobia!"//message
sleep 5//sleep..
world << "<b><FONT COLOR = purple>The game will start in 10 seconds!"//..
sleep 60//..
world << "<b><FONT COLOR = purple>Get ready!"//...
sleep 40//..
world << "<b><FONT COLOR = purple>{Round One} Start! - Theme: <FONT COLOR = blue>[usr.theme]."//...
Randomletter()//Get us a random letter
Randomletter1()//and another..
Randomletter2()//once more
Host_game()//call the next section.
else//otherwise
usr << "A game is already being played!"//tell them this.

mob
proc
Host_game()
world << "<b><FONT COLOR = purple>The initials for this round are: <I><FONT COLOR = blue>[src.initial] [src.initial2] [src.initial3]"//give the random initials.
spawn(15)
world << "<b><FONT COLOR = purple>Players have 45 seconds to enter their acronyms."
spawn(15)
pinput()//call the next proc..

var/list/entrants = list("Randomtest","randomtest2")//define my list.
mob
proc
pinput()
for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
spawn(450)//in 45..
if(P.entry == null)//If P doesnt enter anything
P<<"<small><small>You didnt enter an acronym in time!"//send this message
else//otherwise
entrants.Add(P)//add them to the entrants list
P << "Time is up!"//tell them time is up..
world << "<b><FONT COLOR = purple>[name]- [P.entry]"//display the world everyones acronym.
spawn(150)//when everything here is done wait 15...
P.Voting()//and call the next proc.
Voting()
for(var/mob/player/P in world)//for all the players in the world
P.picked = input(P,"Vote for an acronym!","Vote!") in entrants//vote for people in the entrants list. add their name to picked.
if(entrants)//if they did choose an entrant
Voted(P, entrants)//call the next proc.'

Voted()
for(var/mob/M in entrants)//for mobs in entrants..
if(picked == M)//if they were picked.
M.vote += 1//give them a vote.
mob
verb
test()
usr<< "[usr] has [usr.vote] votes!!"//just to test.
In response to Slic3y
Okay... make a list of the entrants, and, using a if() statement, to check if they are an entrant, give them a 'votes' var, when they click on a 'vote' verb, make a pane pop up, with the list of every mob in the 'entrants' list, have them pick one, however ya want, and when they do, just raise there votes var, by 1, when time is up, check to see which player has the highest votes var. (It may be vague, but it should work, depending on how good you are with windows/panes)
In response to Wolfnova
Could I do this with a vote Proc instead of verb?
In response to Slic3y
Code:
var/list/entrants = list()//define my list.
mob
proc
pinput()
for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
spawn(450)//in 45..
if(P.entry == null)//If P doesnt enter anything
P<<"<small><small>You didnt enter an acronym in time!"//send this message
else//otherwise
entrants.Add(P)//add them to the entrants list
P << "Time is up!"//tell them time is up..
world << "<b><FONT COLOR = purple>[P.name]- [P.entry]"//display the world everyones acronym.
spawn(150)//when everything here is done wait 15...
P.Voting()//and call the next proc.
Voting()
for(var/mob/P in world)
P.picked = input(,P,"Vote for an acronym!","Vote!") in entrants//vote for people in the entrants list. add their name to picked.
if(entrants)//if they did choose an entrant
Voted(P, entrants)//call the next proc.'

Voted()
for(var/mob/M in world)//for mobs in entrants..
if(picked == M)//if they were picked.
M.vote += 1//give them a vote.


Problem description:

My problem Is, It sends players an input for every person in the world at Voting().. I want them to get only one vote.
In response to Slic3y
That would be because you have nested loops. So, for every player in the world, it loops through every player in the world, and sends them an input.

Also your input in Voting() needs to have P as a first argument, otherwise it defaults to usr which shouldn't be used in procs.
In response to Garthor
Oh, I see.. I think this is right.

var/list/entrants = list()//define my list.
mob
proc
pinput()
for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
spawn(450)//in 45..
world << "Time is up!"
if(P.entry == null)//If P doesnt enter anything
P<<"<small><small>You didnt enter an acronym in time!"//send this message
else//otherwise
entrants.Add(P)//add them to the entrants list
world << "<b><FONT COLOR = yellow>[P.name]- [P.entry]"//display the world everyones acronym.
spawn(150)//when everything here is done wait 15...
P.Voting(P)//and call the next proc.


Voting(mob/player/P)
P.picked = input(P,"Vote for an acronym!","Vote!") in entrants//vote for people in the entrants list. add their name to picked.
if(entrants)//if they did choose an entrant
Voted(P, entrants)//call the next proc.'
spawn(300)
Finishup()

Voted()
for(var/mob/M in entrants)//for mobs in entrants..
if(picked == M)//if they were picked.
M.vote += 1//give them a vote.

Finishup()
for(var/mob/M in entrants)
world << "[M] finished with [M.vote] votes!!"
winner = max(M.vote)
M << "Your winner is [winner]!"
client.hosting = abs(0)
M.vote = 0


Although this is really inefficient and players receive inputs amazingly slow.

Any advice?
In response to Slic3y
input() causes the procedure to wait. So, the spawn() afterward only occurs AFTER the player has given their input.
In response to Garthor
Oh, Ok. I never thought of that.. Thanks Garthor!
In response to Slic3y
I seem to be really struggling with this. I removed Spawn() and it still has a really long delay before players receive inputs. The delay varies between people so I'm really not sure.

Here it is:

proc/Randomletter()
usr.initial = ascii2text(rand(65,90)) //set these initials as a random letter.

proc/Randomletter1()
usr.initial2 = ascii2text(rand(65,90))//same here

proc/Randomletter2()
usr.initial3 = ascii2text(rand(65,90))//same here

mob
verb
Host_Game()
if(client.hosting < 1)//if client hosting is less than 1 continue
client.hosting = abs(1)//make it 1
usr.theme = input("What is the Theme for this round?.","Theme?")//send an input to determine the theme
world << "<b><FONT COLOR = yellow>[usr.name] has started a game of Acrophobia!"//message
sleep 5//sleep..
world << "<b><FONT COLOR = yellow>The game will start in 10 seconds!"//..
sleep 60//..
world << "<b><FONT COLOR = yellow>Get ready!"//...
sleep 40//..
world << "<b><FONT COLOR = yellow>{Round One} Start! - Theme: <FONT COLOR = cyan>[usr.theme]."//...
Randomletter()//Get us a random letter
Randomletter1()//and another..
Randomletter2()//once more
Host_game()//call the next section.
else//otherwise
usr << "A game is already being played!"//tell them this.

mob
proc
Host_game()
world << "<b><FONT COLOR = yellow>The initials for this round are: <I><FONT COLOR = cyan>[src.initial] [src.initial2] [src.initial3]"//give the random initials.
sleep(15)
world << "<b><FONT COLOR = yellow>Players have 45 seconds to enter their acronyms."
pinput()//call the next proc..

var/list/entrants = list()//define my list.
mob
proc
pinput()
for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
sleep(450)//in 45..
world << "Time is up!"
if(P.entry == null)//If P doesnt enter anything
P<<"<small><small>You didnt enter an acronym in time!"//send this message
else//otherwise
entrants.Add(P)//add them to the entrants list
world << "<b><FONT COLOR = yellow>[P.name]- [P.entry]"//display the world everyones acronym.
sleep(150)//wait 15...
P.Voting(P)//and call the next proc.


Voting(mob/player/P)
P.picked = input(P,"Vote for an acronym!","Vote!") in entrants//vote for people in the entrants list. add their name to picked.
if(entrants)//if they did choose an entrant
Voted(P, entrants)//call the next proc.'
world << "<b><FONT COLOR = yellow>Players have 45 seconds to vote!"
sleep(450)
Finishup()

Voted()
for(var/mob/M in entrants)//for mobs in entrants..
if(picked == M)//if they were picked.
M.vote += 1//give them a vote.

Finishup()
for(var/mob/M in entrants)//for all the players in entrants
world << "[M] finished with [M.vote] votes!!"//tell the world their votes
var/winner = max(M)//I dont really know how I would do this, but this proc looks like a good idea.
M << "Your winner is [winner]!"//tell them the winner
client.hosting = abs(0)//the game is no more!
M.vote = 0//get rid of all the votes.
mob
var
picked = ""
In response to Slic3y
            for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
sleep(450)//in 45..


What, exactly, are you EXPECTING to happen? for() is not a parallel processor. Each element in the list is processed one at a time. If this process sleeps, then that delays when the NEXT one will be processed. If you wait for input, it sleeps until input is provided. If you sleep, it sleeps for as long as you told it to sleep.

I'm really unclear how you took my response to mean "replace that spawn() with a sleep()" though.
In response to Garthor
oh, because I was doing it like this:

            for(var/mob/player/P in world)//for all the players in the world.
P.entry = input(P,"Enter your acronym.","Acronym!")//Send them this input.
spawn(450)//in 45..


I know what you mean now. So whats a better way of doing this? I don't know any methods without using for().
In response to Slic3y
There's nothing wrong with using for() here. You just think it does something that it doesn't do. You need to use spawn() so that each input is in its own thread.