Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorcrash_D.
    • CommentTimeApr 8th 2008
     # 1
    Hi,,, suppose you have a site, and you want to have something happen at a random moment in time... i'd have it like the entire site flips upside down for half a second, but it could be anything from a "hi" alert to a redirect to a different page... but i need a now-and-then trigger of something like a flip...
    the question:

    how do i run a script at a random moment in time (with a probability, of course)?

    so, for example, during the session, on the 69 second the screen flips upside down for half a second... then on 320th second the screen goes black for half a second etc...

    thanks
    •  
      CommentAuthory2kbg
    • CommentTimeApr 8th 2008
     # 2
    lol what is this for?
  1.  # 3
    A late April Fools Day joke?
    • CommentAuthortimfire
    • CommentTimeApr 9th 2008
     # 4
    There probably are a number of ways of actually implementing this, but I suspect you would have to use some sort of javascript function that (1) keeps time and (2) either activates the effects itself, or calls other functions to activate the effects. If you wanted to be fancy, you could also throw in some sort of AJAX feature were the javascript checks the server and/or database for instructions on what to do.
    •  
      CommentAuthorcrash_D.
    • CommentTimeApr 9th 2008
     # 5
    timefire, you are right.. this is exactly what i want, i mean javascript-based time checker which triggers other javascript scripts.... but i don't know how to start... if you could tell me the general algorithm, id be grateful...

    and there actually certain applicable sense in this, ... its not a joke.... stay for a relatively long time for example at http://conclave.ru and you will udnerstand what i mean
    • CommentAuthormarkezz
    • CommentTimeApr 9th 2008
     # 6
    the only things you need to do are saving seconds and pure javascript together with a key in a 3-column table defining one action, write an additional javascript for the forum that invokes a frequent (eg. every 10 seconds) ajax-request with two parameters containing the elapsed time and the actions that were already executed (maybe separated by minus) to a script that queries the table described above for not yet executed actions in the elapsed-timeframe and outputs the pure action (base64-encoded) javascript code that can be (base64-decoded and) eval'd by the requesting script.
    with a second table or more columns in that one table you can also make the actions user/group-specific.
Add your comments
    Username Password
  • Format comments as