Forums > Javascript

How 'global' are globals?

August 1, 2010 | 4:58 pm

I am working on 2 interdependent scripts/patches that rely heavily on globals. a client and a router. i knew that there were issues communicating between runtime, max for live, and plain old MaxMSP and i was going to tackle that after the fact.

but i find that if i have clients in 1 patch, and a router in another everything is gravy, but when i open a 3rd patch that has a client, bedlam begins. udpsend and receive were suggested to me, but i really do not believe those would be helpful as i am–potentially–making too many channels to rely on udpsends feedback-less setup.

EDIT: to make it clearer, after more creative testing: if i have 8 clients in 1 patch and open that patch…no problem. if i instatiate a new patch after that, it acts as though those first 8 don’t exist.

i would also like to take this opportunity to request that globals gain the ability to speak across all max environments. i imagine that could be a security risk, so….i know it isn’t a snap your fingers and it’s done kinda thing, but I would greatly appreciate the functionality.

the scripts are monome-centric, but testmmc should work without a physical monome. shell3 has the router in it. press, slide and test are the clients.

August 1, 2010 | 5:40 pm

i thought for a moment that i made a simple mistake, which was what i hoped, but i am really getting frustrated now. when i make a new instance of a patch that has the client, the global that i am using to keep track of all of the clients is cleared.

August 1, 2010 | 6:21 pm

posting an updated zip. issue still there, but i adjusted possible causes.

August 2, 2010 | 1:17 am

I’m working on a similar system right now for monomod. I’ve only been coding for the last day, but I’m running into similar problems. I’ve found no problem running multiple clients with multiple hosts, my problem is coming up with a way to store and recall unique id’s and paths so that things stay the same for the next session. Its driving me nuts.

I’ll take a look at your methods when I get a chance and see what I can offer. Or maybe it will give me some insight into how I can do things differently. I glanced at it for a moment, it looks very interesting. You are going about things much differently than I am, but there are similarities.

Cheers, and good luck :)

August 2, 2010 | 3:10 am

huhn, i just looked up monomod, seems like a lot of people are putting together modular environments :-D

August 4, 2010 | 1:41 pm

what should I open and how do I reproduce the problem?

August 4, 2010 | 3:27 pm

if you open shell 3 and then open testmm3, everything works. (press a few squares on the grids to check)

wait a second…then open a second testmm3 patch …bedlam – "how did i get here" should post a bunch.

i will post modified patch that posts the list of clients

August 4, 2010 | 3:48 pm

never mind this attachement. i wish we could delete them.

August 4, 2010 | 3:57 pm

here is a more updated and better prepared version

August 5, 2010 | 1:26 am

ok. well. nothing to see here.

except 1 stupid line of code. seriously. at least it made absolutely no sense for that to be there. yeah. at least.

spectacular failure on my part. all it took was a few days away from the code to see that. moral of the story "don’t code during finals for something that is not for a final"

Thank you artm and amounra for trying to help what couldn’t be helped

August 5, 2010 | 10:23 am

Lol….sok, I just did the same thing…RTFM for me. What line was it anyway?

August 5, 2010 | 1:22 pm

so, after a good bit of rest, and a moment of contemplation, i considered the fact that the router global has a few properties that DID persist. it was ONLY the applist that dissapeared. so then i thought "I don’t do anything with theappList in the client script. i mean, i shouldn’t there is no reason to. let me just search for ‘appList’ and confirm that."

so what do i see?
mcGlobal.appList = new Array();


August 5, 2010 | 6:51 pm

Ooopsie. I think we’ve all done it. The important thing is that you can stop coding now and get to the doctor to get that nervous tick checked out ;)

Seriously, I just did the same thing lol. All works splendidly now.

Viewing 13 posts - 1 through 13 (of 13 total)