ID:144119
 
Code:
var/sudden_total=0
var/standard_total=0
var/survival_total=0
mob/proc/VOTE()
switch(input("What mode would you like to play?") in list("Standard Freeze Tag","Sudden Death Tag","Survival Freeze Tag"))
if("Standard Freeze Tag")
standard_total++
if("Sudden Death Tag")
sudden_total++
if("Survival Freeze Tag")
survival_total++
mob
Staff
verb
Vote()
set category = "GM"
set name = "Vote"
if(begun)
return
else if(AutoHost=="On")
return
else
if(players.len)
sudden_total=0
standard_total=0
survival_total=0

for(var/mob/M in players)
M.VOTE()
world <<"GAME: You have 10 Seconds to Vote!"
sleep(100)
if(standard_total > sudden_total && standard_total > survival_total)
world.Begin_Regular()
else if(sudden_total > standard_total && sudden_total > survival_total)
world.Begin_Sudden_Death()
else if(survival_total > standard_total && survival_total > sudden_total)
world.Begin_Survival()
else
if(standard_total == sudden_total || standard_total == survival_total || sudden_total == survival_total)
world <<"<font size = 4 color=red>GAME: The Vote was a TIE! Re-Vote!"
Vote()


Problem description:

Well as the topic title said, it only allows the Host who inniates the verb Vote. I know this isn't the most effecient code, but I want to get it working before I try and perfect it. Any suggestions as to why M.VOTE() doesn't call for all the mobs?

Sorry if this is a newbish question, if it is just tell me and I'll try and figure it out lol.

-KirbyAllStar

Festina lente
1) Fix up your slient usr abuse. Where? Simple, in input() of the mob/proc [should be input(src,..) otherwise it'll use usr by default, which is what youd DON'T want from what Isee in your loop)

2) The reason why it's not being called to everyone or after sometime is that the loop you made waits for the person to reply before moving on. A way to give it to everyone at (almost) the same time is to use spawn()
for(var/client/C)//Making sure that clients [players] can get the input() choice, not NPCs
spawn() C.mob.Vote()//spawn() causes..well, the proc to happen after ~1 tick. Because it happens after the proc is called, the loop will not wait for the reply


- GhostAnime
In response to GhostAnime
Wow, thanks. I had no idea that input used usr by default. I thought I had gotten rid of my usr abuse, but I was wrong... :-(

Thanks Again

-KirbyAllStar