ID:1107571
 
(See the best response by Jemai1.)
Code:
mob/proc/DTAlert(mob/judge,mob/killer)
judge << switch(alert("[killer] is guilty of a school kill. Would you like to send them to detention?",,"Yes","No"))
if("Yes")
flick('Apparate.dmi',killer)
killer.loc=locate(19,78,2)
world<<"<b>[killer] has been put in detention by [M].</b>"
killer.jailed = 1
killer.spelllocked = 1
killer.Muted = 1
else
M << "That's fine."


Problem description:

I'm trying to make it so that mob/judge receives a popup message whenever this proc is activated. I get an error saying that switch is an undefined proc.

Best response
You cannot use switch with a << operator. To specify the mob who should be alerted, set it as the first argument of the alert proc.
alert(judge,"[killer] is guilty of a school kill. Would you like to send them to detention?",,"Yes","No")

http://www.byond.com/docs/ref/info.html#/proc/alert
Thank you. I can't believe I was that stupid.
 mob/proc/Alert(mob/J,mob/K)
switch(alert(J,"[K] is guilty of being sexy. Send him to jail?","Juding","Yes","No"))
if("No")
J<<"Thats fine"
return
if("Yes")
flick('Apparate.dmi',K)
K.loc=locate(19,78,2)
world<<"<b>[K] has been put in jail by [J]."
K.jailed=1
K.spelllocked=1
K.Muted=1
return


mob/verb/Call_Alert_Proc(mob/J in world,mob/K in world)
Alert(J,K)



Check if that works for you.