Help i m beginner and i don't understand whats happend

Hello, my English is bad, I am French!
I uploaded a file to openprocessing to study the mechanism of an automatic write that I need. I am under visualcode … Cannot run the program because I have an error (view in the console) Uncaught ReferenceError: p5ex is not defined at mySketch.js: 157 I’m not very good at it! Can someone explain to me where the error is so that I can run this code. Thank you
Processing: sketch570487.zip…
This is the file ! WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

Please share a link to your sketch on OpenProcessing.org or editor.p5js.org or include you code in your post here (click the </> button in the toolbar to get proper formatting). I’m not comfortable clicking on the link your provided.

Thank you !
It s NOT mine sketch, it s a sketch i would like study and modify beacaus it s the asemic writing i want to learn !
https://openprocessing.org/sketch/570487
It work on line but not from Visualcode?

Funny how similar the sketch is to this one Muotoja sanoista - OpenProcessing from 2013 :slight_smile:

The sketch in openprocessing is using an additional JavaScript library:

It contains additional helper functions. Here’s the documentation:
https://fal-works.github.io/p5ex/doc/index.html
and this seems to be the homepage: p5ex.js | p5ex

And please what is my mistake because it doesn’t work in local in visualcode this is index.html

<head>

<script src="mySketch.js" type="text/javascript"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@0.6.0/lib/p5.min.js" type="text/javascript">

</script><script src="https://unpkg.com/p5ex@0.5.6/lib/p5ex.min.js" type="text/javascript"></script>="http

</head>

2021-10-21_143438

When you open your sketch, does the URL look like file:/// or like http://localhost/ ?

Maybe you can open the console, the Network tab, and reload your page, see if any of the files are not found?

But someone else who works with JS should help you. I’m not using it lately.

http://192.168.1.3:5500/index.html merci

Help with javascript will be very appreciated !

I’m not sure where those 404s are coming from because the original sketch on OpenProcessing doesn’t load any assets. However, one problem I can see is the order that you are including your script files. Your mySketch.js file needs to be included after p5 and p5ex. In fact I couldn’t get it to work while being loaded from <head> at all and had to move it to <body>:

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	
	<script src="https://cdn.jsdelivr.net/npm/p5@0.6.0/lib/p5.min.js" type="text/javascript"></script>
	<script src="https://unpkg.com/p5ex@0.5.6/lib/p5ex.min.js" type="text/javascript"></script>

	<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>   
	
	<script src="mySketch.js"></script>
</body>

</html>
1 Like

Thank you ! Yessssssss ! It s the solution ! I m very very happy !