Help with profession npc

Hi! I was wondering if someone can help me with this script http://pastebin.com/rU7YHEVq (Profession npc). The script is working as intended but what I want it to do is - check for a “token” in the player’s inventory and if he has it, take one or two or whatever is configured and raise his skill by +8 (for example) everytime he clicks the corresponding gossip menu option (Engineering for ex. and take a token from him). Thanks in advance !!