include library.utils; trigger OnSpeaking(string text) { if ( (text.startsWith("grantXP")) || (text.startsWith("revokeXP")) ) { java.util.StringTokenizer st = new java.util.StringTokenizer(text); if ( st.countTokens() != 3 ) { debugSpeakMsg(self, "PARAM ERROR - syntax: "); return SCRIPT_OVERRIDE; } string cmd = st.nextToken(); string xpType = st.nextToken(); int amt = utils.stringToInt(st.nextToken()); if ( amt == -1 ) { debugSpeakMsg(self, "PARSE ERROR - syntax: "); } obj_id target = getLookAtTarget(self); if ( (target == null) || (target == obj_id.NULL_ID) ) { target = self; } if ( !isPlayer(target) ) { debugSpeakMsg(self, "test_xp: invalid target for action!"); return SCRIPT_OVERRIDE; } if ( cmd == "grantXP" ) { if ( grantExperiencePoints(target, xpType, amt) != XP_ERROR) { debugSpeakMsg(target, "test_xp(grantXP): " + xpType + " + " + amt + " = " + getExperiencePoints(target, xpType)); } } else if ( cmd == "revokeXP" ) { if ( grantExperiencePoints(target, xpType, -amt) != XP_ERROR) { debugSpeakMsg(target, "test_xp(revokeXP): " + xpType + " - " + amt + " = " + getExperiencePoints(target, xpType)); } } return SCRIPT_OVERRIDE; } else if ( text.startsWith("getXP") ) { java.util.StringTokenizer st = new java.util.StringTokenizer(text); if ( st.countTokens() != 2 ) { debugSpeakMsg(self, "PARAM ERROR - syntax: getXP "); return SCRIPT_OVERRIDE; } string cmd = st.nextToken(); string xpType = st.nextToken(); obj_id target = getLookAtTarget(self); if ( (target == null) || (target == obj_id.NULL_ID) ) { target = self; } if ( !isPlayer(target) ) { debugSpeakMsg(self, "test_xp: invalid target for action!"); return SCRIPT_OVERRIDE; } int xp = getExperiencePoints(target, xpType); debugSpeakMsg(target, "XP: " + xpType + " = " + xp); return SCRIPT_OVERRIDE; } return SCRIPT_CONTINUE; }