rejetto forum

while coming

0 Members and 1 Guest are viewing this topic.

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
this will work in next build.

Code: [Select]
{.set|#x|10.}
{.while|#x|{: {.dec|#x.} ciao! :}.}


the test-block can be anything.
the example is a short for this more generic form

Code: [Select]
{.set|#x|10.}
{.while|{:{.^#x.}:}|{: {.dec|#x.} ciao! :}.}


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2039
    • View Profile
The static variables are one more in hfs but attention, because variables so defined will be available in common with all the current connections, what lets suppose that in the previous example every user, what will make execute the macro of the example, will deduct the variable *x.

at start time
first user connected
(user1) define #x as 10

at start time + one delay
(user1) dec #x ->  #x contain 9

at start time + two delay
(user1) dec #x ->  #x contain 8

at start time + three delay
second user connected
(user2) define #x as 10
(user1) dec #x ->  #x contain 9

at start time + four delay
(user2) dec #x ->  #x contain 8
(user1) dec #x ->  #x contain 7

.........

at the end every user has the follow result

(user1) 9 8 9 7 5 3 1  ciao!
(user2) 7 5 3 1 ciao!

it is the same macro but not the same result. 8)
 :D ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
it's up to you to use it wisely.
anyway AFAIK, nothing will interrupt the while.
if you are running the while, there's no user interaction/connection that will interfere.
the while can easily HANG hfs for a while.
i will put an optional timeout.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2039
    • View Profile
If I tell all this, it is not for me, but to warn risks which the persons can meet with their scripts. If you are attentive in various posts that I make on sources, I am certain that you will know how to implant railings which will avoid posts 'report of bug' ;)
« Last Edit: April 16, 2009, 04:24:23 PM by mars »