Sending the proc to all mobs. in Developer Help
|
|
Code:
var rYes
rNo
mob var voted = 0 rebootreason
verb Request_Reboot() if(usr.voted==1) usr << "<font color = red>Please wait atleast 3 minutes between votes." if(usr.voted==0) usr.voted = 1 usr.rebootreason = input("Why are you rebooting?","Reason","[usr.rebootreason]") if(length(usr.rebootreason)>300) usr << "That reason is to long. You still need to wait a 3 minutes to vote again." return else world << "<b><font color = green>[usr.key] has requested a reboot because '</b><i>[html_encode(usr.rebootreason)]</i>'<b><font color = green> You have 30 seconds to input your vote.</b></font>" for(var/mob/M in world) M << "Testing" M.rvote() sleep(300) if(rYes==rNo) world << "<b><font color = green>There has been a tie. Time to randomize!" var/maybe = rand(1,2) if(maybe==1) world << "<b><font color = green>And reboot it is!" world.rebootv() return else world << "<b><font color = red>No reboot wins!" return if(rYes>rNo) world << "<b><font color = green>Reboot has won! Here is what was voted.<br></b><font color = blue>Yes = [rYes]<br>No = [rNo]" world.rebootv() if(rNo>rYes) world << "<b><font color = green>Reboot has lost! Here is what was voted.<br></b><font color = blue>Yes = [rYes]<br>No = [rNo]" rNo = 0 rYes = 0 return sleep(1800) usr.voted = 0 mob proc rvote(mob/M) src << "<font color = red>Debug: You should get this message 1 time." switch(alert("Would you like a reboot?","Reboot voting.","Yes","No")) if("Yes") rYes+=1 return if("No") rNo+=1 return
|
Problem description:
Alright, basically, I want to send that rvote proc to all mobs. Well, if there are 3 mobs, it will send it to the mob 3 times. I do not know why. The odd thing is, it only sends the message "Testing" 1 time to me...Help me please.
EDIT: RESOLVED. The alert went to usr!
|
SO... the fix:
Hey, on your "rvote" proc, you have two returns!
*EDIT*
[May 13 19:41] Jon88: It's not the problem.
[May 13 19:41] Jon88: The correct response is "No pur usr in proc. Ungh."
[May 13 19:42] Kunark: So he doesn't understand "No put usr in proc. Ungh."
[May 13 19:42] Jon88: No, it's one of the "It's a problem now."