Bug workaround: Identifying monsters in scripts via relay browser

gemelli

Member
Hola!

I just started playing with ASH today, and I can tell I'm going to have a lot of fun with it.  Kudos to all you developers and nutty scripters!

While browsing through Illarion's script, I found out that when you execute an ASH script via the relay browser, the "eek" variable (monster ID) does not get passed to your script.  I'm sure there will be a fix ready for this soon, but in the meantime, feel free to use the following code near the top of main() as an exception handler for us poor relay browser junkies.

Code:
	monster zilch=$monster[];

	if(eek==zilch) {

		// Try to figure out what we're fighting ... gets around relay browser bug
		iStart = index_of(sText, "You're fighting " )+1;
		if (iStart > 0)
		{
			iEnd = index_of(sText, "</span>", iStart);
		}
		if (iStart > 0 && iEnd > 0)
		{
			sTemp = substring(sText,iStart+34,iEnd );
			// if (dbug) { print("PARSED MONSTER NAME: " + sTemp); }
			int iCutoff = index_of(sTemp," ");
			mName = substring(sTemp,iCutoff+1);
			// if (dbug) { print("Monster Name:  " + mName); }
		}
		eek = string_to_monster(mName);
	}
 
Top