My first real Snap! mod! SnapStuff+ 1.0.1 Dev

Starting off as an unfinished Snap! library, SnapStuff+ is a Snap! mod that adds various blocks, a few help menus for said blocks, remade help menus for regular blocks, and the glitchy option to switch between white and dark flat design (dark default).

Here's what blocks SnapStuff+ adds (subject to change):

A very glitchy [scratchblocks]glide (1) secs to [random position v][/scratchblocks]

[scratchblocks]<right mouse down?::sensing>[/scratchblocks] detects if right clicked (includes help menu)

[scratchblocks]<system theme?::sensing>[/scratchblocks] returns if dark mode is on through true/false (includes help menu)

[scratchblocks]<is [javascript v] on?::sensing[/scratchblocks] added an option to %setting and the is _ on block that reports if javascript extensions are on. (this does not include the set block even though the setting is there).


Use it here! Snap! Build Your Own Blocks

Please keep in mind that this is the first, beta version of SnapStuff+, please expect glitches. This is not entirely bug checked.

Hi yall. I see that 8 people have checked my mod out, but I would really appreciate some feedback!

seems cool, ill check out later today.

image
>:(
it's blocked on my chromebook, i'll check it out when i get home

did you check it out?

that's your schools fault, not my own

ik, i was mad at my school not you

Just letting you know, I actually found out that vercel isn't blocked on my school wifi, so you could provide a mirror to a vercel page.

If you don't know, vercel is free, and allows you to customize the url (well, if it ends with .vercel.app). In my experience, it also publishes the website faster than github pages (you can have both github pages and vercel).

I did, it seems pretty cool!

I was a little bit confused by the behavior of the random position option in glide # secs to __. I thought it would, over the course of one second, glide to a single random position, but it goes to a bunch of random positions. Is this intended behavior?

no, i can't figure out how to fix it no matter how many times i change the code, im thinking of making it developer mode only next release

thanks!

Got it, I was thinking of doing that yesterday but I didn't have enough time

oh

heres the BETA, unpolished code to doGlideTo if you or anyone else wants to try and fix it

Process.prototype.doGlideTo = function (secs, name,) {
    var endX, endY;
    
    var thisObj = this.blockReceiver(),
    thatObj,
    stage;

    endX = this.reportBasicRandom(-235, 235);
    endY = this.reportBasicRandom(180, -180);

    if (thisObj) {
        if (this.inputOption(name) === 'center') {
            this.doGlide(secs, 0, 0);
        } else if (this.inputOption(name) === 'mouse-pointer') {
            this.doGlide(secs, this.reportMouseX(), this.reportMouseY());

        } else if (this.inputOption(name) === 'random position') {
	        this.doGlide(secs, endX, endY);
            return null;  	
        }
    }
};

One thing you should change is, make the random functions use the stage size rather than set values.

Do you know how to retrieve the stage size?

i made a
[scratchblocks]
when I am right-clicked::control hat
[/scratchblocks]

block


(that untitled script pic (1) block is a custom block, it basically reports true once its input becomes true but then reports false until it becomes false then true again)

The script version is dead simple.

untitled script pic - 2023-10-27T224729.186

compared to the primitive

Process.prototype.doGlideTo = function(secs, name){
    var thisObj = this.blockReceiver(),
        stage;
    //first invocation
    if (!this.context.startTime) { //first invocation
        this.context.startTime = performance.now();
        this.context.startValue = new Point(
            this.blockReceiver().xPosition(),
            this.blockReceiver().yPosition()
        );
        if (this.inputOption(name) === 'center') {
            this.context.endValue = new Point(0, 0);
        } else if (this.inputOption(name) === 'mouse-pointer') {
            this.context.endValue = new Point(
                        this.reportMouseX(),
                        this.reportMouseY()
            );
        } else if (this.inputOption(name) === 'random position') {
            stage = thisObj.parentThatIsA(StageMorph);
            if (stage) {
                this.context.endValue = new Point(
                    stage.width() * this.reportBasicRandom(-0.5, 0.5),
                    stage.height() * this.reportBasicRandom(-0.5, 0.5)
                );
            }
        }
    }
    //ending condition         
    if ((performance.now() - this.context.startTime) >= (secs * 1000)){
        this.blockReceiver().gotoXY( 
               this.context.endValue.x,
               this.context.endValue.y
        );
        return null;
    }
    //step
    this.blockReceiver().glide(
        secs * 1000,
        this.context.endValue.x,
        this.context.endValue.y,
        performance.now() - this.context.startTime,
        this.context.startValue
    );
    //repeat
    this.pushContext('doYield');
    this.pushContext();
}

omg tysm

thanks, i can probably remake this in threads.js, i just need to figure out how to make hats
update: I added it to the default "when I am %interaction" hat, will be added to the next release which will probably be tomorrow

it works :slight_smile:

you should also add the once block

i don't really get it's purpose though?