Changes

Jump to navigation Jump to search
no edit summary
[[Category: Useful Scripts]]
[[Category: Scripted Tools]]
[[Category: Opensim Script Library]]
 
== AV-Sitter2 to PMAC conversion script – Introduction ==
The Covey AV-Sitter2 to PMAC conversion script reads AV-Sitter position cards and converts them to PMAC menus. AV-Sitter uses 2 scripts per avatar and another for setting up pose positions. PMAC, written Aine Caoimhe is a single script. AV-Sitter has a few features PMAC does not support and can be used in Second Life.
==== Licence ====
<syntaxhighlight lang="ini" line>
BSD 3-Clause License
Copyright (c) 2020, Sara Payne
//if you use the debug option it's suggested you comment them out section by sec
ConvertRotationsConvertRotationsAndFixOffset()
{ //AvSitter uses x,y,z rotations, PMAC uses quaternion rotations, so convert them.
list tempList = [];
integer braceIndex = llSubStringIndex(noTimes, "}");
string fixedRotation;
string fixedOffset;
if (braceIndex != -1)
{ //only deal with lines wich contain a } (pos/rot line)
fixedRotation = ConvertLineToRotationsConvertLineToRotationsAndFixOffset(noTimes); //convert this line to real rotations
}
else
WriteNotecard("FixedRotations", tempList);
}
 
WriteNotecard(string name, list contents)
{ //writes a notecard with the supplied name and contents
/* /The conversion script relies on the contents of notecards, Ensure the notecards are deleted and saved before continuing. */
integer inventoryType;
if (llGetInventoryType(name) == INVENTORY_NOTECARD)
}
}
 
DebugOwnerSayListContents(string name, list toDisplay)
{ //outputs the contents of a list nicely to local chat for the owner.
}
}
 
list ReverseListOrder(list inputList)
{ //reverses the order of a list.
return reverseList;
}
 string ConvertLineToRotations ConvertLineToRotationsAndFixOffset (string inputString)
{ //takes in the AVpos format and outputs PMAC format
string name = "{"+ NameFromPositionsLine(inputString) + "}";
vector posVec = (vector)PosFromPositionsLine(inputString);
vector rotVec = (vector)RotFromPositionsLine (inputString);
vector fixedOffset = posVec - <0,0,0.3>;
rotation rotRot = llEuler2Rot(rotVec * DEG_TO_RAD); //the actual conversion
string fixedString = name + (string)posVec fixedOffset + (string)rotRot;
return fixedString;
}
 
list GetSpecificNotecardCards (string searchString)
{ //uses a partial name string to return all matching notecards from the items inventory
return sitterNotecards;
}
 
string MenuNameFromMenuLine(string inputString)
{
return menuName;
}
 
string NameFromPositionsLine(string inputString)
{
return nValue;
}
 
string PosFromPositionsLine(string inputString)
{
return vValue;
}
 
string RotFromPositionsLine (string inputString)
{
return rotValue;
}
 
string RemoveTimes(string inputString)
{
return trimed;
}
 
string GetPoseName (string inputString)
{
return lValue;
}
 
string GetAnimName (string inputString)
{
return lValue;
}
 
string GetSitterNumberFromMenuCardName(string menuCardName)
{
return sitterNumber;
}
 
string GetMenuNameFromMenuCardName(string menuCardName)
{
return name;
}
 
string GetButtonNameFromPmacLine(string inputString)
{
return name;
}
 
SplitIntoSitters()
{ //splits the AVpos card down into individual sitters
WriteNotecard("Sitter" + (string)sitterCount, tempSitterList);
}
 
list GetSitterSyncsAndMenus(string notecardName)
{ //loops through the named notecard looking for lines which start with SYNC, MENU or { (pos/rot lines)
return sitterSyncsAndMenus;
}
 
list GetSitterPOSEs(string notecardName)
{ //loop through the supplied notecard name saving just pose names and related pos/rot lines
return sitterPoses;
}
 
FixAndCombineSinglePoses()
{ //makes new notecards with the sync and poses seperated
CreateNewSyncSetFromPoses();
}
 
SeperatePoseNamesAndData()
{ //loops through every sitter card making new serpate cards for poses (not syncs) and their related pos/rot
}
}
 
GeneratePoseToSyncCards(list poseCards, list newSyncNames)
{ //loops through all pose cards line by line, looking for names with the same button names
}
}
 
CreateNewSyncSetFromPoses()
{ //loops though every pose card and attempts to find pairs which should be used together.
CombinePoseToSyncCardsWithSiterCards();
}
 
CombinePoseToSyncCardsWithSiterCards()
{ //takes the new sync cards (made from pair poses) and combines
}
}
 
list AllLinesWithOrWithoutBraces(string cardName, integer with)
{ //loops through the given notecard name, if the "with" integer is TRUE
return newList;
}
 
GenerateNewSinglesCard(list newSyncNames)
{ //loops through all poses in all the sitter cards, checks to see if they have matching
WriteNotecard(".menu001A Singles", newSinglesMenu);
}
 
RemovePosesAndPoseDataFromSitters()
{
}
}
 
list SitterWithNoEmptyMenus (string cardName)
{ //loop through the card name provided, create a new list which contains
return newList;
}
 
RemoveEmptyMenusFromSitterCards()
{ //removes all the menu structure, preseving just the ones which directly deliver animation buttons
}
}
 
RemoveTempCards()
{ //loops though the inventory removing any temp notecards created during the conversion
}
}
 
list GetMenuLinePositions(string sitterCard)
{ //loops through the sitter card, making list of all line positions containing MENU lines
return menuLinePositions;
}
 
GenerateMenuCardsForSyncs()
{ //goes through each sitter card making invidiual menu notecards for every sitter
}
}
 
string FindMatchingDataLine(string buttonName, string sitterNumber)
{ //loops through the Sitter card for the sitter number provided
return dataLine;
}
 
GenerateDataCardsForSyncs()
{ //loops through all the temp menu cards, for each one it loops through every
}
}
 
list GetCombinedSitter0MenuData(string menuCardName, string dataCardName)
{ //takes the supplied names, retrieves the data from both and combines it line by line.
return combinedMenuDataCard;
}
 
CombineSitter0MenuAndDataCards()
{ //gets a list of all Menu cards and all Data cards then passes them in
}
}
 
list GetRelatedMenuSitterCards(string menuName)
{ //finds all temp menu cards related to the supplied name and returns the list
return relatedMenuCards;
}
 
string GetAnimNameFromRelatedMenuCard(string relatedMenuCardName, string buttonName)
{ //All card entries can be out of order, so search through every line until a match is found and return the information.
return animName;
}
 
string GetPosRotFromRelatedDataCard(string relatedDataCardName, string buttonName)
{ //All card entries can be out of order, so search through every line until a match is found and return the information.
WriteNotecard(pmacMenuCardName, pmcaMenuCard);
}
 
CombineMenuAndDataCards()
{ //loop through each of the MenuData cards, find the related cards and pass them one by one to the
}
}
 
default
{
{
llOwnerSay("Conversion Started");
ConvertRotationsConvertRotationsAndFixOffset();
SplitIntoSitters();
llOwnerSay("Sorting singles poses");
}
</syntaxhighlight>
 
==Syntax Highlighting==
 
[https://www.mediawiki.org/wiki/Extension:SyntaxHighlight GeShi] syntax highlighting is enabled on this wiki. <be>
 
When using the tabs described in the link, change the language part to "lsl". Eg.<br>
syntaxhighlight lang="lsl" line<br>
inside angled brackets <>

Navigation menu