Discord
Login
Community
DARK THEME

Javascript

I can not figure out how to link a js file with a microScript file. Can someone please help?

Make your project public .

General rule

  • if you add little javascript code it is best to use
system.javascript("""
global.canvas = window.player.runtime.screen.canvas
global.context = global.canvas.getContext("2d")
""")
  • if you add a lot of code then write the javascript code in a separate file and in the first line write
// javascript
  • all variables and functions and classes must be added to the global branch to be visible in the MicroScript code.

  • problems appear when you have a lot of javascript code and the code from one file depends on the code in another file with javascript code.

If you have such a case tell me - I will show you how to bypass this problem.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community