In the NPC script you can set the flags using this.var
PHP Code:
function onCreated() {
this.foo = "hey dood sup";
}
Then when you check the NPC flags you'll see 'foo=hey dood sup'
You can then also access it through any other serverside script with 'findnpc("NPCname").foo' or just simply NPCname.foo