| baseman101 |
07-13-2013 11:44 PM |
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.string, temp.search) { for (this.x = 0; this.x < temp.string.length(); this.x++) { if(temp.string.substring(this.x,temp.search.length()) == temp.search) { echo("Found string!"); return temp.string.substring(this.x - 100, temp.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).
|