Sign in to follow this  
Followers 0
vivec45

help with a variable problem

2 posts in this topic

#1 ·  Posted (edited)

Global $looped = 0

While 1

MsgBox(0, "Test", "Test result: " & $looped + 1, 2500)

Sleep(1000)

WEnd

I am using this concept in a script and I want to add "1" to the integer $looped so i can see how many times the loop has ran, and put it in a message (i could do this if i could add to the variable each time), does anyone know how to do this so it doesnt just say "Test result: 1" over and over, i would like it to say "Test result: 1", then "Test result: 2" etc.

Thanks everyone,

Rob

Edited by vivec45

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Global $looped = 0

While 1
    $looped += 1
    MsgBox(0, "Test", "Test result: " & $looped, 2500)
    Sleep(1000)
WEnd

or

Global $looped = 0

While 1
    MsgBox(0, "Test", "Test result: " & loop($looped), 2500)
    Sleep(1000)
WEnd

Func loop(ByRef $var)
    $var += 1
    return $var
EndFunc
Edited by DYONISII

http://dev.dyonisii.com/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0