how do i get a script code into a script?

ok, i am new to scripts and phython things, and i was just wondering how i would go about turning a script code (like this one into a script that i can use in blender? i will be grateful for any help, thanks!

In the case of the galaxy script, for which parameters must be set without the help of a GUI, the best thing to do IMHO is to load it into the text editor window, set the four parameters as needed and run it using the Alt+P shortcut.



Well, you can run scrips from inside the TextEditor window of Blender. How you get the code there is up to you. You can either enter the code directly into it, or you can load an external file. Once you have the code in the TextEditor, hitting Alt-P will run it.

Just note, the spaces at the start of some lines are not spaces, they’re tab characters - python uses this syntax to define blocks of code - most commonly, parts of code that are to be repeated in loops.

Ctrl-C copies text
Ctrl-X cuts text
Ctrl-V pastes text

Ctrl-Shift-C copies text to M$ windows clipboard
Ctrl-Shift-X cuts text to the windows clipboard
Ctrl-Shift-V pastes text from the windows clipboard.

So, you could highlight the code on the web-link you provided, hit Ctrl-C, then go into blender and open the text editor. You could then hit Ctrl-Shift-V to paste this text. You then try to run it with Alt-P before going back and fixing up any parts of the code that go screwed up in the copy/paste process - watch those tabs/spcaes!!

Hope this helps.

ok, but how do i get the code into the text editor? (oh and thanks for the help :)) EDIT: nevermind, ive got it now, thanks for your help guys

That’s just plain lazy: how do you open a file in any program?
File > Open
OK, maybe not :wink:
You’ve already been given all the possibilities of copy/paste from Enhzflep.
If you’re not using window you still can copy/paste in an external text editor, the simplest will do and then save, in “blah-blah-blah/.blender/scripts” or somewhere else.
File > Open