world/proc
StartAutoEvent()
set waitfor = 0
var/eventlist=list("PvP","Race","Free for All")
var/event=pick(eventlist-LastEvent)
LastEvent=event
world<<output("<font size = 3><center><font color=green>The Event [event] will start!","output2")
world<<output("<font size = 2><center>(The Register for the Event is Open! 3 Minutes Duration!)","output2")
InWaiting=list()
RegisterOpen=1
sleep(1800)
RegisterOpen=0
if(InWaiting.len<4)
for(var/mob/Z in InWaiting)
Z:inregister=0
InWaiting=list()
world<<output("<font size = 2><center><font color=red>Event [event] was canceled because few people registered","output2")
return
switch(event)
if("Race")
InitiateRace()
if("PvP")
InitiatePVP()
if("Free for All")
InitiateFFA()
And then I changed it to this to open an window for players to press a button to register to the event...
world/proc
StartAutoEvent()
set waitfor = 0
var/eventlist=list("PvP","Race","Free for All")
var/event=pick(eventlist-LastEvent)
LastEvent=event
world<<output("<font size = 3><center><font color=green>The Event [event] will start!","output2")
world<<output("<font size = 2><center>(The Register for the Event is Open! 3 Minutes Duration!)","output2")
InWaiting=list()
RegisterOpen=1
for(var/mob/player/M in players-staffers)
var/mapfocus=0
if(winget(M,"win_main.map","focus=")=="true")//If their map was focused
mapfocus=1
winset(M,"win_register.name","text=\"The Event [event] will start!\"")
winshow(M,"win_register", 1)
if(mapfocus)//Focus it again, so it doesn't disturb pvp's, etc...
winset(M,"win_main.map","focus=true")
sleep(1800)
RegisterOpen=0//The code breaks before this happens
for(var/mob/player/M in players-staffers)
winshow(M,"win_register", 0)
if(InWaiting.len<4)
for(var/mob/Z in InWaiting)
Z:inregiser=0
InWaiting=list()
world<<output("<font size = 2><center><font color=red>Event [event] was canceled because few people registered","output2")
return
switch(event)
if("Race")
InitiateRace()
if("PvP")
InitiatePVP()
if("Free for All")
InitiateFFA()
But it so happens that after I've done this, the code breaks before closing the register (with 'RegisterOpen=0', as marked on the code above). I was guessing something like players disconnecting before the code within for was done but it doesn't give out runtimes either, so what can I possible be doing wrong? Thanks in advance.