Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

The new D&D 2024 sheet is now available!

Create a free account

[Script Help] New to scripting, need help on one started

This is what I have so far: 2 Scripts The first announces in chat that the API is restarting: on("ready", function() { let ClockArtSrc = "<a href="https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif" rel="nofollow">https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif</a>"; let BGColorStart = "#f00"; let ClockArtStyle = `float: left; height: 40px; padding: 1px`; let OuterStyleStart = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; let InnerStyleStart = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColorStart}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; log(`API Wakeup Begun...`); sendChat("", `/desc &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;&lt;img src=${ClockArtSrc} style='${ClockArtStyle}'&gt;API (Re)Start Initiated...&lt;br&gt;Please Standby...&lt;/div&gt;&lt;/div&gt;`); }); The second announces that it is completed: on("ready", function() { let RocketArtSrc = "<a href="https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif" rel="nofollow">https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif</a>" let BGColor = "#0f0"; let RocketArtStyle = `float: right; height: 35px; padding: 1px`; let OuterStyle = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; let InnerStyle = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColor}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, 2500); }); So these are the things I'd like to accomplish: Merge the two scripts into one file For the Startup function, have this script be the absolute first API that fires - before all others in the Sandbox (so it can announce to players and console first and foremost) For the End function, have a variable at the top that the GMs can control depending on the load time of their Sandbox, in the form of seconds rather than milliseconds (easy enough to adjust for with multiplication of their settings variable * 100)
1604038049
GiGs
Pro
Sheet Author
API Scripter
As far as I'm aware the only way to have a script run first, is to make sure it is the first script installed. When the sandbox starts up, roll20 collects all the installed scripts and builds a single file containing them, in the order they are listed in the API scripts page (which is the order of installation).
I've seen scripts behave differently than that though, albeit much later.&nbsp; I think it had to do with size of the file.&nbsp; For example, the shaped companion script loads last for me, though it was the first thing I loaded into the scripts page.
1604065771
GiGs
Pro
Sheet Author
API Scripter
The order in which messages from the script get logged dont necessarily correlate with the order in which they are loaded. roll20 will start&nbsp; loading each script in the order they were installed, but different scripts might take longer to initialise then others, so it can appear that the order is different if you just go off the printed log messages. The on(ready) command that many scripts have is there because loading a script isn't instant. And multiple scripts can be loading at the same time, so one may start loading before another, and finish loading (reach "ready" state) last.
1604066293
The Aaron
Roll20 Production Team
API Scripter
Minor clarification: on('ready',...) is when all objects from the game have been given active representations in the API Sandbox, not when a given script is finished loading. When the API Sandbox starts up, it concatenates all Scripts as well as the Sheet Workers from the active Character Sheet into a single file and executes that file ONE TIME .&nbsp; During that execution, any script that wants to do something later must register for events for which it wants to act.&nbsp; Here's a conceptual order of operations: Concatenate and run all scripts Create objects Create event for Campaign Create event for first Page Create event for first Graphic on first Page ... Ready event fired &lt;other things like chat events, change events, destroy events, create events for new objects, etc...&gt; In the case of the Shaped script, since it loads optional data to define custom monsters and such, it delays it's ready execution with a setTimeout() call so that it can be sure all those other scripts with custom monster definitions and such have had a chance to run.&nbsp;
The Aaron said: Minor clarification: on('ready',...) is when all objects from the game have been given active representations in the API Sandbox, not when a given script is finished loading. When the API Sandbox starts up, it concatenates all Scripts as well as the Sheet Workers from the active Character Sheet into a single file and executes that file ONE TIME .&nbsp; During that execution, any script that wants to do something later must register for events for which it wants to act.&nbsp; Here's a conceptual order of operations: Concatenate and run all scripts Create objects Create event for Campaign Create event for first Page Create event for first Graphic on first Page ... Ready event fired &lt;other things like chat events, change events, destroy events, create events for new objects, etc...&gt; In the case of the Shaped script, since it loads optional data to define custom monsters and such, it delays it's ready execution with a setTimeout() call so that it can be sure all those other scripts with custom monster definitions and such have had a chance to run.&nbsp; Ahhhhh - ok - so then hrmmm ... I guess I know to load that in a new campaign at the beginning ...
Wolf Thunderspirit said: This is what I have so far: 2 Scripts The first announces in chat that the API is restarting: on("ready", function() { let ClockArtSrc = "<a href="https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif" rel="nofollow">https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif</a>"; let BGColorStart = "#f00"; let ClockArtStyle = `float: left; height: 40px; padding: 1px`; let OuterStyleStart = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; let InnerStyleStart = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColorStart}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; log(`API Wakeup Begun...`); sendChat("", `/desc &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;&lt;img src=${ClockArtSrc} style='${ClockArtStyle}'&gt;API (Re)Start Initiated...&lt;br&gt;Please Standby...&lt;/div&gt;&lt;/div&gt;`); }); The second announces that it is completed: on("ready", function() { let RocketArtSrc = "<a href="https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif" rel="nofollow">https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif</a>" let BGColor = "#0f0"; let RocketArtStyle = `float: right; height: 35px; padding: 1px`; let OuterStyle = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; let InnerStyle = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColor}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, 2500); }); So these are the things I'd like to accomplish: Merge the two scripts into one file For the Startup function, have this script be the absolute first API that fires - before all others in the Sandbox (so it can announce to players and console first and foremost) For the End function, have a variable at the top that the GMs can control depending on the load time of their Sandbox, in the form of seconds rather than milliseconds (easy enough to adjust for with multiplication of their settings variable * 100) Anyway - can anyone help me to accomplish the other tasks at hand?
1604073708
GiGs
Pro
Sheet Author
API Scripter
Whenever the sandbox spins up, it goes through that process anew, so you don't need to worry about that.
GiGs said: Whenever the sandbox spins up, it goes through that process anew, so you don't need to worry about that. Right.&nbsp; But you said that it loads the sandbox in order of installation.&nbsp; So I will, next time, load this script first to compensate for that issue.&nbsp; It's fairly easy, and now I know which scripts need loaded when...&nbsp; I never had a set order in my mind before now.
1604075372
The Aaron
Roll20 Production Team
API Scripter
You could combine them like this: const TWSScript = (()=&gt;{ const ClockArtSrc = "<a href="https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif" rel="nofollow">https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif</a>"; const RocketArtSrc = "<a href="https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif" rel="nofollow">https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif</a>" const BGColor = "#0f0"; const BGColorStart = "#f00"; const ClockArtStyle = `float: left; height: 40px; padding: 1px`; const RocketArtStyle = `float: right; height: 35px; padding: 1px`; const OuterStyleStart = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; const OuterStyle = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; const InnerStyleStart = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColorStart}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; const InnerStyle = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColor}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; log(`API Wakeup Begun...`); sendChat("", `/desc &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;&lt;img src=${ClockArtSrc} style='${ClockArtStyle}'&gt;API (Re)Start Initiated...&lt;br&gt;Please Standby...&lt;/div&gt;&lt;/div&gt;`); on("ready", function() { setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, 2500); }); })(); This won't matter if it's first or not (mostly), as it won't wait for ready to tell you things are starting up.
1604075809

Edited 1604076041
The Aaron said: You could combine them like this: const TWSScript = (()=&gt;{ const ClockArtSrc = "<a href="https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif" rel="nofollow">https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif</a>"; const RocketArtSrc = "<a href="https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif" rel="nofollow">https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif</a>" const BGColor = "#0f0"; const BGColorStart = "#f00"; const ClockArtStyle = `float: left; height: 40px; padding: 1px`; const RocketArtStyle = `float: right; height: 35px; padding: 1px`; const OuterStyleStart = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; const OuterStyle = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; const InnerStyleStart = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColorStart}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; const InnerStyle = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColor}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; log(`API Wakeup Begun...`); sendChat("", `/desc &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;&lt;img src=${ClockArtSrc} style='${ClockArtStyle}'&gt;API (Re)Start Initiated...&lt;br&gt;Please Standby...&lt;/div&gt;&lt;/div&gt;`); on("ready", function() { setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, 2500); }); })(); This won't matter if it's first or not (mostly), as it won't wait for ready to tell you things are starting up. What about adjusting the Timeout from a variable (currently 2500),&nbsp; is that a possibility?&nbsp; And tyvm Aaron - I will study this once it's done to try to piece it apart in my brainpan.&nbsp; Have a date tonight, so maybe tomorrow.&nbsp; W3C should be able to help with that.&nbsp; But for starters, what is the difference between var, let, and const?&nbsp; I'm guessing let and var can only be used within their function level and const can be used throughout the script by parent and child?
1604077084
The Aaron
Roll20 Production Team
API Scripter
var used to be the only way to define a variable in Javascript.&nbsp; It has two features that make it different than most procedural programming languages:&nbsp; 1) It is Function scoped, not block scoped (meaning it doesn't matter where you define a variable in a for loop {} or while loop {} or if {} or whatever, it is always defined at the level of the function's {}), and 2) the variables are hoisted (meaning that it doesn't matter if you declare the variables on the last line of a function, they exist from the start of the function, their declaration is "hoisted" to the top of the function scope.&nbsp; This causes numerous non-obvious errors, which is why: a) no other language I know of does that and b) they added let and const to allow var to die the death it richly deserves. let &nbsp;creates a block scoped variable which is read/write and exists from the point of declaration to the close of the current block, like every other procedural programming language of any repute.&nbsp; const &nbsp;is the same thing, but it's a read only variable.&nbsp; Generally, you can just use let everywhere and you'll be better off than using var.&nbsp; If you know you aren't going to change something in the program, declaring it as const allows the interpreter be more efficient with its usage.&nbsp; Note that a const variable does not imply the value stored can't change, merely that the variable in question cannot ever point to a different value.&nbsp; For example, a const variable containing an array can still have things inserted and removed from it, but that variable can never point to anything except that explicit array instance. As for timeouts, that's going to be a matter of taste, and frankly either doesn't matter, or can't matter, depending on your point of view.&nbsp; Javascript is asynchronous, and you can't know what other scripts are doing.&nbsp; For example, using a timeout of 0 would be sufficient to say that every script had received the call to the ready event handler (as Javascript is single threaded, a timeout of 0 assures you that your callback happens after the current callstack returns to the root, which means (barring a strange implementation of the event handler) that all the queued ready callbacks will get called before the callstack ends and the timeout events are handled).&nbsp; However, something like Search uses a bunch of asynchronous calls to parse and index every attribute, bio, handout, and gm notes field, and can take several minutes to finish loading all its indexes.&nbsp; 0 would not account for that time, and setting 240000 would seem excessive.
1604089563

Edited 1604089638
The Aaron said: var used to be the only way to define a variable in Javascript.&nbsp; It has two features that make it different than most procedural programming languages:&nbsp; 1) It is Function scoped, not block scoped (meaning it doesn't matter where you define a variable in a for loop {} or while loop {} or if {} or whatever, it is always defined at the level of the function's {}), and 2) the variables are hoisted (meaning that it doesn't matter if you declare the variables on the last line of a function, they exist from the start of the function, their declaration is "hoisted" to the top of the function scope.&nbsp; This causes numerous non-obvious errors, which is why: a) no other language I know of does that and b) they added let and const to allow var to die the death it richly deserves. let &nbsp;creates a block scoped variable which is read/write and exists from the point of declaration to the close of the current block, like every other procedural programming language of any repute.&nbsp; const &nbsp;is the same thing, but it's a read only variable.&nbsp; Generally, you can just use let everywhere and you'll be better off than using var.&nbsp; If you know you aren't going to change something in the program, declaring it as const allows the interpreter be more efficient with its usage.&nbsp; Note that a const variable does not imply the value stored can't change, merely that the variable in question cannot ever point to a different value.&nbsp; For example, a const variable containing an array can still have things inserted and removed from it, but that variable can never point to anything except that explicit array instance. As for timeouts, that's going to be a matter of taste, and frankly either doesn't matter, or can't matter, depending on your point of view.&nbsp; Javascript is asynchronous, and you can't know what other scripts are doing.&nbsp; For example, using a timeout of 0 would be sufficient to say that every script had received the call to the ready event handler (as Javascript is single threaded, a timeout of 0 assures you that your callback happens after the current callstack returns to the root, which means (barring a strange implementation of the event handler) that all the queued ready callbacks will get called before the callstack ends and the timeout events are handled).&nbsp; However, something like Search uses a bunch of asynchronous calls to parse and index every attribute, bio, handout, and gm notes field, and can take several minutes to finish loading all its indexes.&nbsp; 0 would not account for that time, and setting 240000 would seem excessive. Right, but what I wanted to know is if you could take a number of seconds (based on timing the console output on a watch), and put that number in a variable.&nbsp; Multiply it by 100 to get milliseconds, then use that as the final amount for timeout.&nbsp; Something to the effect of: const TimerSeconds = 25; // user defined variable&nbsp;&nbsp;&nbsp;&nbsp; const TimerMilliseconds = TimerSeconds * 100; //computed for format required on("ready", function() { setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, TimerMilliseconds); If I try to do it - I seem to get errors
1604089847

Edited 1604089908
The Aaron
Roll20 Production Team
API Scripter
Should be able to do that.&nbsp; It's 1000 millisecond to the second though, not 100. What errors do you get? Note: I'm assuming that's just a code snippet as it's missing the close on the function passed to on(), as well as the close of the on() call.
1604167969

Edited 1604171328
It said - if I remember - something about a missing ) at the end of an array or group Date went well - so I lost my train of thought here ... lmao
1604328568
The Aaron
Roll20 Production Team
API Scripter
For that, paste your full script.&nbsp; If you DID post the full script, then the issue is that you didn't close your function definition or invocation: const TimerSeconds = 25; // user defined variable const TimerMilliseconds = TimerSeconds * 100; //computed for format required on("ready", function() { setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, TimerMilliseconds); } ); But you also don't have a bunch of defined variables from further up...
1604374213

Edited 1604374270
const TWSScript = (()=&gt;{ //User Editable const TimerSeconds = 10; // How many seconds after the restart notice does it take to complete the sandbox load? &nbsp;&nbsp;&nbsp;&nbsp;const ClockArtSrc = "<a href="https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif" rel="nofollow">https://upload.wikimedia.org/wikipedia/commons/1/17/Clock-with-one-second-time-counter-animated.gif</a>"; // Clock Art const RocketArtSrc = "<a href="https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif" rel="nofollow">https://thumbs.gfycat.com/ScratchySpectacularDikkops-size_restricted.gif</a>" //Rocket Art // Do not Edit below this line &nbsp;&nbsp;&nbsp;&nbsp;const TimerMilliseconds = TimerSeconds * 1000; const BGColor = "#0f0"; const BGColorStart = "#f00"; const ClockArtStyle = `float: left; height: 40px; padding: 1px`; const RocketArtStyle = `float: right; height: 35px; padding: 1px`; const OuterStyleStart = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; const OuterStyle = `width: 100%; margin: 0px 0px 0px -7px; padding: 0px`; const InnerStyleStart = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColorStart}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; const InnerStyle = `line-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 7px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; color: #FFF; background-color: ${BGColor}; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;`; log(`API Wakeup Begun...`); sendChat("", `/desc &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;&lt;img src=${ClockArtSrc} style='${ClockArtStyle}'&gt;API (Re)Start Initiated...&lt;br&gt;Please Standby...&lt;/div&gt;&lt;/div&gt;`); on("ready", function() { setTimeout(() =&gt; { log(`API Wakeup completed... `); sendChat("", `/desc &lt;div style='${OuterStyle}'&gt;&lt;div style='${InnerStyle}'&gt;&lt;img src=${RocketArtSrc} style='${RocketArtStyle}'&gt;API (Re)Start Completed.&lt;br&gt;Thanks for your patience...&lt;/div&gt;&lt;/div&gt;`); }, TimerMilliseconds); }); })(); This actually worked ... when I went to check it before posting.&nbsp; No more errors.