hello, I'm currently writing a script editing app in c# to edit game scripts. I want to be able to load a script file and get the name of an NPC object and the script contents. The script looks like this:
INSTANCE PC_Thief(NPC_DEFAULT)
{
//-------- primary data --------
name = "Diego";
Npctype = NPCTYPE_FRIEND;
guild = GIL_STT;
level = 999; // real 25, aber 999 damit er nicht vor dem Troll flieht!
voice = 11;
id = 1;
flags = NPC_FLAG_IMMORTAL;
//-------- visuals --------
// animations
Mdl_SetVisual (self,"HUMANS.MDS");
// Body-Mesh Body-Tex Skin-Color Head-MMS Head-Tex Teeth-Tex
Mdl_SetVisualBody (self,"hum_body_Naked0", 0, 2, "Hum_Head_Thief", 15, 4, STT_ARMOR_H);
//--------- abilities --------
attribute[ATR_STRENGTH] = 70;
attribute[ATR_DEXTERITY] = 90;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX]= 340;
attribute[ATR_HITPOINTS] = 340;
protection[PROT_FIRE] = 1000;
Npc_SetTalentSkill (self, NPC_TALENT_PICKPOCKET,1);Npc_SetTalentValue(self,NPC_TALENT_PICKPOCKET,60);
Npc_SetTalentSkill (self, NPC_TALENT_SNEAK, 1);
Npc_SetTalentSkill (self, NPC_TALENT_PICKLOCK, 1);Npc_SetTalentValue(self,NPC_TALENT_PICKLOCK,60);
Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 6);
Npc_SetTalentSkill (self, NPC_TALENT_1H,1);
Npc_SetTalentSkill (self, NPC_TALENT_BOW,1);
//-------- inventory --------
EquipItem (self, Diegos_Bogen);
EquipItem (self, ItMw_1H_Sword_04);
CreateInvItems (self, ItAmArrow, 100);
//-------- ai --------
daily_routine = Rtn_PreStart_1;
fight_tactic = FAI_HUMAN_MASTER;
self.aivar[AIV_IMPORTANT] = TRUE;
senses = SENSE_SEE|SENSE_HEAR|SENSE_SMELL;
};
and here is the regex I'm using:
Regex ireg = new Regex("(instance|prototype)\\s+(?<ins>[^\\s]+).*\\{(?<text>[^(\\};)]+)\\};", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.Singleline);
However when I run this Rgex, I get the group, but all the group contains is 2 newlines. What am I doing wrong? I set the regex to singleline mode so that . would also match \n. Is that a wrong way of doing this? Can anyone help?
Thanks.