„Chris.MultiNPC.lsl“ ändern

This commit is contained in:
Christopher 2021-10-18 08:18:05 +00:00
parent c248416be2
commit 29728273e8
1 changed files with 19 additions and 4 deletions

View File

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