2 months ago

(Please ignore this) I have managed to get a hold of the Gamejolt API for Scratch thanks to @\\NerdBear_ so I have the ability to update my old games; and I decided to paste it below.


(function (Scratch) {

/*Scratch wrap for GameJolt API

* Made by LSTV

* Version 1.1 (build 2)

* Tested on TurboWarp,but should work on E羊icques too

* May be unstable, report any bugs and feature requests you find as soon as possible

*/

function p(f){return new Promise(f)}

function sleep(ms){return p(r=>setTimeout(r,ms))}

let GJAPI={},GJUserdata_me={},GJUserdata_fetch={},gjapi_fetch_user_finished=false,gjapi_fetch_user_result;

// TurboLoader.extension(plugin=>{

// plugin.set(ScratchGJAPI)

// })

function ScratchGJAPI(){return class{

constructor(){

GJAPI.bAutoLogin=true;

this.E_SESSION="Error: you need to start a session and log-in to use this block. (Also make sure all ID's are correct.)";

this.E_TROPHY="Error: the trophy ID you entered does not seem to exitst";

this.E_TROPHYS="Error: there do not seem to be any trophys available.";

this.icon=/*?editor*/"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJ1klEQVR4nO3YvW2bWRBAUc6CBRkuybEDl8ASFDh2SYYKEvA23XD/9I3Ee04DMwNR5MWbG0/rnHO2dwDgn5mZuWLOH1cMAQA+FgEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAoPv2AgDwEc3M1uhzxRAvAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAoNleoOCcc7Z3uNqXx4/tFeDpvD5etle43EzyZ+qSo70AAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACC7tsLAHwmr4+X7RVWzMz2Chue+mgvAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAoNle4CrnnLO9w9W+PH5srwDv5vXxsr3C5WYyX9l/lTz6Cl4AACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgKD79gLA5/X6eNleIeWcs73ChrWjZ2a2Zl/BCwAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIGiuHnjOOVfP3Pbl8WNl7q/Hz5W5t9vt9u3xfW321t3Fm7/e3lbm0jFz+c/UR3DJ0V4AACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBc/XAc865eua237f7ytxvj+8rc2+32+3X4+fa7K273XytrZtfHy8rc7fNXP5z8RE89dFeAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQXPOOdtLAP/N79t9e4XLfb29ba9wuZnZXmFD8ugreAEAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAATdtxcAPq+vt7ftFS43M9srbMke/qy8AABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAgmZh5lmYScg5PmIFMxtfX+uSR/M+vAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAILuCzNnYSYtZ3uBipnkv3PyaJ6PFwAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQNBsL8BzOuec7R1KZpL/ysmj4f/iBQAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAEHTfXgCexcxsr7AheTQ8Ay8AABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQNBsL8D7Oeec7R02zCQ/1smjgX/PCwAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIOi+vQDPaWa2V9iQPBr4nLwAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCBAAABAkAAAgSAAAQJAAAIEgAAECQAACAIAEAAEECAACCZnuBgnPO2Zg7k/3zZg8H+Lu8AABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAgmZ7Ad7VWZztswXwgXkBAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAg6E8u0lcI814++AAAAABJRU5ErkJggg=="/*?editor:""*/;

}

getInfo(){

return {

id:"gamejoltapiforscratch",name:"GJAPI",color1:'#2f7f6f',color2:'#c6e854',color3:'#ffffff',menuIconURI:this.icon,

blocks:[

{

opcode:"gj_connect",

blockType:"command",

text:"Connect session | Game ID:[gid] Private token:[token]",

blockIconURI:this.icon,

arguments:{gid:{type:"number",defaultValue:"..."},token:{type:"string",defaultValue:"..."}},

},

{opcode:"gj_disconnect",blockType:"command",text:"Close session",arguments:{}},

"---",

{opcode:"gj_login",blockType:"command",text:"Manual login: username [name] game token [token]",arguments:{name:{type:"string",defaultValue:"..."},token:{type:"string",defaultValue:"..."}}},

{opcode:"gj_reload_ud",blockType:"command",text:"Refresh current user's data (do after manual login)",arguments:{}},

{opcode:"gj_logoff",blockType:"command",text:"Logout",arguments:{}},

{opcode:"gj_user_isloggedin",blockType:"Boolean",text:"Is logged in?",arguments:{}},

{opcode:"gj_origin_gj",blockType:"Boolean",text:"Is game running on GameJolt?",arguments:{}},

{opcode:"gj_user_fetch",blockType:"command",text:"Fetch user [name] by [origin]",arguments:{name:{type:"string",defaultValue:"CROS"},origin:{type:"string",defaultValue:"username",menu:"userorid"}}},

{opcode:"gj_user_getinfo",blockType:"reporter",text:"[type] of [origin]",arguments:{origin:{type:"string",defaultValue:"fetched",menu:"user"},type:{type:"string",defaultValue:"username",menu:"userinfo"}}},

{

opcode:"gj_user_getavatar",

blockType:"reporter",

text:"Profile picture [type] of [origin] quality [q] (1-400)",

arguments:{origin:{type:"string",defaultValue:"fetched",menu:"user"},type:{type:"string",menu:"imgformat"},q:{type:"number",defaultValue:"60"}},

},

"---",

{opcode:"gj_trophy_add",blockType:"command",text:"Achieve trophy [id]",arguments:{id:{type:"number",defaultValue:"1234"}}},

{opcode:"gj_trophy_remove",blockType:"command",text:"Remove trophy [id]",arguments:{id:{type:"number",defaultValue:"1234"}}},

{opcode:"gj_trophy_fetch",blockType:"reporter",text:"Get trophy [id]",arguments:{id:{type:"number",defaultValue:"1234"}}},

{opcode:"gj_trophy_getvalue",blockType:"reporter",text:"Trophy [json] get [i]",arguments:{json:{type:"string",defaultValue:"{...}"},i:{type:"string",menu:"trophydetails"}}},

{opcode:"gj_trophy_fetchmulti",blockType:"reporter",text:"Get list of [_type] trophys",arguments:{_type:{type:"string",menu:"trophyachieved"}}},

{opcode:"gj_trophylist_getindex",blockType:"reporter",text:"Trophy list [json] get trophy at [i] (enter 'length' to get list length)",arguments:{json:{type:"string",defaultValue:"[{...}]"},i:{type:"string",defaultValue:"0"}}},

"---",

{opcode:"gj_score_gettables",blockType:"reporter",text:"Get list of all tables"},

{

opcode:"gj_score_add",

blockType:"command",

text:"Score table [id] add score [score] with text [text], extra data [extra]",

arguments:{id:{type:"number",defaultValue:"1234"},score:{type:"number",defaultValue:"100"},text:{type:"string",defaultValue:"100 Points"},extra:{type:"string",defaultValue:"race"}},

},

{

opcode:"gj_score_add_guest",

blockType:"command",

text:"Score table [id] add score as guest name [name] score [score] with text [text], extra data [extra]",

arguments:{id:{type:"number",defaultValue:"1234"},score:{type:"number",defaultValue:"100"},text:{type:"string",defaultValue:"100 Points"},name:{type:"string",defaultValue:"Guest12345"},extra:{type:"string",defaultValue:"race"}},

},

{

opcode:"gj_score_get",

blockType:"reporter",

text:"Score table [id] get list of [all] scores, limit [limit]",

arguments:{id:{type:"number",defaultValue:"1234"},limit:{type:"number",defaultValue:"10"},all:{type:"string",defaultValue:"all",menu:"scores"}},

},

{

opcode:"gj_score_get_guest",

blockType:"reporter",

text:"Score table [id] get score list of guest [name], limit [limit]",

arguments:{id:{type:"number",defaultValue:"1234"},limit:{type:"number",defaultValue:"10"},name:{type:"string",defaultValue:"Guest12345"}},

},

{opcode:"gj_scorelist_getindex",blockType:"reporter",text:"Score list [json] get score at [i] (enter 'length' to get list length)",arguments:{json:{type:"string",defaultValue:"[{...}]"},i:{type:"string",defaultValue:"0"}}},

{opcode:"gj_score_getvalue",blockType:"reporter",text:"Score [json] get [i]",arguments:{json:{type:"string",defaultValue:"{...}"},i:{type:"string",menu:"scoredetails"}}},

"---",

{opcode:"gj_friendlist",blockType:"reporter",text:"Get friendlist (as ID's)"},

"---",

{opcode:"gj_ds_set",blockType:"command",text:"Set [global] data with key [key] data:[data]",arguments:{global:{type:"string",menu:"global"},key:{type:"string",defaultValue:"key"},data:{type:"string",defaultValue:"data"}}},

{opcode:"gj_ds_get",blockType:"reporter",text:"Get [global] data with key [key]",arguments:{global:{type:"string",menu:"global"},key:{type:"string",defaultValue:"key"}}},

{opcode:"gj_ds_update",blockType:"command",text:"[global] data with key [key] do [operation] value [value]",arguments:{global:{type:"string",menu:"global"},key:{type:"string",defaultValue:"key"},operation:{type:"string",menu:"operation"},value:{type:"string",defaultValue:"1"}}},

{opcode:"gj_ds_remove",blockType: "command",text:"Remove [global] data with key [key]",arguments:{global:{type:"string",menu:"global"},key:{type:"string",defaultValue:"key"}}},

{opcode:"gj_ds_keys",blockType:"reporter",text:"Get [global] key list",arguments:{global:{type:"string",menu:"global"},pattern:{type:"string",defaultValue:'*'},index:{type:"number",defaultValue:0}}},

{opcode:"gj_getindex",blockType:"reporter",text:"List [json] get at [i] (enter 'length' for length)",arguments:{json:{type:"string",defaultValue:"[{...}]"},i:{type:"string",defaultValue:"0"}}},

],

menus:{

user:[{text:"fetched",value:"fetched"},{text:"me",value:"my"}],

userorid:[{text:"username",value:"username"},{text:"id",value:"id"}],

scores:[{text:"everyone's",value:"all"},{text:"my",value:"my"}],

imgformat:[{text:"url",value:"url"},{text:"data uri",value:"uri"}],

userinfo:[{text:"Username",value:"username"},{text:"ID",value:"id"},{text:"Profile description",value:"developer_description"},{text:"Status",value:"status"},{text:"Account creation date",value:"signed_up"},{text:"Last login",value:"last_logged_in"}],

trophyachieved:[{text:"all",value:"0"},{text:"achieved",value:"1"},{text:"not achieved",value:"-1"}],

trophydetails:[{text:"Achieved ... ago (false if never)",value:"achieved"},{text:"Description",value:"description"},{text:"Difficulty",value:"difficulty"},{text:"ID",value:"id"},{text:"Title",value:"title"},{text:"Image URL",value:"image_url"}],

scoredetails:[{text:"is guest",value:"guest"},{text:"username",value:"user"},{text:"achieved ... ago",value:"stored"},{text:"achieved (timestamp)",value:"stored_timestamp"},{text:"score value",value:"sort"},{text:"score text",value:"score"},{text:"extra data",value:"extra_data"}],

global:["global","user"],

operation:["add","subtract","multiply","divide","append","prepend"]

}

};

}

gj_connect({gid,token}) {

GJAPI.iGameID=gid;GJAPI.sGameKey=token;GJAPI.bAutoLogin=true;GJAPI.SessionOpen();

}

async gj_login({name,token}) {

GJAPI.UserLoginManual(name,token,function(r){

if(!r?.success){GJAPI.bLoggedIn=false;return}

GJAPI.UserFetchCurrent(function(pResponse){if(!pResponse.users){GJUserdata_me="error"}GJUserdata_me=pResponse})

});

await sleep(530);

}

async gj_reload_ud() {

GJAPI.UserFetchCurrent(function (pResponse) {if (!pResponse.users) {GJUserdata_me = "error"} GJUserdata_me = pResponse;});

await sleep(530);

}

gj_logoff() {

if(GJAPI.bLoggedIn){GJAPI.UserLogout()}

}

gj_user_isloggedin(){

return GJAPI.bLoggedIn;

}

gj_disconnect() {

GJAPI.UserLogout(); GJAPI.SessionClose();

}

gj_origin_gj() {

return GJAPI.bOnGJ;

}

async gj_user_fetch({name,origin}) {

if (origin === "username") {

GJAPI.UserFetchName(name,function (pResponse) {if (!pResponse.users) {GJUserdata_fetch = "error"} GJUserdata_fetch = pResponse;});

} else {

GJAPI.UserFetchID(name,function (pResponse) {if (!pResponse.users) {GJUserdata_fetch = "error"} GJUserdata_fetch = pResponse;});

}

await sleep(250);

}

gj_user_getinfo({origin,type}) {

if (origin === "my" ? GJUserdata_me.users == undefined :GJUserdata_fetch.users == undefined) {return "Error somewhere!"} else {

if (origin === "my") {

return GJUserdata_me.users[0][type]

} else {

return GJUserdata_fetch.users[0][type]

}

}

}

gj_user_getavatar({origin,type,q}) {

let this_url;

if (origin === "me" ? GJUserdata_me.users == undefined :GJUserdata_fetch.users == undefined) {return "Error somewhere!"} else {

if (origin === "me") {this_url = GJUserdata_me.users[0].avatar_url.replaceAll("/60/","/" + q + "/")} else {

if (GJUserdata_fetch === "error") {return "Error somewhere!";} else {

this_url = GJUserdata_fetch.users[0].avatar_url.replaceAll("/60/","/" + q + "/")

}

}

if (type === "url") {

return this_url;

} else {

return getBase64Image(this_url).then(base64Image => base64Image);

}

}

}

gj_trophy_add({id}) {

return p(r=>GJAPI.TrophyAchieve(id,r))

}

gj_trophy_remove({id}) {

return p(r=>GJAPI.TrophyRemove(id,r))

}

async gj_trophy_fetchmulti({_type}){

console.log(+_type);

return await p(r=>{

GJAPI.TrophyFetch(+_type,t=>{

if(t?.success&&t?.trophies?.length){

r(JSON.stringify(t.trophies))

}else{r(this.E_TROPHYS)}

})

})

}

async gj_trophy_fetch({id}) {

return await p(r=>{

GJAPI.TrophyFetchSingle(id,t=>{

if(t?.success&&t?.trophies?.length){

r(JSON.stringify(t.trophies))

}else{r(this.E_TROPHY)}

})

})

}

async gj_trophylist_getindex({json,i}) {

try{json=typeof json=="string"?JSON.parse(json):json}catch(e){return "Error: Invalid trophy list"}

if(!json?.[i])return "Error: invalid index";

return JSON.stringify(json[i])

}

async gj_trophylist_getindex({json,i}) {

try{json=typeof json=="string"?JSON.parse(json):json}catch(e){return "Error: Invalid trophy list"}

if(!json?.[i])return "Error: invalid index";

return JSON.stringify(json[i])

}

async gj_trophy_getvalue({json,i}) {

try{json=typeof json=="string"?JSON.parse(json):json}catch(e){return "Error: Invalid trophy"}

if(!json?.[i])return "Error: invalid value";

return JSON.stringify(json[i])

}

async gj_score_gettables(){

return await p(_r=>{

GJAPI.ScoreGetTables((r)=>{

if(r?.success=='false'||!r?.tables)return _r(this.E_SESSION);

_r(JSON.stringify(r.tables.map(f=>f.id)))

});

})

}

gj_score_add({id,score,text,extra}) {

return p(r=>GJAPI.ScoreAdd(id,score,text,extra||"",r))

}

gj_score_add_guest({id,score,text,name,extra}) {

return p(r=>GJAPI.ScoreAddGuest(id,score,text,name,extra||"",r))

}

async gj_score_get({id,all,limit,isGuest}){

return await p(re=>{

GJAPI[isGuest?"ScoreFetchGuest":"ScoreFetch"](id,isGuest?all:all=="me",+limit,(r)=>{

if(r.success=='false')return re(this.E_SESSION);

if(!r?.scores?.length)return re("Error: no scores");

re(JSON.stringify(r.scores))

});

})

}

async gj_score_get_guest({id,name,limit}){

return await this.gj_score_get({id:id,all:name,limit:limit,isGuest:true})

}

async gj_scorelist_getindex({json,i}) {

try{json=typeof json=="string"?JSON.parse(json):json}catch(e){return "Error: Invalid scores list"}

if(!json?.[i])return "Error: invalid index";

return JSON.stringify(json[i])

}

async gj_score_getvalue({json,i}){

try{json=typeof json=="string"?JSON.parse(json):json}catch(e){return "Error: Invalid score"}

if(i=="guest")return json?.["guest"]?.length?"true":"false";

if(i=="user"&&json?.["guest"]?.length)return json["guest"];

if(!json?.[i])return "Error: invalid value";

return JSON.stringify(json[i])

}

async gj_friendlist(){

return await p(_r=>{

GJAPI.FriendsFetch((r)=>{

if(r?.success=='false'||!r?.friends)return _r(this.E_SESSION);

_r(JSON.stringify(r.friends.map(f=>f.friend_id)))

});

})

}

gj_ds_set({global,key,data}) {

return p(r=>GJAPI.DataStoreSet(global=="global"?1:0,key,data,r));

}

async gj_ds_get({global,key}){

global=global=="global"?1:0;

return await p(_r=>GJAPI.DataStoreFetch(global,key,r=>{if(!r?.success){_r("Error: "+r.message);return}_r(r.data)}))

}

gj_ds_update({key,global,value,operation}){

global=global=="global"?1:0;

return p(r=>GJAPI.DataStoreUpdate(global,key,operation,value,r))

}

gj_ds_remove({global,key}) {

global=global=="global"?1:0;

return p(r=>GJAPI.DataStoreRemove(global,key,r))

}

async gj_ds_keys({global}) {

global=global=="global"?1:0;

return await p(_r=>GJAPI.DataStoreGetKeys(global,r=>{

if (!r?.success){_r("Error: "+r.message);return}

_r(JSON.stringify(r.keys.map(k=>k.key)))

}))

}

async gj_getindex({json,i}) {

try{json=typeof json=="string"?JSON.parse(json):json}catch(e){return "Error: Invalid list"}

if(!json?.[i])return "Error: nothing at this index";

return typeof json[i]=="string"?json[i]:JSON.stringify(json[i])

}

}}

function validateJSON(json){try{var validatethisjson=JSON.parse(json);return true;}catch(e){return false;}}

let getImageBlob=function(e){return new Promise(async a=>{a((await fetch(e)).blob())})},blobToBase64=function(e){return new Promise(a=>{let t=new FileReader;t.onload=function(){let e=t.result;a(e)},t.readAsDataURL(e)})},getBase64Image=async function(e){let a=await getImageBlob(e);return(await blobToBase64(a)).replace("data:application/octet-stream;base64,","data:image/png;base64,")};

0!==GJAPI.iGameID&&""!==GJAPI.sGameKey||alert("Game ID or Game Key missing!");GJAPI.sAPI="https://api.gamejolt.com/api/game/v1_2";GJAPI.sLogName="[Game Jolt API | Scratch]";GJAPI.iLogStack=20;GJAPI.asQueryParam=function(){for(var a={},f=window.location.search.substring(1).split("&"),b=0;b<f.length;++b){var c=f[b].split("=");"undefined"===typeof a[c[0]]?a[c[0]]=c[1]:"string"===typeof a[c[0]]?a[c[0]]=[a[c[0]],c[1]]:a[c[0]].push(c[1])}return a}();

GJAPI.bOnGJ=window.location.hostname.match(/gamejolt/)?!0:!1;GJAPI.LogTrace=function(a){GJAPI.iLogStack&&(--GJAPI.iLogStack||(a="(\u256f\u00b0\u25a1\u00b0\uff09\u256f\ufe35 \u253b\u2501\u253b"),console.warn(GJAPI.sLogName+" "+a),console.trace())};GJAPI.SEND_FOR_USER=!0;GJAPI.SEND_GENERAL=!1;GJAPI.SendRequest=function(a,f,b){GJAPI.SendRequestEx(a,f,"json","","",b)};

GJAPI.SendRequestEx=function(a,f,b,c,d,e){a=GJAPI.sAPI+encodeURI(a)+(-1===a.indexOf("/?")?"?":"&")+"game_id="+GJAPI.iGameID+"&format="+b;GJAPI.bLoggedIn&&f===GJAPI.SEND_FOR_USER&&(a+="&username="+GJAPI.sUserName+"&user_token="+GJAPI.sUserToken);a+="&signature="+hex_md5(a+d+GJAPI.sGameKey);__CreateAjax(a,c,function(g){GJAPI.bDebugMode&&console.info(GJAPI.sLogName+" <"+a+"> "+g);if(""!==g&&"function"===typeof e)switch(b){case "json":e(eval("("+g+")").response);break;case "dump":var h=g.indexOf("\n"),

k=g.substring(0,h-1);g=g.substring(h+1);e({success:"SUCCESS"===k,data:g});break;default:e(g)}})};GJAPI.bLoggedIn=GJAPI.bAutoLogin&&GJAPI.asQueryParam.gjapi_username&&GJAPI.asQueryParam.gjapi_token?!0:!1;GJAPI.sUserName=GJAPI.bLoggedIn?GJAPI.asQueryParam.gjapi_username:"";GJAPI.sUserToken=GJAPI.bLoggedIn?GJAPI.asQueryParam.gjapi_token:"";console.info(GJAPI.asQueryParam);

console.info(GJAPI.sLogName+(GJAPI.bOnGJ?" E":" Not e")+"mbedded on Game Jolt <"+window.location.origin+window.location.pathname+">");console.info(GJAPI.sLogName+(GJAPI.bLoggedIn?" U":" No u")+"ser recognized <"+GJAPI.sUserName+">");window.location.hostname||console.warn(GJAPI.sLogName+" XMLHttpRequest may not work properly on a local environment");GJAPI.bSessionActive=!0;

GJAPI.SessionOpen=function(){GJAPI.bLoggedIn?GJAPI.iSessionHandle||GJAPI.SendRequest("/sessions/open/",GJAPI.SEND_FOR_USER,function(a){"true"===a.success&&(GJAPI.iSessionHandle=window.setInterval(GJAPI.SessionPing,3E4),window.addEventListener("beforeunload",GJAPI.SessionClose,!1))}):GJAPI.LogTrace("SessionOpen() failed:no user logged in")};GJAPI.SessionPing=function(){GJAPI.bLoggedIn?GJAPI.SendRequest("/sessions/ping/?status="+(GJAPI.bSessionActive?"active":"idle"),GJAPI.SEND_FOR_USER):GJAPI.LogTrace("SessionPing() failed:no user logged in")};

GJAPI.SessionClose=function(){GJAPI.bLoggedIn?(GJAPI.iSessionHandle&&(window.clearInterval(GJAPI.iSessionHandle),window.removeEventListener("beforeunload",GJAPI.SessionClose),GJAPI.iSessionHandle=0),GJAPI.SendRequest("/sessions/close/",GJAPI.SEND_FOR_USER)):GJAPI.LogTrace("SessionClose() failed:no user logged in")};GJAPI.SessionCheck=function(a){GJAPI.SendRequest("/sessions/check/",GJAPI.SEND_FOR_USER,a)};GJAPI.bLoggedIn&&GJAPI.SessionOpen();

GJAPI.UserLoginManual=function(a,f,b){GJAPI.bLoggedIn?GJAPI.LogTrace("UserLoginManual("+a+", "+f+") failed:user "+GJAPI.sUserName+" already logged in"):GJAPI.SendRequest("/users/auth/?username="+a+"&user_token="+f,GJAPI.SEND_GENERAL,function(c){"true"===c.success&&(GJAPI.bLoggedIn=!0,GJAPI.sUserName=a,GJAPI.sUserToken=f,GJAPI.SessionOpen());"function"===typeof b&&b(c)},!1)};

GJAPI.UserLogout=function(){GJAPI.bLoggedIn?(GJAPI.SessionClose(),GJAPI.bLoggedIn=!1,GJAPI.sUserName="",GJAPI.sUserToken="",GJAPI.abTrophyCache={}):GJAPI.LogTrace("UserLogout() failed:no user logged in")};GJAPI.UserFetchID=function(a,f){GJAPI.SendRequest("/users/?user_id="+a,GJAPI.SEND_GENERAL,f)};GJAPI.UserFetchName=function(a,f){GJAPI.SendRequest("/users/?username="+a,GJAPI.SEND_GENERAL,f)};GJAPI.UserFetchCurrent=function(a){GJAPI.bLoggedIn?GJAPI.UserFetchName(GJAPI.sUserName,a):GJAPI.LogTrace("UserFetchCurrent() failed:no user logged in")};

GJAPI.abTrophyCache={};GJAPI.TROPHY_ONLY_ACHIEVED=1;GJAPI.TROPHY_ONLY_NOTACHIEVED=-1;GJAPI.TROPHY_ALL=0;GJAPI.TrophyAchieve=function(a,f){GJAPI.bLoggedIn?GJAPI.abTrophyCache[a]||GJAPI.SendRequest("/trophies/add-achieved/?trophy_id="+a,GJAPI.SEND_FOR_USER,function(b){"true"===b.success&&(GJAPI.abTrophyCache[a]=!0);"function"===typeof f&&f(b)}):GJAPI.LogTrace("TrophyAchieve("+a+") failed:no user logged in")};

GJAPI.TrophyRemove=function(a,f){GJAPI.bLoggedIn?GJAPI.abTrophyCache[a]&&GJAPI.SendRequest("/trophies/remove-achieved/?trophy_id="+a,GJAPI.SEND_FOR_USER,function(b){"true"===b.success&&(GJAPI.abTrophyCache[a]=!1);"function"===typeof f&&f(b)}):GJAPI.LogTrace("TrophyRemove("+a+") failed:no user logged in")};

GJAPI.TrophyFetch=function(a,f){GJAPI.bLoggedIn?GJAPI.SendRequest("/trophies/"+(a===GJAPI.TROPHY_ALL?"":"?achieved="+(a>=GJAPI.TROPHY_ONLY_ACHIEVED?"true":"false")),GJAPI.SEND_FOR_USER,f):GJAPI.LogTrace("TrophyFetch("+a+") failed:no user logged in")};GJAPI.TrophyFetchSingle=function(a,f){GJAPI.bLoggedIn?GJAPI.SendRequest("/trophies/?trophy_id="+a,GJAPI.SEND_FOR_USER,f):GJAPI.LogTrace("TrophyFetchSingle("+a+") failed:no user logged in")};GJAPI.SCORE_ONLY_USER=!0;GJAPI.SCORE_ALL=!1;

GJAPI.BETTER_THAN=!0;GJAPI.WORSE_THAN=!1;GJAPI.ScoreAdd=function(a,f,b,c,d){GJAPI.bLoggedIn?GJAPI.ScoreAddGuest(a,f,b,"",c,d):GJAPI.LogTrace("ScoreAdd("+a+", "+f+", "+b+") failed:no user logged in")};GJAPI.ScoreAddGuest=function(a,f,b,c,d,e){var g=c&&c.length?!0:!1;GJAPI.SendRequest("/scores/add/?sort="+f+"&score="+b+(g?"&guest="+c:"")+(a?"&table_id="+a:"")+(d?"&extra_data="+d:""),g?GJAPI.SEND_GENERAL:GJAPI.SEND_FOR_USER,e)};

GJAPI.ScoreFetch=function(a,f,b,c){!GJAPI.bLoggedIn&&f?GJAPI.LogTrace("ScoreFetch("+a+", "+f+", "+b+") failed:no user logged in"):GJAPI.SendRequest("/scores/?limit="+b+(a?"&table_id="+a:""),f!==GJAPI.SCORE_ONLY_USER?GJAPI.SEND_GENERAL:GJAPI.SEND_FOR_USER,c)};GJAPI.ScoreFetchGuest=function(a,f,b,c){GJAPI.SendRequest("/scores/?limit="+b+"&guest="+f+(a?"&table_id="+a:""),GJAPI.SEND_GENERAL,c)};

GJAPI.ScoreFetchEx=function(a,f,b,c,d,e){!GJAPI.bLoggedIn&&f?GJAPI.LogTrace("ScoreFetch("+a+", "+f+", "+b+", "+c+", "+d+") failed:no user logged in"):GJAPI.SendRequest("/scores/?limit="+b+(a?"&table_id="+a:"")+(c?"&better_than=":"&worse_than=")+d,f!==GJAPI.SCORE_ONLY_USER?GJAPI.SEND_GENERAL:GJAPI.SEND_FOR_USER,e)};GJAPI.ScoreFetchGuestEx=function(a,f,b,c,d,e){GJAPI.SendRequest("/scores/?limit="+b+"&guest="+f+(a?"&table_id="+a:"")+(c?"&better_than=":"&worse_than=")+d,GJAPI.SEND_GENERAL,e)};

GJAPI.ScoreGetRank=function(a,f,b){GJAPI.SendRequest("/scores/get-rank/?sort="+f+(a?"&table_id="+a:""),GJAPI.SEND_GENERAL,b)};GJAPI.ScoreGetTables=function(a){GJAPI.SendRequest("/scores/tables/",GJAPI.SEND_GENERAL,a)};GJAPI.FriendsFetch=function(a){GJAPI.bLoggedIn?GJAPI.SendRequest("/friends/",GJAPI.SEND_FOR_USER,a):GJAPI.LogTrace("FriendsFetch() failed:no user logged in")};GJAPI.DATA_STORE_USER=0;GJAPI.DATA_STORE_GLOBAL=1;

GJAPI.DataStoreSet=function(a,f,b,c){GJAPI.SendRequestEx("/data-store/set/?key="+f,a===GJAPI.DATA_STORE_USER,"json","data="+b,"data"+b,c)};GJAPI.DataStoreFetch=function(a,f,b){GJAPI.SendRequestEx("/data-store/?key="+f,a===GJAPI.DATA_STORE_USER,"dump","","",b)};GJAPI.DataStoreUpdate=function(a,f,b,c,d){GJAPI.SendRequest("/data-store/update/?key="+f+"&operation="+b+"&value="+c,a===GJAPI.DATA_STORE_USER,d)};

GJAPI.DataStoreRemove=function(a,f,b){GJAPI.SendRequest("/data-store/remove/?key="+f,a===GJAPI.DATA_STORE_USER,b)};GJAPI.DataStoreGetKeys=function(a,f){GJAPI.SendRequest("/data-store/get-keys/",a===GJAPI.DATA_STORE_USER,f)};GJAPI.TimeFetch=function(a){GJAPI.SendRequest("/time/",GJAPI.SEND_GENERAL,a)};

function __CreateAjax(a,f,b){"string"!==typeof f&&(f="");if(window.XMLHttpRequest){var c=new XMLHttpRequest;c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};""!==f?(c.open("POST",a),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(f)):(c.open("GET",a),c.send())}else console.error(GJAPI.sLogName+" XMLHttpRequest not supported")}var hexcase=0;function hex_md5(a){return rstr2hex(rstr_md5(str2rstr_utf8(a)))}

function hex_hmac_md5(a,f){return rstr2hex(rstr_hmac_md5(str2rstr_utf8(a),str2rstr_utf8(f)))}function md5_vm_test(){return"900150983cd24fb0d6963f7d28e17f72"==hex_md5("abc").toLowerCase()}function rstr_md5(a){return binl2rstr(binl_md5(rstr2binl(a),8*a.length))}

function rstr_hmac_md5(a,f){var b=rstr2binl(a);16<b.length&&(b=binl_md5(b,8*a.length));for(var c=Array(16),d=Array(16),e=0;16>e;e++)c[e]=b[e]^909522486,d[e]=b[e]^1549556828;b=binl_md5(c.concat(rstr2binl(f)),512+8*f.length);return binl2rstr(binl_md5(d.concat(b),640))}function rstr2hex(a){try{hexcase}catch(e){hexcase=0}for(var f=hexcase?"0123456789ABCDEF":"0123456789abcdef",b="",c,d=0;d<a.length;d++)c=a.charCodeAt(d),b+=f.charAt(c>>>4&15)+f.charAt(c&15);return b}

function str2rstr_utf8(a){for(var f="",b=-1,c,d;++b<a.length;)c=a.charCodeAt(b),d=b+1<a.length?a.charCodeAt(b+1):0,55296<=c&&56319>=c&&56320<=d&&57343>=d&&(c=65536+((c&1023)<<10)+(d&1023),b++),127>=c?f+=String.fromCharCode(c):2047>=c?f+=String.fromCharCode(192|c>>>6&31,128|c&63):65535>=c?f+=String.fromCharCode(224|c>>>12&15,128|c>>>6&63,128|c&63):2097151>=c&&(f+=String.fromCharCode(240|c>>>18&7,128|c>>>12&63,128|c>>>6&63,128|c&63));return f}

function rstr2binl(a){for(var f=Array(a.length>>2),b=0;b<f.length;b++)f[b]=0;for(b=0;b<8*a.length;b+=8)f[b>>5]|=(a.charCodeAt(b/8)&255)<<b%32;return f}function binl2rstr(a){for(var f="",b=0;b<32*a.length;b+=8)f+=String.fromCharCode(a[b>>5]>>>b%32&255);return f}

function binl_md5(a,f){a[f>>5]|=128<<f%32;a[(f+64>>>9<<4)+14]=f;for(var b=1732584193,c=-271733879,d=-1732584194,e=271733878,g=0;g<a.length;g+=16){var h=b,k=c,l=d,m=e;b=md5_ff(b,c,d,e,a[g+0],7,-680876936);e=md5_ff(e,b,c,d,a[g+1],12,-389564586);d=md5_ff(d,e,b,c,a[g+2],17,606105819);c=md5_ff(c,d,e,b,a[g+3],22,-1044525330);b=md5_ff(b,c,d,e,a[g+4],7,-176418897);e=md5_ff(e,b,c,d,a[g+5],12,1200080426);d=md5_ff(d,e,b,c,a[g+6],17,-1473231341);c=md5_ff(c,d,e,b,a[g+7],22,-45705983);b=md5_ff(b,c,d,e,a[g+8],7,

1770035416);e=md5_ff(e,b,c,d,a[g+9],12,-1958414417);d=md5_ff(d,e,b,c,a[g+10],17,-42063);c=md5_ff(c,d,e,b,a[g+11],22,-1990404162);b=md5_ff(b,c,d,e,a[g+12],7,1804603682);e=md5_ff(e,b,c,d,a[g+13],12,-40341101);d=md5_ff(d,e,b,c,a[g+14],17,-1502002290);c=md5_ff(c,d,e,b,a[g+15],22,1236535329);b=md5_gg(b,c,d,e,a[g+1],5,-165796510);e=md5_gg(e,b,c,d,a[g+6],9,-1069501632);d=md5_gg(d,e,b,c,a[g+11],14,643717713);c=md5_gg(c,d,e,b,a[g+0],20,-373897302);b=md5_gg(b,c,d,e,a[g+5],5,-701558691);e=md5_gg(e,b,c,d,a[g+

10],9,38016083);d=md5_gg(d,e,b,c,a[g+15],14,-660478335);c=md5_gg(c,d,e,b,a[g+4],20,-405537848);b=md5_gg(b,c,d,e,a[g+9],5,568446438);e=md5_gg(e,b,c,d,a[g+14],9,-1019803690);d=md5_gg(d,e,b,c,a[g+3],14,-187363961);c=md5_gg(c,d,e,b,a[g+8],20,1163531501);b=md5_gg(b,c,d,e,a[g+13],5,-1444681467);e=md5_gg(e,b,c,d,a[g+2],9,-51403784);d=md5_gg(d,e,b,c,a[g+7],14,1735328473);c=md5_gg(c,d,e,b,a[g+12],20,-1926607734);b=md5_hh(b,c,d,e,a[g+5],4,-378558);e=md5_hh(e,b,c,d,a[g+8],11,-2022574463);d=md5_hh(d,e,b,c,a[g+

11],16,1839030562);c=md5_hh(c,d,e,b,a[g+14],23,-35309556);b=md5_hh(b,c,d,e,a[g+1],4,-1530992060);e=md5_hh(e,b,c,d,a[g+4],11,1272893353);d=md5_hh(d,e,b,c,a[g+7],16,-155497632);c=md5_hh(c,d,e,b,a[g+10],23,-1094730640);b=md5_hh(b,c,d,e,a[g+13],4,681279174);e=md5_hh(e,b,c,d,a[g+0],11,-358537222);d=md5_hh(d,e,b,c,a[g+3],16,-722521979);c=md5_hh(c,d,e,b,a[g+6],23,76029189);b=md5_hh(b,c,d,e,a[g+9],4,-640364487);e=md5_hh(e,b,c,d,a[g+12],11,-421815835);d=md5_hh(d,e,b,c,a[g+15],16,530742520);c=md5_hh(c,d,e,

b,a[g+2],23,-995338651);b=md5_ii(b,c,d,e,a[g+0],6,-198630844);e=md5_ii(e,b,c,d,a[g+7],10,1126891415);d=md5_ii(d,e,b,c,a[g+14],15,-1416354905);c=md5_ii(c,d,e,b,a[g+5],21,-57434055);b=md5_ii(b,c,d,e,a[g+12],6,1700485571);e=md5_ii(e,b,c,d,a[g+3],10,-1894986606);d=md5_ii(d,e,b,c,a[g+10],15,-1051523);c=md5_ii(c,d,e,b,a[g+1],21,-2054922799);b=md5_ii(b,c,d,e,a[g+8],6,1873313359);e=md5_ii(e,b,c,d,a[g+15],10,-30611744);d=md5_ii(d,e,b,c,a[g+6],15,-1560198380);c=md5_ii(c,d,e,b,a[g+13],21,1309151649);b=md5_ii(b,

c,d,e,a[g+4],6,-145523070);e=md5_ii(e,b,c,d,a[g+11],10,-1120210379);d=md5_ii(d,e,b,c,a[g+2],15,718787259);c=md5_ii(c,d,e,b,a[g+9],21,-343485551);b=safe_add(b,h);c=safe_add(c,k);d=safe_add(d,l);e=safe_add(e,m)}return[b,c,d,e]}function md5_cmn(a,f,b,c,d,e){return safe_add(bit_rol(safe_add(safe_add(f,a),safe_add(c,e)),d),b)}function md5_ff(a,f,b,c,d,e,g){return md5_cmn(f&b|~f&c,a,f,d,e,g)}function md5_gg(a,f,b,c,d,e,g){return md5_cmn(f&c|b&~c,a,f,d,e,g)}

function md5_hh(a,f,b,c,d,e,g){return md5_cmn(f^b^c,a,f,d,e,g)}function md5_ii(a,f,b,c,d,e,g){return md5_cmn(b^(f|~c),a,f,d,e,g)}function safe_add(a,f){var b=(a&65535)+(f&65535);return(a>>16)+(f>>16)+(b>>16)<<16|b&65535}function bit_rol(a,f){return a<<f|a>>>32-f};

window.GJAPI=GJAPI;

Scratch.extensions.register(new (ScratchGJAPI())());

})(Scratch);



0 comments

Loading...

Next up

Here's a snowman. Anyways this game will have a custom night since it uses a aggression level of 0-20 like all Five Nights at Freddy's games.

I'm not good at image editing or anything so it's not good but, there's this wallpaper (left) that I like and I wanted to see how a "spooky" variant would look so I decided to make my own (right) and I think it turned out okay.

This game will probably be my last. Don't expect it to come out soon.

This... thing... It'll patrol around the home in the actual game.

Koldo's Fun Center: Remake is getting another update (v.1.2.0) which should be releasing tomorrow. the article below lists the things you can expect in the new update:

While I save up for a brand new computer and learn Unity, I'll make one last Roblox game. The game was put on hold for a while and I decided to finish this one. Here's a chicken.

That’s a lot of games…

I made a USB. This will be important.

Find their ojos.

Here's a basic icon I made for my game. I might change the logo.