rokkitman
10/28/13 09:23PM
Python Spiral Program
As requested by Greasyi in the Mantra Text Generator thread (it's cool, go look... and stare... and listen...). Would've done this sooner, but I was out of town (and thus away from my comp).

hypnopics-collective.net/...pics/10836/Spiral-3_4.zip
Requires Python and Pygame.

It's actually like 6 years old and straight from the Collective, but I like it. It's not hard to customize (from my perspective, anyone without at least a little coding background might think differently), and most people will want to do so before using it ('cause of specific likes/dislikes... i.e. you might not want to be conditioned to wear panties). Overall it seems pretty solid for it's age. Sadly, I can't even begin to get the text-to-speech working (I'm on Windows, it will supposedly work on Mac), and there's a number of features that could be added, but I don't know enough Python to even know where to begin. What I CAN do is share the method to incorporate the mantra.txt file (spoilers are code to copy/paste):

Step 1: Open up config.py
Step 2: Jam < mantratext = open('mantra/mantra.txt', 'r') > minus brackets somewhere up top (I put it right below the list of defs). This assumes you have the folder "mantra" in the same folder as config.py, and the "mantra.txt" file within that folder (which should happen after running the generator, assuming things haven't changed THAT much with the last few versions).
Step 3: This is the full class as I have it... this can go between any of the other classes.

class Mantra (Standard):
name = "Mantra"
description="""\
Chants a mantra for the viewer to absorb."""
fullscreen = True
music = "music6.mp3"
image_dir = "images/"
def text(self): return spiral_on() + words_on() + with_images(words(mantratext.read()))

Step 4: Scroll aaaaalllll the way to the bottom and shove "Mantra" into the list of configs.
Step 5: Run spiral.py once you've got mantra.txt ready, then find and enter the number it slapped on to your class.
Step 6: Wake up sometime later. Also Profit!

I've been playing with this Program for a while now (over a year at least, probably much more), but most of my own customizations were made based around my own preferences and fetishes (rather than overall functionality). Thus, you all get the base version. Play with it as you will! And if anyone develops it further (do it do it do it), you should share... strictly for research purposes, of course... *cough*
Stem_Cell
10/28/13 10:34PM
By the way, just so I don't have to go through the hassle of setting up the right version of Python just to know what it looks like, would you post screenshots? I'm curious about how good it is.
rokkitman
10/29/13 12:41AM
Stem_Cell said:
By the way, just so I don't have to go through the hassle of setting up the right version of Python just to know what it looks like, would you post screenshots? I'm curious about how good it is.


...had a long post written out and navigated away from the page. Mad at myself.

imgur.com/a/TEvyV#0

Three different spirals I switch between, one being program-generated and the other two images it loads externally, all with images on and off for contrast.
greasyi
10/29/13 10:01AM
Thanks for posting! But it seems to be pretty broken. Just to get the thing to even start running I had to do find-replace on all the .py files and replace tabs with 8 spaces. Now it's at least not getting syntax errors but "from config import configs" doesn't seem to be working as intended because I get a "no configurations" error. I've never done anything in python so I'm not sure how to fix it (and it's way too late for me to try and figure it out tonight).
rokkitman
10/29/13 06:56PM
greasyi said:
But it seems to be pretty broken.


Hmm, as I said I've been using it for a long while now... don't remember how many hoops I had to jump through to get it to work ~_~ Didn't think it was that many... what OS are you on? Running Windows 7 myself.
greasyi
10/30/13 03:00AM
I misread the error, still just working on syntax errors. I'll probably use this as an opportunity to learn me some python and then post something when it's a little more... functional.

edit: turns out the syntax of printing to stdout changed since this was written (python 2 to python 3). I found that humorous. I'm debating whether to just get it working 2 or port it to 3 as an exercise.

edit: turns out pygame for python 3 is still more or less "in beta" anyway and is a complete nightmare to get working, so the issue is moot.

Turns out it works in python 2 as-is! I guess python 2 interprets all tabs as 8 spaces. I had no idea.
Stem_Cell
10/30/13 05:04AM
greasyi said:
edit: turns out the syntax of printing to stdout changed since this was written (python 2 to python 3). I found that humorous. I'm debating whether to just get it working 2 or port it to 3 as an exercise.

edit: turns out pygame for python 3 is still more or less "in beta" anyway and is a complete nightmare to get working, so the issue is moot.

Turns out it works in python 2 as-is! I guess python 2 interprets all tabs as 8 spaces. I had no idea.

See, this is what I was talking about!

Stem_Cell said:
[...] so I don't have to go through the hassle of setting up the right version of Python [...]


I tell you, the language as a whole looks like some experimental beta product with that sort of consideration for backward compatibility.
ProfessorRainheart
10/30/13 06:09AM
It would be amazing to have something like this fully functional that you can customize and such unfortunately with my limited programing skills I cant really make heads or tails of it I only know vb </3

Unfortunately i put all my points into charisma not intelligence ><

greasyi
11/01/13 03:02AM
This is inspiring but kind of a mess; I don't think I'd wanna work with this code base even if I were already a python expert. Once the mantra generator's feature-complete, I'll think about throwing together this sort of thing in java (should hypothetically be much easier than the god-forsaken options table was).
Stem_Cell
11/01/13 07:18AM
greasyi said:
Once the mantra generator's feature-complete, I'll think about throwing together this sort of thing in java (should hypothetically be much easier than the god-forsaken options table was).

Good luck, you'll need it :)
greasyi
11/01/13 08:57PM
At its most basic level, all I essentially need is to make a thread in a JPanel that loops applying an affine transformation to an image and redrawing it. They couldn't have possibly made that hard, right?
... right? *gulp*
Stem_Cell
11/02/13 03:49PM
greasyi said:
At its most basic level, all I essentially need is to make a thread in a JPanel that loops applying an affine transformation to an image and redrawing it. They couldn't have possibly made that hard, right?
... right? *gulp*

Hopefully not, but you know, the System.Drawing namespace of .NET rocks, C# is like Java but more elegant and Visual Studio can be configured to even tell you if your identifiers use proper English (I'm not making that up, the FxCop and StyleCop combo will pretty much guarantee your code looks great).

Just sayin'.
Risdan
11/09/13 09:34AM
I seem to be getting tripped up on the mantra folder. The program puts out an error saying "No such file or directory." Any clue how to fix this?
Stem_Cell
11/09/13 10:39AM
Risdan said:
I seem to be getting tripped up on the mantra folder. The program puts out an error saying "No such file or directory." Any clue how to fix this?

I can't say for sure since I didn't even try it but see if the path has weird characters (e.g., not English or even try without spaces).
Risdan
11/09/13 05:05PM
Stem_Cell said:
I can't say for sure since I didn't even try it but see if the path has weird characters (e.g., not English or even try without spaces).


I dont have spaces or characters. Its just a folder name mantra with a mantra.txt text file. I also have a renamed copy without the .txt in the name. Sadly all attempts failed.
1 2>>>


Reply | Forum Index