How run shell scripts commands through JScode on Gdevelop

How can i run shell scripts commands (bash) through Javascript code on Gdevelop?

Hi if you mean pure javaScript here is an example GDevelop 5

I have checked the example.
How can i do to the command runs only once in JavaScript? Like at the beginning of the scene, but code in JavaScript.

For example like this
if (run == 0) {
run = 1;
// your commands
}

That wouldn’t work, as the run variable needs to be defined and in global scope to not be discarded after the event has ran. You could make that work by attaching the variable to a global namespace. The gdjs namespace is guaranteed to be global across GDevelop games, so you could do

if (gdjs.run) return;
gdjs.run = true;
// Your code

But generally, i would recommend using an event there, you can put a JS event as child of an event that has the condition you want.

1 Like