View Single Post
  #1  
Old 07-13-2013, 11:44 PM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
For Loop Only Going to 68

Hello,

I've made a script which checks a log on a UC server. The problem is that it only loops 68 times through the file, and stays at 68. I find this really unhelpful. Here's the script I have.

PHP Code:
function onCreated() {
    
temp.str.loadstring("logs/testlog.txt");
    echo(
searchString(temp.str"Testing123"));
}

function 
searchString(temp.stringtemp.search) {
  for (
this.0this.temp.string.length(); this.x++) {
    if(
temp.string.substring(this.x,temp.search.length()) == temp.search) {
      echo(
"Found string!");
      return 
temp.string.substring(this.100temp.search.length() + 100);
      break;
    }
  }

Thanks in advance! Also, is there a more efficient way of writing this? Say, with a log that has over 10,000 characters (the NPC Server stops the script after 10000 loops).
Reply With Quote