Right mouse down?

Vote
[poll type=regular results=on_vote chartType=bar]

  • Have option in the settings menu to toggle between right clicking for snap menus and for the project
  • Middle click in editor; right click in fullscreen
  • You cannot do the right click in the editor
    [/poll]

shouldn't it be possible with JavaScript?

Does somebody know, if there is a possibility to send messages via js?

probably, I don't know js so idk

I'm sure it's possible, but could you be more specific about what you want? Reimplement broadcast? Send to a specific sprite? Etc.

do untitled script pic via js

I don't know the syntax, but I am looking for something like broadcast("message");

use this.doBroadcast(message) or this.doSend(message, target).

untitled script pic-2
This is what I got, but it broadcast doesn't work.

The when block keeps calling the JavaScript function, which defines outputRightclick and adds an event listener (every time it's called), but that JavaScript function is not returning anything. When you right-click, all listeners evoke outputRightclick, which logs in the console and returns true, but to what? Nothing is really being returned to the when block. Did I get anything wrong?

Good grief. It would never have occurred to me to put a JS Function in a generic when block. This is why the bad-guy security teams should all be staffed with youths.

Why not? That's how all the builtin hat blocks work in scratch. You can use an on project start hat block (see /t/onprojectopen-event/2185) and run with an argument process

function outputRightclick() {
    console.log("rightclick");
    process.broadcast("rightclick");
}
addEventListener("contextmenu", outputRightclick, false); // I copied this from you code.

Well, of course all the other hat blocks have js behind them! I just think of JS Function as being for the body of a procedure, not for an event.

That's not what I mean. I mean that in scratch, all hat blocks are like a predicate in a generic when, so if you can use js in a predicate then you can in a hat.

I've seen it happen before

I know, it's perfectly sensible in retrospect (apart from making the hat block look weird) and I wouldn't have boggled at a JS Function in a FOREVER IF. I just would never have thought of it.

The reason I'd like right mouse down is to make a game where you can examine things or attack things, sort of like Minecraft.

Oh, yes, it'd clearly be useful; it just conflicts with the way we use right-click in the user interface. Maybe we should consider something with middle-click.

Left click or what?

PS. I believe this is related to this topic so I am posting it here.

Left click already does something user-visible; it triggers WHEN I AM CLICKED scripts. The question is whether there's a way to make right-click user-visible in the same way. But right click is already taken, for the sprite's context menu. So I suggested trying to use middle click as the second user-visible event.

(Those of us with serious mice have at least five buttons...)

1 Like