add npc commands

This commit is contained in:
Christopher 2021-07-29 09:53:02 +02:00
parent 6ed4b1c5e0
commit 6d5ac839af
1 changed files with 62 additions and 4 deletions

View File

@ -21,7 +21,7 @@ default
state_entry()
{
removeOldNPC();
m_lastTimeCheck = llGetUnixTime();
checkOSPermissions();
readAllNPCPathNC();
@ -74,10 +74,10 @@ state running
if (change & CHANGED_REGION_START)
hardReset();
}
on_rez(integer start_param)
{
hardReset();
hardReset();
}
}
@ -197,6 +197,48 @@ integer script_appearance(integer slot, key npc, list command)
return TRUE;
}
integer script_animation(integer slot, key npc, list command)
{
if(llGetInventoryType(llList2String(command, 1)) != INVENTORY_ANIMATION)
{
llSay(0, "Cant find animation '" + llList2String(command, 1) + "'.");
return FALSE;
}
osNpcPlayAnimation(npc, llList2String(command, 1));
return TRUE;
}
integer script_StopAnimation(integer slot, key npc, list command)
{
if(llGetInventoryType(llList2String(command, 1)) != INVENTORY_ANIMATION)
{
llSay(0, "Cant find animation '" + llList2String(command, 1) + "'.");
return FALSE;
}
osNpcStopAnimation(npc, llList2String(command, 1));
return TRUE;
}
integer script_profileImage(integer slot, key npc, list command)
{
if(llGetInventoryType(llList2String(command, 1)) != INVENTORY_TEXTURE)
{
llSay(0, "Cant find image '" + llList2String(command, 1) + "'.");
return FALSE;
}
osNpcSetProfileImage(npc, llList2String(command, 1));
return TRUE;
}
integer script_profileText(integer slot, key npc, list command)
{
osNpcSetProfileAbout(npc, llList2String(command, 1));
return TRUE;
}
integer script_include(integer slot, key npc, list command)
{
if(llGetInventoryType(llList2String(command, 1) + ".path") != INVENTORY_NOTECARD)
@ -323,6 +365,22 @@ doNextScriptStep()
if(script_appearance(currentNPCSlot, currentNPCKey, lineCommandData))
currentNPCSlot--;
break;
case "animation":
if(!script_animation(currentNPCSlot, currentNPCKey, lineCommandData))
llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed.");
break;
case "stopAnimation":
if(!script_StopAnimation(currentNPCSlot, currentNPCKey, lineCommandData))
llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed.");
break;
case "profileImage":
if(!script_profileImage(currentNPCSlot, currentNPCKey, lineCommandData))
llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed.");
break;
case "profileText":
if(!script_profileText(currentNPCSlot, currentNPCKey, lineCommandData))
llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed.");
break;
default:
llSay(0, "Unknown command '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed.");
}
@ -402,7 +460,7 @@ createNPCTempStorage()
npcKeys += [currentNPCKey];
}
osSetPrivateDataValue("tmpNPCList." + llGetKey(), llList2CSV(npcKeys));
osSetPrivateDataValue("tmpNPCList." + llGetKey(), llList2CSV(npcKeys));
}
removeOldNPC()