Is there a way to make the displayed variables faster? I made a solution for it, but its not really neat.
Currently, the only way to do that is to use say []
. More info here: Tweak the Variable Monitors
a topic was very recently made for this. also literally why use call 2.0?
they think having the option to add inputs is too much freedom
thats not a reason though...
what i said was meant to be a joke anyway, the 'reason' i gave was supposed to be stupid..
oh.
Honestly I think they just wanted a call block that didn't take any inputs (just calls the script). Not to mention, your reason is a reason (just not a very good one).
or write (variable) size (12)
or use costume from text (variable) size (72) :: looks reporter
in the text costumes library
it didn't work with the original
it... it did.
this requires javascript but should do exactly what you had in mind
considering how easy it was i'm guessing it was intended to be made an option at some point
I think it's more like, it's bad practice to use magic numbers, put numbers in variables instead. You can see this happen all over the place in the block/symbol rendering code.
this doesn't seem to impact performance, at all
also its cursed seeing it constantly update in snap
okay, wtf does my [stage V]
report?? I've been at this an hour trying to turn this into js for a user script and I cant figure it out. StageMorph.prototype.watcherUpdateFrequency
doesn't exist, but it does exist in StageMorph.prototype.init()
, but running this doesn't reset the watcherUpdateFrequency??
StageMorph is the class, the stage is an instance of the class. by running init all you're doing is throwing stage properties onto this
which is probably just littering variables all over the global scope.
getting the stage requires either starting from the sprite and working up (what the snap block does) or going into world for it (which i didn't bother looking for a way to do)
it does impact performance slightly (imo probably a little more than it should) but if anything it's actually significantly better for it to update constantly. the current behaviour means a lag spike every half second while constant updating means it's the same impact every frame.
Tbh I think this should be customizable with the default being 2
ty
I have created a script that adds an option above "Microphone Quality" to change the watcher update frequency.
Script
if (!localStorage.getItem("watcherUpdateFrequency") === Number) {
localStorage.setItem("watcherUpdateFrequency", 2);
}
world.children[0].stage.watcherUpdateFrequency = localStorage.getItem("watcherUpdateFrequency");
let wuf = world.children[0].stage.watcherUpdateFrequency
IDE_Morph.prototype.changeWatcherFrequency = function () {
var dialog = new DialogBoxMorph().withKey('notes'),
frame = new ScrollFrameMorph(),
text = new TextMorph(wuf),
size = 250,
world = this.world();
frame.padding = 6;
frame.setWidth(size);
frame.acceptsDrops = true;
frame.contents.acceptsDrops = true;
text.setPosition(frame.topLeft().add(frame.padding));
text.enableSelecting();
text.isEditable = true;
frame.setHeight(25);
frame.fixLayout = nop;
frame.edge = InputFieldMorph.prototype.edge;
frame.fontSize = InputFieldMorph.prototype.fontSize;
frame.typeInPadding = InputFieldMorph.prototype.typeInPadding;
frame.contrast = InputFieldMorph.prototype.contrast;
frame.render = InputFieldMorph.prototype.render;
frame.drawRectBorder = InputFieldMorph.prototype.drawRectBorder;
frame.addContents(text);
dialog.getInput = () => text.text;
dialog.target = this;
dialog.action = (note) => {
world.children[0].stage.watcherUpdateFrequency=note;
wuf = world.children[0].stage.watcherUpdateFrequency
localStorage.setItem("watcherUpdateFrequency", wuf);
};
dialog.justDropped = () => text.edit();
dialog.labelString = 'Variable Watcher Frequency';
dialog.createLabel();
dialog.addBody(frame);
dialog.addButton('ok', 'OK');
dialog.addButton('cancel', 'Cancel');
dialog.fixLayout();
dialog.popUp(world);
dialog.setCenter(world.center());
text.edit();
};
var split = IDE_Morph.prototype.settingsMenu.toString().split("menu.addItem(\n 'Microphone resolution...',\n 'microphoneMenu'\n );");
split.splice(1, 0, "menu.addItem('Watcher Update Frequency', 'changeWatcherFrequency');\nmenu.addItem(\n 'Microphone resolution...',\n 'microphoneMenu'\n );\n ").join('');
var newFun = split.join('');
const dark_mode = new Function('IDE_Morph.prototype.settingsMenu = ' + newFun);
dark_mode();
I reverse engineered part of @ego-lay_atman-bay's old flat dark mode script
The input is multiline despite it's small height. I cannot figure out how to change this. Do with this script as you will.
And booleans also never equal functions (which is important because they're comparing !localStorage.getItem("watcherUpdateFrequency")
to the Number
class/function itself; it's not checking whether it's a number or not.)
I think the correct way code would be if (isNaN("watcherUpdateFrequency"))
. The isNaN
function returns false if a value can be interpreted as a non-NaN number. This includes strings; isNaN("1")
is true, since "1"
can be casted into 1
. That's important because localStorage only stores strings, not numbers; all local storage reads will return strings (or null).