From 5d6bfe808c43fd59a4bc37b3613d18a89a3b8adf Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 29 Jul 2021 07:22:52 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9EChris.MultiNPC.lsl=E2=80=9C=20=C3=A4nd?= =?UTF-8?q?ern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Chris.MultiNPC.lsl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Chris.MultiNPC.lsl b/Chris.MultiNPC.lsl index a0d90ec..3f7b35c 100644 --- a/Chris.MultiNPC.lsl +++ b/Chris.MultiNPC.lsl @@ -20,9 +20,14 @@ default { state_entry() { + + m_npcdata = llCSV2List(osGetDataValue("tmp." + llGetKey())); + hardReset(); + m_lastTimeCheck = llGetUnixTime(); checkOSPermissions(); readAllNPCPathNC(); + state waitingForPlayers; } } @@ -318,6 +323,8 @@ doNextScriptStep() llSay(0, "Unknown command '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed."); } } + + osSetDataValue("tmp." + llGetKey(), llList2CSV(m_npcdata)); } readNPCPathNC(string ncName) @@ -378,8 +385,12 @@ hardReset() while(dataListCount--) if(checkDataEntryInDataList(m_npcdata, "npc." + dataListCount)) osNpcRemove((key)getDataEntryFromDataList(m_npcdata, "npc." + dataListCount)); - - llResetScript(); + + m_lastTimeCheck = 0; + m_npcdata = []; + osDeleteDataValue("tmp." + llGetKey()); + + //llResetScript(); } //Generic Helpers @@ -410,5 +421,6 @@ list setDataEntryInDataList(list _dataList, string _key, string _value) _dataList += [_key, _value]; return _dataList; } + return llListReplaceList(_dataList, [_value], _inListPosition + 1, _inListPosition + 1); } \ No newline at end of file