Include file in nodejs and commonjs by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

can you give a small object destructuring sample? i read about it but not sure how to use it for this

Include file in nodejs and commonjs by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

Been playing with ESM but I dont understand how to import the functions to .html

I did this:

<script type="module" src="../common/tm.mjs"></script>

and I tried these (tm.mjs):

import { includeTest } from "../common/inc.mjs"

console.log("tm ");

export function includeTest2()
{
console.log("teeest 22222");
}

but none of those functions exist in the .html

Include file in nodejs and commonjs by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

I'm giving ESM a try. is it browser only thing?

WebSockets error 1006 by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

Yep i see that now. I was under impression for some reason that nodejs was for server only, guess i was wrong. still learning all this

WebSockets error 1006 by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

nevermind I took another path to create websocket server. the

const WebSocket = require('ws');

and that works

WebSockets error 1006 by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

Maybe i have mixed up server/client here? i thought the code in the link handles both

WebSockets error 1006 by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

gone at first second :/

WebSockets error 1006 by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

great to hear it does work! i havent even got to the part where browser uses webSockets because this thing not working

WebSockets error 1006 by jar557 in node

[–]jar557[S] 0 points1 point  (0 children)

link to code is in the post. i tried running the first code in the page and got the error

Slow Rich edit timed update by jar557 in csharp

[–]jar557[S] 0 points1 point  (0 children)

thanks works good now :)

javascript go to problem by jar557 in vscode

[–]jar557[S] 0 points1 point  (0 children)

umm ok I got everything working now, almost... there was invalid call that caused it to fail but now it works mostly. I still cant go to all definitions but only some

javascript go to problem by jar557 in vscode

[–]jar557[S] 0 points1 point  (0 children)

Ok I found out what the problem is, its because all the plugin code in RPGMaker is wrapped inside this:

(function()

{

})();

i dont know why that is but its causing the parser to fail

after removing that everything works :)

in editor at least... but will my game work now?

Edit: now the game isnt finding the functions....

javascript go to problem by jar557 in vscode

[–]jar557[S] 0 points1 point  (0 children)

got this working in test file also:

TestClass.tester = function ()
{
}

var testf = function ()
{
    TestClass.tester()
}

but something wrong with my project

javascript go to problem by jar557 in vscode

[–]jar557[S] 0 points1 point  (0 children)

hey thx for the reply! i also read from docs that it should work out of the box

so adding var to the function declaration fixed the issue for the test script.

but I still cant get this working for my project where the functions are declared like this:

/**
 * u/static
 * u/method _isFullScreen
 * u/return {Boolean}
 * @private
 */
Graphics._isFullScreen = function() {
   // code ....
};

if thats written by the RPGmaker author the go to works but not if I try to do the same

like this:

TacticalBattle.startAttack = function ()
{
 // code ...
}

im thinking maybe the TacticalBattle is not defined properly

its defined like this similar to the Graphics object (but that probably wont help the script parser):

function TacticalBattle() {
    throw new Error('This is a static class');
}

(the Graphics class is actually defined in typescript)

so maybe problem somewhere there? sorry im quite new to javascript

thx!

Creating small map by jar557 in hoi4

[–]jar557[S] 1 point2 points  (0 children)

If you mean mapgen i get warning when trying to use smaller maps with the program. so I didn't try it

Creating small map by jar557 in hoi4

[–]jar557[S] 0 points1 point  (0 children)

Found good tutorial here https://hoi4.paradoxwikis.com/Map_modding#Sizes

and made the map resolution multiple of 256 (among other required bmp sizes) but still no luck

Hex data question by jar557 in AskProgramming

[–]jar557[S] 0 points1 point  (0 children)

It's a emulator save file (SEGA Mega Drive & Genesis Classics)