ID:1751699
 
(See the best response by Zecronious.)
Code:
 proc
FadeWindow()
set background = 1
var/o = winget(client,"loginsplash","alpha")
world << "[o]"
var/n = text2num("[o]")
var/m = num2text("[n]")
while(n >= 9)
n -= 10
winset(client,"loginsplash","alpha =[m]")
world << "[m]"
break

Problem description:
I am trying to fade the window "loginsplash" out gradually, I haven't used while loops extensivly, so I am not too sure of what I am doing... Right now it starts, and the windows opacity is 255, then immediately after it is 0.

Best response
The main problem you had was that you didn't include a sleep statement. The program will be executed each line as fast as possible, so fast that the alpha shoots straight to 0.

There was also a second more minor problem, that is you might have the case that the alpha ends up less than your intended 9 minimum. To solve that I introduced a min() function.

Here's the function directly as it was but with my alterations.
    proc
FadeWindow()
var/alphaString = winget(client,"loginsplash","alpha") // More descriptive names helps a lot.
var/alphaNumber = text2num(alphaString)
while(alphaNumber >= 9)
winset(client,"loginsplash","alpha =[alphaNumber]")
alphaNumber -= min(9,alphaNumber - 4)
sleep(0.5)

Here's the function again but upgraded to be modular.

    verb
FadeTest()
FadeWindow("loginsplash",0.5)

proc
FadeWindow(window,speed)
var/alphaString = winget(client,window,"alpha") // More descriptive names helps a lot.
var/alphaNumber = text2num(alphaString)
while(alphaNumber >= 9)
winset(client,window,"alpha =[alphaNumber]")
alphaNumber -= min(9,alphaNumber - 4)
sleep(speed)
Thanks! at least I was somewhat there...not really but, thanks for providing a modular bit too. Problem solved, working as I intended it to now
In response to Jadox
Hey sorry dude I just noticed I wrote one of those lines was wrong. Also I was using a high FPS so 0.5 worked for me but for most people 1 is lowest.

    verb
FadeTest()
FadeWindow("default",1)

proc
FadeWindow(window,speed)
var/alphaString = winget(client,window,"alpha") // More descriptive names helps a lot.
var/alphaNumber = text2num(alphaString)
while(alphaNumber >= 9)
winset(client,window,"alpha =[alphaNumber]")
alphaNumber = max(9,alphaNumber - 8) // This line was wrong.
sleep(speed)
Hmm, I used it exactly as you had it, and it worked fine
In response to Jadox
Yeah, just the one I posted will work better.