for(var/mob/M in world)
switch(input("[Q]?? - by [usr]","Vote in less than 30 seconds!") in list("Option 1","Option 2","Cancel"))
// this gives me the same menu for how many players there are on..which is not what I want. How could I send this to all players?
ID:144196
Feb 28 2007, 12:48 pm
|
|
Code:
|
Feb 28 2007, 1:01 pm
|
|
First you need an if(M.client) which is really important.
|
In response to Xx Dark Wizard xX
|
|
the input still doesnt popup for the M's
|
In response to Morf
|
|
for(var/mob/M in world) |
In response to A.T.H.K
|
|
Ah, I forgot to put the M in, try ATHK's example it should work and use as null|anything instead of the cancel option.
|
In response to Xx Dark Wizard xX
|
|
Yes, ATHK got it right. input() has an optional first argument which is the player that gets the input box - by default, it's usr, so you need to specify it in cases like this.
Also, I don't think checking if the client is valid is very important in this case, as input() should just terminate with no input box generated and return null, which isn't exactly fatal. :) |
In response to Kaioken
|
|
Plus, you should probably be looping through all clients rather then all mobs. Duh.
|
In response to Kaioken
|
|
Kaioken wrote:
Yes, ATHK got it right. input() has an optional first argument which is the player that gets the input box - by default, it's usr, so you need to specify it in cases like this. If you try to send input() or alert() to a clientless mob, you'll get a "bad client" error. However, this is easily avoided if you loop through all clients in the world, not all mobs in the world. Of course, one additional consideration is that input() will wait for a response, so you'll need to spawn() out each call to it. Lummox JR |