ID:139775
 
Code:
proc
BG()
spawn()
var/list/BG_List=list()
while(Backgrounds)
BG_List = flist("Images/")
var/s = file(pick(BG_List))
for(var/client/C)
winset(C, "default", "image=[s]")
alert(C, "S : [s]")
winset(C, "SetBackground", "is-checked=true")
bg = s
sleep(3600)
for(var/client/C)
winset(C, "SetBackground", "is-checked=false")
winset(C, "default", "image=\"\"")


Problem description:
well i have it set that the game/tool automatically cycles through backgrounds at login, and its always checking for new ones :P, problem is its telling me which backgrounds its suppose to set but its not actually setting them D:.

Masschaos100 wrote:
Code:
> proc
> BG()
> spawn()
> var/list/BG_List=list()
> while(Backgrounds)
> BG_List = flist("Images/")
> var/s = file(pick(BG_List))
> for(var/client/C)
> winset(C, "default", "image=[s]")
> alert(C, "S : [s]")
> winset(C, "SetBackground", "is-checked=true")
> bg = s
> sleep(3600)
> for(var/client/C)
> winset(C, "SetBackground", "is-checked=false")
> winset(C, "default", "image=\"\"")
>

Problem description:
well i have it set that the game/tool automatically cycles through backgrounds at login, and its always checking for new ones :P, problem is its telling me which backgrounds its suppose to set but its not actually setting them D:.

*BUMP* since this got buried by Raimo's post
proc
BG()
spawn()
var/list/BG_List=list()
while(Backgrounds)
BG_List = flist("Images/")
var/s
var/last_bg="[bg]"
s=file(pick(BG_List))
while("[s]" == last_bg)
s=file(pick(BG_List))
var/file=fcopy_rsc(s)
var/icon/I=new(file)
for(var/mob/C in world)
if(!C.client) continue
winset(C, "default", "image=[I]")
alert(C, "S : [s]")
winset(C, "SetBackground", "is-checked=true")
bg = "[s]"
last_bg="[s]"
sleep(3600)
for(var/mob/C in world)
if(!C.client) continue
winset(C, "SetBackground", "is-checked=false")
winset(C, "default", "image=\"\"")
got an invalid filename error so i had to fix it :S
proc
BG()
spawn()
var/list/BG_List=list()
while(Backgrounds)
BG_List = flist("Images/")
var/s
var/last_bg="[bg]"
s=file(pick(BG_List))
while("[s]" == last_bg)
s=file(pick(BG_List))
for(var/mob/C in world)
if(!C.client) continue
winset(C, "default", "image=[s]")
alert(C, "S : [s]")
winset(C, "SetBackground", "is-checked=true")
bg = "[s]"
last_bg="[s]"
sleep(3600)
for(var/mob/C in world)
if(!C.client) continue
winset(C, "SetBackground", "is-checked=false")
winset(C, "default", "image=\"\"")
In response to Masschaos100
I have a question, why're you using spawn()? Doesn't spawn call the procedure again without letting the next one finished? I thought that this was only supposed to be use for things like editing a value on multiple mobs in an area.
In response to OrangeWeapons
well i'm using spawn because the procs that calls this needs to continue :p