ID:179172
 
I have a new_game verb which any player can select, which is supposed to prompt each player for approval to restart the game. However, it ends up just prompting the same player once per person. The only player to be prompted is, of course, the player who selected the new_game verb. I'm using Dan's TakeTurns code, and here is some of my relevant code. Please let me know if you see my problem.

Thanks.
============================

mob/player/verb/new_game()
if (Prompt_all() )
...

mob/player/proc/Prompt1()
var/answer = input("Agree to reset the game?") in list("yes","no")
if (answer == "no")
return 0
else
return 1

proc/Prompt_all()
var/reset_agree = 1
for(var/mob/player/P in trn.players)
reset_agree = P.Prompt1()
return (reset_agree)
dramstud wrote:
I have a new_game verb which any player can select, which is supposed to prompt each player for approval to restart the game. However, it ends up just prompting the same player once per person. The only player to be prompted is, of course, the player who selected the new_game verb. I'm using Dan's TakeTurns code, and here is some of my relevant code. Please let me know if you see my problem.

The problem is with input(): It takes as a first argument the person it should send to. Normally, this is usr, so that's the default value. Since that's not the desired behavior in this case, you should use src (since it's called by a proc belonging to the player to be prompted) before the question.

For this kind of yes/no question, alert() might be more appropriate, but that's a matter of style and preference.

Lummox JR
In response to Lummox JR
Thanks!