Author Topic: 2 problems: saving bricks serverside and scheduling.  (Read 1503 times)

Hey. It's me again. I have two new problems now: I have searched but haven't found any interesting information.

I need help with scheduling a function to make it happen every X minutes and the second one is saving bricks serverside.
I have tried saveBricks("testSave.bls",1,1); but it says command not found.

To save bricks server-sided, you'll have to write code that saves every brick as there's no default functionality for that.

If you're planning to write an autosaver (that's what your post sounds like), I've made the RTB auto saver a standalone add-on some time ago, maybe you should look at it:

https://dl.dropboxusercontent.com/u/143512782/bl/Server_RTBAutoSaver.zip

As far as making a basic schedule (tells you the time every second and will start/stop if you type toggleTimeLoop())

function toggleTimeLoop()
{
   if(isEventPending($timeLoopSched))
      cancel($timeLoopSched);
   else
      timeLoop();
}

function timeLoop()
{
   echo(getDateTime());
   $timeLoopSched = schedule(1000, 0, timeLoop);
}

As far as making a basic schedule (tells you the time every second and will start/stop if you type toggleTimeLoop())

function toggleTimeLoop()
{
   if(isEventPending($timeLoopSched))
      cancel($timeLoopSched);
   else
      timeLoop();
}

function timeLoop()
{
   echo(getDateTime());
   $timeLoopSched = schedule(1000, 0, timeLoop);
}

To save bricks server-sided, you'll have to write code that saves every brick as there's no default functionality for that.

If you're planning to write an autosaver (that's what your post sounds like), I've made the RTB auto saver a standalone add-on some time ago, maybe you should look at it:

https://dl.dropboxusercontent.com/u/143512782/bl/Server_RTBAutoSaver.zip
Thanks both of you, that helped.

As far as making a basic schedule (tells you the time every second and will start/stop if you type toggleTimeLoop())
Additionally, this will work as long as you only ever call toggleTimeLoop. But if you want to call it straight through the loop function, you need to add a cancel call to the first line to prevent multiple occurrences of the loop