Myst's Misc Script Repository

Anime Browser / Image Browser

/** @param {NS} ns */ /* This script is a simple image viewer for BitBurner. It uses a simple HTML Alert to show images on the real world internet. Author: Myst Leissa Date: 10/4/2024 License: Public Domain Notes: Images used are direct URLs for websites in the real world internet. No Copyright infridgement is intended nor capable because these are the same commands that websites use to pull up your image files on google. Image Data is not stored, only referenced; therefore no "copying" can take place. Because of the way Steam avoids proper HTML and uses mark down in CODE tags, i have had to remove certain syntax information in the steam article. */ export async function main(ns) { var script_name = ns.getScriptName() // Configures Script Name for Usage Dialog // Define the image url here because it might change later in the script. For Simplicities sake it's defined to a preset which is not listed. var image_url = "/"https://animesher.com/orig/1/109/1098/10985/animesher.com_long-hair-pink-dress-anime-girl-1098536.jpg/"" // First we'll handle if the direct URL is used for an image. This is the most risky route because if mistyped it can result in a crash of bitburner. if(ns.args[0]=="url") { image_url = args[1] // Needs to be a valid real life WEB URL for an ".jpg",".png", or ".gif" web URL. Cannot seem to access file://... } // Now Handle the "Presets" which are just shorthanded urls that have been assigned to dedicated args. if(ns.args[0]=="preset") { // ns.args[0] gets the first word run from the cmd line after the filename if(ns.args[1]=="baby.jpg") { // These are preset args, you can add or remove as many as you like, but without a help reference change they will not be easily accessible. image_url = "/"https://img.freepik.com/premium-photo/anime-girl-pink-dress_893012-216879.jpg/"" } if(ns.args[1]=="princess.jpg") { image_url = "/"https://static.vecteezy.com/system/resources/previews/008/382/242/non_2x/cute-anime-girl-in-dress-free-vector.jpg/"" } if(ns.args[1]=="teenager.jpg") { image_url = "/"https://image.cdn2.seaart.ai/static/2cb8152bc72e05e21fb032da65d137f4/20230529/ed28cd18ac14f771c353c739bcd83bd2.jpeg/"" } if(ns.args[1]=="chibi.jpg") { image_url = "/"https://img.freepik.com/premium-photo/anime-girl-pink-dress-with-bow-pink-dress-generative-ai_1028723-28133.jpg?w=360/"" } } // If ran with help arg it lets us know how to use it. if(ns.args[0]=="help") { await ns.alert("usage: "+script_name+" &lt help &gt / url &lt WEB_IMAGE_URL &gt / &lt preset baby.jpg ] / princess.jpg / teenager.jpg / chibi.jpg &gt") ns.exit() } ns.alert("<img src="+image_url+">") }

Real Time System Clock

** @param {NS} ns */ function time(ampm) { var d = new Date(); var s = d.getSeconds(); var m = d.getMinutes(); var h = d.getHours(); var designator = ""; if (ampm == "12") { if (h >= 13) { h = h - 12; designator = "PM"; } else { designator = "AM"; } return h.toString() + ":" + m.toString() + ":" + s.toString() + " " + designator; } } export async function main(ns) { var time_stamp; if (ns.args[0] == "24hr") { time_stamp = time("24") ns.alert(time_stamp) } else if (ns.args[0] == "12hr") { time_stamp = time("12") ns.alert(time_stamp) } else { var script_name = ns.getScriptName() ns.alert("Syntax: " + script_name + " &lt12hr/24hr&gt") } }

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=3343055788					

More Bitburner guilds