In the following code, I wanted to extract all the text right of " has ". Though, when I run the script, it doesn't return the first character right of " has ".
Code:
void waitForTime() {
	if(getCT() > getRT()) {
		while(getCT() > 0) {}
	}
	else {
		while(getRT() > 0) {}
	}
}

void transfer(string patient) {
	send("appraise " + patient);
	waitFor(" ");
	string wounds = trim(getBuffer());
	if(contains(wounds, "...wait ") || contains(wounds, "Sorry, you may only type ahead ")) {
		waitForTime();
		transfer(patient);
	}
	else if(contains(wounds, " has no apparent ")) {
		echo("No injuries!");
	}
	else if(contains(wounds, "You take a quick appraisal of ")) {
		wounds = rightOf(leftOf(wounds, "."), " has ");
		echo(wounds);
	}
	else {
		echo("Invalid target!");
	}
}

void heal(string args) {
	trim(args);
	args = args + " ";
	while(!isEmpty(args)) {
		string patient = leftOf(args, " ");
		args = rightOf(args, patient);
		transfer(patient);
	}
}
Log of script running:
*******************
Script now executing.
*******************
appraise piru
You take a quick appraisal of Piru and find that he has a strange case of muscle twitching.He has constant muscle spasms.
strange case of muscle twitching
*******************
Script finished!
*******************
[Edited on 10-1-2004 by Jonty]