How 'global' are globals?

Griotspeak's icon

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.

894.maxMonoConfig_preview_010-08-01.zip
zip
Griotspeak's icon

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.

Griotspeak's icon

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

895.maxMonoConfig-023.zip
zip
amounra's icon

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 :)

Griotspeak's icon

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

artm's icon

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

Griotspeak's icon

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

Griotspeak's icon

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

916.maxMonoConfig_ForForum.zip
zip
Griotspeak's icon

here is a more updated and better prepared version

917.maxMonoConfig_for_forum.zip
zip
Griotspeak's icon

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

amounra's icon

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

Griotspeak's icon

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();

what?

amounra's icon

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.