View Single Post
  #8  
Old 03-27-2012, 10:34 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Oh boy

PHP Code:
function onCreated() {
  
this.trigger("YourTerribleCodeFixed", 0, this.maxlooplimit*2);
}

function 
onYourTerribleCodeFixed(start, total) {
  
temp.sub = min(total, this.maxlooplimit);
  for (
temp.i = 0; temp.i < temp.sub; temp.i++) {
    echo(
start + temp.i);
  }
  
total -= temp.sub;
  if (
total > 0) {
    
this.scheduleevent(1, "YourTerribleCodeFixed",
                       
start + temp.sub, total);
  }
} 
e: You could also forgo the scheduleevent, but triggers have their own per-frame limit (10 or so).
e2: but at least if you do it will fail silently!
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote