Using pstricks leads to the same undefined control sequence error

While scrolling through the most popular questions i found this one: Nice scientific pictures show off. I tried compiling some of the scientific illustrations provided. Found that those that included pstricks gave me exactly the same error.

For example:

Compiling Electric field due to 3 charges gave me the following error:

After some digging, found some answers here: Undefined control sequence in basic pstricks work.

Went to the Menu > Options > Configure Texmaker > TeX commands tab, wrote in the pdflatex line: pdflatex -synctex=1 -shell-escape -interaction=nonstopmode %.tex. Still i could not compile the file without getting the same error.

Also tried compiling with LaTex+dvips+ps2pdf+Viewpdf This time I got a pdf file of 24 pages, that included 24 instances of the animation.

Any suggestions?

You get 24 pages which can then be later converted to an animation with a program like convert. However, this one can be run with pdflatex --shell-escape <file> and you'll get only one page:
\documentclass{article}