diff --git a/Chris.MultiNPC.lsl b/Chris.MultiNPC.lsl index 8772a19..e854cea 100644 --- a/Chris.MultiNPC.lsl +++ b/Chris.MultiNPC.lsl @@ -11,9 +11,9 @@ yoptions; // Create and controll a hord of npc at once. // Read the readme at https://clatza.dev/Christopher/OpenSim.Script.Chris.MultiNPC/src/branch/master/README.md //=================== - + list m_npcdata = []; - + readNPCPathNC(string ncName) { string nc = osStringReplace(osGetNotecard(ncName), "\n", ""); @@ -123,7 +123,7 @@ doNextScriptStep() continue; key currentNPCKey = getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot); - integer currentLine = getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".line"); + integer currentLine = (integer)getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".line"); string currentPath = getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".path"); string currentState = getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".state"); string currentncname = getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".ncname"); @@ -142,7 +142,7 @@ doNextScriptStep() if(currentState == "wait") { - integer waitTime = getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".waittime"); + integer waitTime = (integer)getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".waittime"); if(llGetUnixTime() < waitTime) continue; @@ -687,6 +687,11 @@ list setDataEntryInDataList(list _dataList, string _key, string _value) return llListReplaceList(_dataList, [_value], _inListPosition + 1, _inListPosition + 1); } +integer Key2Chan(key ID) +{ + return 0x80000000 | (integer)("0x"+(string)ID); +} + default { state_entry() @@ -718,6 +723,8 @@ state running { state_entry() { + //llListen(Key2Chan(llGetKey(), "", "", ""); + llSetTimerEvent(0.3); } @@ -731,20 +738,28 @@ state running listen( integer channel, string name, key id, string message) { + if(llGetOwnerKey(id) != llGetOwner()) + return; + if(message == "Stop all") { llSetTimerEvent(0); + return; } if(message == "Start all") { llSetTimerEvent(0.3); + return; } if(message == "Restart") { hardReset(""); + return; } + + } timer()