The following build is an animated reading book with multiple textures that can be changed from the menu. The script borrows from the huggable toys script in order to animate the holding of the book. Additionally, a texture changer script changes the texture such that the book being read will be different.
Here are the various assets used to build this item.
Spells = fea45bef-a44e-5ade-7a1d-d25ec53a544d Monsters = d0bba203-eff4-f7fd-a1e1-43f45d838844 Ledger = 7a8d10c6-e459-8f45-d58f-81c6540764a5 Names = bb6a350a-c249-992d-d997-2a5aad292081 Blank = 4d30c989-d902-32a2-9e5f-b96967ef3a48
/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2021 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// integer wasMenuIndex = 0; list wasDialogMenu(list input, list actions, string direction) { integer cut = 11-wasListCountExclude(actions, [""]); if(direction == ">" && (wasMenuIndex+1)*cut+wasMenuIndex+1 < llGetListLength(input)) { ++wasMenuIndex; jump slice; } if(direction == "<" && wasMenuIndex-1 >= 0) { --wasMenuIndex; jump slice; } @slice; integer multiple = wasMenuIndex*cut; input = llList2List(input, multiple+wasMenuIndex, multiple+cut+wasMenuIndex); input = wasListMerge(input, actions, ""); return input; } /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// integer wasListCountExclude(list input, list exclude) { if(llGetListLength(input) == 0) return 0; if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); } /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// list wasListMerge(list l, list m, string merge) { if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; string a = llList2String(m, 0); if(a != merge) return [ a ] + wasListMerge(l, llDeleteSubList(m, 0, 0), merge); return [ llList2String(l, 0) ] + wasListMerge(llDeleteSubList(l, 0, 0), llDeleteSubList(m, 0, 0), merge); } integer line = 0; integer chan = 0; integer listenId = 0; list names = []; list value = []; default { state_entry() { if(llGetInventoryType(llGetInventoryName(INVENTORY_NOTECARD, 0)) != INVENTORY_NOTECARD) { llSay(DEBUG_CHANNEL, "Sorry, could not find a configuration notecard inside the object."); return; } llGetNotecardLine( llGetInventoryName( INVENTORY_NOTECARD, 0 ), line ); } dataserver(key id, string data) { if(data == EOF) state select; // invariant, length(tuples) % 2 == 0 // Skip empty lines. if(data == "") { llGetNotecardLine( llGetInventoryName( INVENTORY_NOTECARD, 0 ), ++line ); return; } integer i = llSubStringIndex(data, "#"); if(i != -1) data = llDeleteSubString(data, i, -1); list o = llParseString2List(data, ["="], []); // get rid of starting and ending quotes string k = llDumpList2String( llParseString2List( llStringTrim( llList2String( o, 0 ), STRING_TRIM), ["\""], [] ), "\""); string v = llDumpList2String( llParseString2List( llStringTrim( llList2String( o, 1 ), STRING_TRIM), ["\""], [] ), "\""); if(k == "" || v == "") { llGetNotecardLine( llGetInventoryName( INVENTORY_NOTECARD, 0 ), ++line ); return; } names += k; value += v; llGetNotecardLine( llGetInventoryName( INVENTORY_NOTECARD, 0 ), ++line ); } changed(integer change) { llResetScript(); } on_rez(integer num) { llResetScript(); } } state select { state_entry() { chan = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; } touch_start(integer num) { // Lock to owner. if(llDetectedKey(0) != llGetOwner()) { return; } listenId = llListen( chan, "", llGetOwner(), ""); llDialog( llGetOwner(), "Please choose: ", wasDialogMenu(names, ["⟵ Back", "", "Next ⟶"], ""), chan ); } listen(integer channel, string name, key id, string message) { if(message == "⟵ Back") { llDialog( id, "Please browse the available items:\n", wasDialogMenu(names, ["⟵ Back", "", "Next ⟶"], "<"), chan ); return; } if(message == "Next ⟶") { llDialog(id, "Please browse the available items:\n", wasDialogMenu(names, ["⟵ Back", "", "Next ⟶"], ">"), chan ); return; } integer i = llListFindList( names, [ message ] ); key texture = llList2Key(value, i); // If the item is misconfigured just restart to hopefully pick up the changes. if(texture == NULL_KEY) { llSay(DEBUG_CHANNEL, "Script misconfigured, resetting."); llResetScript(); } llSetTexture(texture, ALL_SIDES); llListenRemove(listenId); } changed(integer change) { llResetScript(); } on_rez(integer num) { llResetScript(); } }