Need syntax help

Line 3 (SendMessageToPC) is not right. I get an unknown compiler state. What should it be?

nValue = GetLocalInt(oPC, “BasementRatDead”) + 1;
SetLocalInt(oPC, “BasementRatDead”, nValue);

SendMessageToPC(oPC, “+IntToString(nValue)+” rats dead");

I’m trying to debug another script and want to see what value local int “BasementRatDead” is every time a rat is killed. This is placed at the end of the standard on death script as a new modified script.

Here’s the entire added on script. There are no compiler problems if that last line is removed:

int nValue;

// Get the creature who triggered this event.
object oPC = GetLastKiller();

// We are really interested in the ultimate master of the killer.
while ( GetMaster(oPC) != OBJECT_INVALID )
    oPC = GetMaster(oPC);

// Only fire once.
if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
    return;
SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

// Set a local integer.
nValue = GetLocalInt(oPC, "BasementRatDead") + 1;
SetLocalInt(oPC, "BasementRatDead", nValue);

SendMessageToPC(oPC, "+IntToString(nValue)+" rats dead");

}

SendMessageToPC(oPC, IntToString(nValue) + " rats dead");

1 Like

Check this pinned thread. It has links to both the online and the offline versions of the lexicon. You can then check the format of any function or keyword you wish to use. It also has links to a slew of tutorials as well.

Using this pinned thread will show you a number of different ways to get your scripts to format properly in these threads. For example the above code could look like this -

	int nValue;

	// Get the creature who triggered this event.
	object oPC = GetLastKiller();

	// We are really interested in the ultimate master of the killer.
	while ( GetMaster(oPC) != OBJECT_INVALID )
		oPC = GetMaster(oPC);

	// Only fire once.
	if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
		return;

		SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

	// Set a local integer.
	nValue = GetLocalInt(oPC, "BasementRatDead") + 1;
	SetLocalInt(oPC, "BasementRatDead", nValue);

	SendMessageToPC(oPC, "+IntToString(nValue)+" rats dead");
}

TR

2 Likes

Thanks. Minus a " and a + and I’m there.

2 Likes