New to coding; need a lotta help!

I have been following along with Daniel Shiffman’s tutorial videos on YouTube, and some codes work but others don’t. I’m new to coding, but it seems that the problem is the variables I put in, that the reader(?) doesn’t recognize them. E.g.:

pendulum%20%5Bdoesn't%20work%5D%201

Nothing appears on the screen; no pendulum! Where have I gone wrong?? The PVectors etc. are unknown? If so, how do I tell it to “know” them??

you show a photo ? snapshot? of what program ? webpage? ( you call “reader” ?)
if that is a webpage with a editor using a file
sketch.js
you might want to write a

p5.js code?

your variables ( PVector float ) and functions ( void )
come from a

JAVA code

please give more details what you try to do.


please note that this forum tries to help with BOTH,
but what we look for is the header… where you selected Processing ( not p5.js )
and also your code looks like Processing JAVA

so what we expect is that you have installed on your computer Processing 3.5.3 and use JAVA Mode.
https://processing.org/download/

if you ref to this video


you also see that he work in the processing IDE ( old version )

The snapshot is of my reader (where I put the code in; isn’t that called a reader?) which is Sublime. I type in Sublime and the program runs in Firefox browser. As far as I know, I’m using the p5 code in Sublime (downloaded from the p5js.org website, so should be JavaScript, right?

I am trying to follow that video, yeah; I didn’t know he was using an old version so it might not translate to what I try…

I do have the p3 Processing reader(?)/text editor(?), but haven’t actually used it. Do you reckon if I try this with the p5.js code in p3 it might work?

As I say, I’m new to all this, so I’m slow to get what I need to be doing! So, apologies if I’m wrong…

I should also say, that Daniel from the video told me to ask things in this forum, because there’s a lot more of you than him…

hi, yes , you are very welcome here…

but at first i ask you to forget all the tools, the code , the videos
it is UP TO YOU what you want to LEARN to DO.

basically you tell me if:
want learn to make code for a good graphic show

in a browser / online / so friends can see it ( with a link provided )
YOU must learn p5.js / write a sketch.js file / best online here
( and make a account there )

OR

learn JAVA used in a stand alone desktop app on your PC
best using processing 3.5.3 IDE and writing mysketch.pde files


but also it is true that in both cases the CODE you can write by any editor,
we can not teach all in one question,
so as a beginner i urge you to use
JAVA >> processing IDE 3.5.3
JS >> p5.js online editor


JAVA and JS, that are 2 different languages
but the prepared functionality for processing
makes it actually easy to work with both / even not all can be translated…

but i can not tell you how much confusing it might be to explore both in the beginning
might be better you try like
++ one month JAVA
++ one month JS

even the teaching videos ( and the mostly also provided code)
are helping for a fast learning curve,
( also all the provided examples / tutorials… )
you must start alone with a empty sketch
and make just a line!
JAVA _ https://processing.org/reference/line_.html
JS ___ https://p5js.org/reference/#/p5/line
just to prove that you are in the right ( and correct installed ) environment
and use the correct language syntax.

1 Like

Thank you for replying, by the way!

What I’d like to eventually be able to code for is e.g. evolutionary simulations, flocking (boids) behaviour, predator-prey interactions, etc. Simulations that mimic real life scenarios, randomly, if you know what I mean?

And thank you for all the information so far!

Actually it’s called a text editor:

And when it’s tailored for programmers as well, it’s also called an IDE:

Sublime is both a text editor and an IDE:

However, if you wanna learn more how to run p5js w/o an IDE, you should take a look at the recipe below:

1 Like

no, above my level,
but if you want learn coding then start:

variables ( and their scope )

FOR loops and IF ELSE questions

functions

classes

array / list ( of classes )

for the show you might want to do with the mathematical question above,
processing is a good tool, ( in all versions / JAVA / JS / PYTHON )

and the very basic question i lined out above already:
JS > in browser / local or online /
JAVA > in desktop app for Win/Linux/OSX

Thanks, Loop. Yeah, I thought it might be a reader; didn’t know about the IDE thing. I’ll try the Notepad way (been watching other Processing and p5.js videos, and one mentions using that), thanks!

Yeah, learning those things will definitely help, with all future coding, no doubt; thanks! JS in Sublime, then run in Firefox works (at least with some codes!). Following Shiffman, some codes work perfectly, and other don’t until I mess about and tweak and try a couple different things; but generally they do work, until it gets really complicated.

I do wonder though, about how you set up the whole thing. To use the p5.js etc. one video said to have the folder on the desktop, which I don’t understand (except that it worked when I did it, haha). Is this the same for other readers or coding languages? (Because I tried everything in p3 and nothing happened except a load of error messages! I assume I need to set it up differently?)

Also, the Sublime editor I’m using doesn’t show error messages like other editors do; anyone know how to turn them on, so I’m told which code is wrong where?

if you use the

  • P5 JS online editor for JS

OR the

  • processing IDE for JAVA

OR after install inside Processing IDE additionally the p5.js MODE

  • processing IDE for p5.js

in all cases you got your projects ( like where the files are stored… ) handled.

if you use any external code editor ( or IDE ) / store file to desktop /…
you must know / and do the project/file handling alone.

also we can not help you about that external tools,
and even it can be that the SUBLIME thing is better as processing IDE or online editor …
still you will be alone in this / as not supported here /


as you obviously decided to go with JS ( p5.js )
you can ask your coding questions here,
but still best way is to post just the link to your related online code
like: https://editor.p5js.org/kll/sketches/v4hWBOY-E

if you try to post your p5.js code here / and it will not run ( as not complete or files missing …)
might get much less help.


1 Like

Thanks, kll. I wouldn’t be able to use the online editor, because I don’t have internet access at home!

that is bad luck,
without access to the help/reference
https://p5js.org/reference/
download https://p5js.org/offline-reference/p5-reference.zip
and without the examples
what do exist/work OFFLINE in the processing IDE 3.5.3 / p5js MODE see:

you will have a hard time / good luck

1 Like

Ahh, offline references, that’s awesome, thanks, kll!