Skip to content

Instantly share code, notes, and snippets.

@Sei-Lisa
Created October 8, 2017 11:32
Show Gist options
  • Save Sei-Lisa/2250e59040a4d10c4b28998ac045fb7d to your computer and use it in GitHub Desktop.
Save Sei-Lisa/2250e59040a4d10c4b28998ac045fb7d to your computer and use it in GitHub Desktop.
Data memory usage - Reusing list elements takes only 4 bytes per element.
list facial_anim_list =
[ "express_afraid_emote"
, "express_anger_emote"
, "express_laugh_emote"
, "express_bored_emote"
, "express_cry_emote"
, "express_embarrassed_emote"
, "express_sad_emote"
, "express_toothsmile"
, "express_smile"
, "express_surprise_emote"
, "express_worry_emote"
, "express_repulsed_emote"
, "express_shrug_emote"
, "express_wink_emote"
, "express_disdain"
, "express_frown"
, "express_kiss"
, "express_open_mouth"
, "express_tongue_out"
];
list L;
default
{
touch_start(integer n)
{
llOwnerSay("L[9999]=" + llList2String(L, 9999));
llOwnerSay((string)llGetUsedMemory());
L = [];
integer i;
integer len = llGetListLength(facial_anim_list);
for (; i < 10000; ++i)
{
integer rnd = (integer)llFrand(len);
L += llList2List(facial_anim_list, rnd, rnd);
}
llOwnerSay("Ready for next touch");
}
}
// On first touch:
// [04:21:40] Object: L[9999]=
// [04:21:40] Object: 6572
// [04:23:42] Object: Ready for next touch
// On subsequent touches:
// [04:23:42] Object: L[9999]=express_open_mouth
// [04:23:42] Object: 46636
// [04:25:45] Object: Ready for next touch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment