scratch extended

adds new functionality to scratch.mit.edu

作者
rssa_romeo
今日安裝
0
安裝總數
59
評價
0 0 0
版本
0.18
建立日期
2023-09-30
更新日期
2024-03-16
授權條款
GPLv3
腳本執行於

if this breaks any projects, or has an error while running you can post a comment about it on my profile, if you do make sure to include the project link, and a description of how to cause the bug so i know what to to find to try and fix it.

to use get a > block and in the left side type the name of the function then in the right side put the inputs - an input is anything surrounded by " or ' or `.
if you want to use a multiline input create a comment on the > block and the inputs will be took from the comment instead of the right side.
you can use ${varname} to access the value of varname in a function without using join blocks

some kinda showcase: https://scratch.mit.edu/projects/876836844/editor

functions:
clip(data) - if [data] then set clipboard to [data] else return data from clipboard
open(a, s, d, e) - opens a window just like javascript does
popup(text, x, y, w, h, isPercent) - creates a popup window and writes text to the window if text is set
eval(data) - eval
alert(data) - js alert
prompt(a, s) - prompt [a] prefill [s]
confirm(a) - js confirm
save(key, data) - writes to localstorage can't interfere with other projects
load(key) - reads from localstorage can't interfere with other projects
clearsave(a) - clears key of [a] from localstorage can't interfear with other projects. if [a] is not set clear all from localstorage
fetch(a, s) - fetch and return response as text
pointerlock(a) - ennable of dissable pointerlock
cursor(a) - changes cursor
escape() - escapes all data instead of parsing it into inputs
replace(a, s, d, regex) - replace [s] with [d] in [a] if regex is true treats [s] as regex
substr(a = "", s = "", d = "") - chars [s] to [d] of [a]
press(key) - presses [key]
unpress(key) - releases [key]
pressed(keys = "", any = "") = returns true if [keys] are all pressed unless [any] then returns true if any in [keys] are pressed
getkeys(key, list) - if [list] and not [key] sets [list] to all pressed keys else returns true if key [key] is pressed
getmouse(button) - if [button] returns true if [button] on mouse is pressed else returns all mouse buttons and if they are pressed
fullscreen(on) - if [on] not set returns if in fullscreen or not else sets fullscreen to [on]
clearlogs() - clears the log lists
doesitexist(func) - returns true if [func] exists in the program
requestperms(...data) - requests permission to all the functions in [data]
indexof(x, y) - index of [y] in [x]
matches(x = "", y = "") - does [x] match the regex [y]
lowercase(data = "") - returns [data] to lowercase
uppercase(data = "") - returns [data] to uppercase
places(num, places = 3) - rounds [num] to have [places] places after the . then adds 0s to the end if nessary
turbo(on) - if [on] not set returns if in turbomode or not else sets turbomode to [on]
savefile(data = "", name = "temp.txt") - saves a file to the computer with name of [name] and content of [data]
readfile(accept, readas = "text") - ask for file of type [accept] then reads it as [readas]
split(z, split, list, spritename) - splits [z] by [split] then if [list] sets the list [list] to the output else returns the output as a string of a list
join(list, join) - returns a string of [list] - either the name of a list or a string of a list, joined by [join]
var(varname, value, sprite) - if [value] sets var [varname] to [value] else returns value of [varname]. if [sprite] acts on a var with that name local to that sprite else acts on global var
list(list, data) - same as var above but with list instead
fromms(ms = 0)
toms(ms = 0, secs = 0, mins = 0, hours = 0, days = 0, years = 0)
keeponlyone(arr) - makes all the values in [arr] unique
json(json, value = "") - returns the [value] from [json]
filter(arr, filter) - filters [arr] according to [filter] - requires eval
map(arr, map) - maps [arr] according to [map] - requires eval
power(x, y) - returns [x] to the power of [y]
createvar(varname, sprite) - creates var [varname] if [sprite] var is local to that sprite
deletevar(varname, sprite) - same as above but deletes instead of creating
createlist(list, sprite) - same as above
deletelist(list, sprite) - same as above
getallvars()
math(func, ...num) - runs Math[func] with [num] as inputs
showvar(varname, sprite) - shows var [varname]
showlist(list, sprite) - same as above
hidevar(varname, sprite) - same as above
hidelist(list, sprite) - same as above
console(type, ...data) - runs console[type] with [data] as inputs
distance(x1, y1, x2, y2) - gets distance from [x1, y1] to [x2, y2] if not [x2] [x2, y2] are sprite position
pointto(x, y) - points to [x] [y]
onmessage(message) - waits for a broadcast of [message] - [message] can be regex
colorat(x, y, a)
arrdistance(arr1, arr2)
clickat(x, y, time)
nextanswer(answer)
jsonkeys(json, list, sprite) - gets all keys in [json]
jsonvalues(json, list, sprite) same as above
compress(data, value)
decompress(data)
pausetimer() - pauses the scratch timer
resumetimer() - resumes the scratch timer
tempvar(name, value) - creates a var that only exists for that thread
testfunction(...a) - runs window.test