The error is at the missing semicolon (;) at the end of the first line. And also additional comma for one element only. You should put semicolon and also remove the comma
Code: Select all
wallpapers = newList("Dans la lune",)
random_wallpaper = getRandomElement(wallpapers)
Helios just give you example, so semicolon is missing from the script. The proper one should be
Code: Select all
wallpapers = newList("Dans la lune");
random_wallpaper = getRandomElement(wallpapers);
Make it as a habit to always end the line with semicolon (unless for certain if() else situation). And because you have 15, it will better to separate each wallpaper into new line for better view/reading. For example
Code: Select all
wallpapers = newList(
"Wallpaper1",
"Wallpaper2",
"Wallpaper3",
"Wallpaper4",
"Wallpaper5");
random_wallpaper = getRandomElement(wallpapers);
The random method you get here is truly random. In 15 execution, it is possible that some wallpaper haven't been appear once and there are some appear twice. If you need random, but each wallpaper must appear once in every 15 execution; then you should create the list in glovar, example global_wallpapers. Then store the execution count in another glovar. If executed 15 times, shuffle it and reset the count to 0.
To create the glovar, you can add it manually and use list type. Or you can just type in script for one time creation.
Code: Select all
global_wallpapers = newList(
"Wallpaper1",
"Wallpaper2",
"Wallpaper3",
"Wallpaper4",
"Wallpaper5");
global_wallpapers_count = 0;
Execute this once, it will create your glovar and count. Then delete the script and use this script for the loop.
Code: Select all
random_wallpaper = global_wallpapers[global_wallpapers_count];
global_wallpapers_count = global_wallpapers_count + 1;
if(global_wallpapers_count == 15)
{
shuffleList(global_wallpapers);
global_wallpapers_count = 0;
}
First we get the random wallpaper from the shuffled glovar (first 15 execution is not shuffled yet) based on the current count. Increment the count, so next time it gets the next wallpaper. Check if the count is 15 already (already execute 15 times). If yes, shuffle it again and set the count to 0, so it restart to retrieve from the first random element.
In total, you need only one trigger, one script and one set live wallpaper (and 2 glovar). Much more efficient flow
About the trigger, it seems you use some other plugin to do it. If your trigger is notification on statusbar, Automagic already have that trigger, try to find it in the trigger list.