Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer controller_channel = -982742;
- string current_scene = "";
- // RGB
- list scenes;
- load_scene(string name)
- {
- integer scene_index = llListFindList(scenes, [name]);
- if (scene_index == -1) return; // No such scene.
- list settings_point_light = llList2List(scenes, scene_index + 1, scene_index + 6);
- llSay(0, "settings_point_light" + llList2CSV(settings_point_light));
- list settings_glow = llList2List(scenes, scene_index + 7, scene_index + 7);
- llSay(0, "settings_glow: " + llList2CSV(settings_glow));
- list settings_fullbright = llList2List(scenes, scene_index + 8, scene_index + 8);
- llSay(0, "settings_fullbright: " + llList2CSV(settings_fullbright));
- llSetLinkPrimitiveParams(LINK_THIS, [PRIM_POINT_LIGHT] + settings_point_light + [ PRIM_GLOW, ALL_SIDES ] + settings_glow + [ PRIM_FULLBRIGHT, ALL_SIDES] + settings_fullbright);
- current_scene = name;
- }
- save_scene(string name)
- {
- // Check if the list already contains scene.
- integer scene_index = llListFindList(scenes, [name]);
- if (scene_index != -1)
- {
- // The scene already exists. Remove the existing.
- // PRIM_POINT_LIGHT has 5 properties, PRIM_GLOW has one, as does prim_fullbright, a total of 7 properties
- scenes = llDeleteSubList(scenes, scene_index, scene_index + 8);
- }
- // Get the current lighting setup
- list settings = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_POINT_LIGHT,PRIM_GLOW, ALL_SIDES,PRIM_FULLBRIGHT, ALL_SIDES]);
- scenes += [name] + settings;
- llSay(0, "save scene '" + name + "' w/ settings " + llList2CSV(settings));
- }
- default
- {
- state_entry()
- {
- llListen(controller_channel, "", NULL_KEY, "");
- }
- listen(integer channel, string name, key id, string message)
- {
- if (llGetOwnerKey(id) != llGetOwner()) return; // someone else's
- list params = llCSV2List(message);
- string cmd = llList2String(params, 0);
- string scene_name = llList2String(params, 1);
- if (cmd == "save_scene")
- {
- save_scene(scene_name);
- }
- if (cmd == "load_scene")
- {
- load_scene(scene_name);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement